index.js 105 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = Object.setPrototypeOf ||
  3. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5. return function (d, b) {
  6. extendStatics(d, b);
  7. function __() { this.constructor = d; }
  8. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  9. };
  10. })();
  11. if(typeof require !== 'undefined'){
  12. var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : this);
  13. var BABYLON = globalObject["BABYLON"] || {};
  14. var BABYLON0 = require('babylonjs/core');
  15. if(BABYLON !== BABYLON0) __extends(BABYLON, BABYLON0);
  16. var BABYLON;
  17. (function (BABYLON) {
  18. var Condition = /** @class */ (function () {
  19. function Condition(actionManager) {
  20. this._actionManager = actionManager;
  21. }
  22. Condition.prototype.isValid = function () {
  23. return true;
  24. };
  25. Condition.prototype._getProperty = function (propertyPath) {
  26. return this._actionManager._getProperty(propertyPath);
  27. };
  28. Condition.prototype._getEffectiveTarget = function (target, propertyPath) {
  29. return this._actionManager._getEffectiveTarget(target, propertyPath);
  30. };
  31. Condition.prototype.serialize = function () {
  32. };
  33. Condition.prototype._serialize = function (serializedCondition) {
  34. return {
  35. type: 2,
  36. children: [],
  37. name: serializedCondition.name,
  38. properties: serializedCondition.properties
  39. };
  40. };
  41. return Condition;
  42. }());
  43. BABYLON.Condition = Condition;
  44. var ValueCondition = /** @class */ (function (_super) {
  45. __extends(ValueCondition, _super);
  46. function ValueCondition(actionManager, target, propertyPath, value, operator) {
  47. if (operator === void 0) { operator = ValueCondition.IsEqual; }
  48. var _this = _super.call(this, actionManager) || this;
  49. _this.propertyPath = propertyPath;
  50. _this.value = value;
  51. _this.operator = operator;
  52. _this._target = target;
  53. _this._effectiveTarget = _this._getEffectiveTarget(target, _this.propertyPath);
  54. _this._property = _this._getProperty(_this.propertyPath);
  55. return _this;
  56. }
  57. Object.defineProperty(ValueCondition, "IsEqual", {
  58. get: function () {
  59. return ValueCondition._IsEqual;
  60. },
  61. enumerable: true,
  62. configurable: true
  63. });
  64. Object.defineProperty(ValueCondition, "IsDifferent", {
  65. get: function () {
  66. return ValueCondition._IsDifferent;
  67. },
  68. enumerable: true,
  69. configurable: true
  70. });
  71. Object.defineProperty(ValueCondition, "IsGreater", {
  72. get: function () {
  73. return ValueCondition._IsGreater;
  74. },
  75. enumerable: true,
  76. configurable: true
  77. });
  78. Object.defineProperty(ValueCondition, "IsLesser", {
  79. get: function () {
  80. return ValueCondition._IsLesser;
  81. },
  82. enumerable: true,
  83. configurable: true
  84. });
  85. // Methods
  86. ValueCondition.prototype.isValid = function () {
  87. switch (this.operator) {
  88. case ValueCondition.IsGreater:
  89. return this._effectiveTarget[this._property] > this.value;
  90. case ValueCondition.IsLesser:
  91. return this._effectiveTarget[this._property] < this.value;
  92. case ValueCondition.IsEqual:
  93. case ValueCondition.IsDifferent:
  94. var check;
  95. if (this.value.equals) {
  96. check = this.value.equals(this._effectiveTarget[this._property]);
  97. }
  98. else {
  99. check = this.value === this._effectiveTarget[this._property];
  100. }
  101. return this.operator === ValueCondition.IsEqual ? check : !check;
  102. }
  103. return false;
  104. };
  105. ValueCondition.prototype.serialize = function () {
  106. return this._serialize({
  107. name: "ValueCondition",
  108. properties: [
  109. BABYLON.Action._GetTargetProperty(this._target),
  110. { name: "propertyPath", value: this.propertyPath },
  111. { name: "value", value: BABYLON.Action._SerializeValueAsString(this.value) },
  112. { name: "operator", value: ValueCondition.GetOperatorName(this.operator) }
  113. ]
  114. });
  115. };
  116. ValueCondition.GetOperatorName = function (operator) {
  117. switch (operator) {
  118. case ValueCondition._IsEqual: return "IsEqual";
  119. case ValueCondition._IsDifferent: return "IsDifferent";
  120. case ValueCondition._IsGreater: return "IsGreater";
  121. case ValueCondition._IsLesser: return "IsLesser";
  122. default: return "";
  123. }
  124. };
  125. // Statics
  126. ValueCondition._IsEqual = 0;
  127. ValueCondition._IsDifferent = 1;
  128. ValueCondition._IsGreater = 2;
  129. ValueCondition._IsLesser = 3;
  130. return ValueCondition;
  131. }(Condition));
  132. BABYLON.ValueCondition = ValueCondition;
  133. var PredicateCondition = /** @class */ (function (_super) {
  134. __extends(PredicateCondition, _super);
  135. function PredicateCondition(actionManager, predicate) {
  136. var _this = _super.call(this, actionManager) || this;
  137. _this.predicate = predicate;
  138. return _this;
  139. }
  140. PredicateCondition.prototype.isValid = function () {
  141. return this.predicate();
  142. };
  143. return PredicateCondition;
  144. }(Condition));
  145. BABYLON.PredicateCondition = PredicateCondition;
  146. var StateCondition = /** @class */ (function (_super) {
  147. __extends(StateCondition, _super);
  148. function StateCondition(actionManager, target, value) {
  149. var _this = _super.call(this, actionManager) || this;
  150. _this.value = value;
  151. _this._target = target;
  152. return _this;
  153. }
  154. // Methods
  155. StateCondition.prototype.isValid = function () {
  156. return this._target.state === this.value;
  157. };
  158. StateCondition.prototype.serialize = function () {
  159. return this._serialize({
  160. name: "StateCondition",
  161. properties: [
  162. BABYLON.Action._GetTargetProperty(this._target),
  163. { name: "value", value: this.value }
  164. ]
  165. });
  166. };
  167. return StateCondition;
  168. }(Condition));
  169. BABYLON.StateCondition = StateCondition;
  170. })(BABYLON || (BABYLON = {}));
  171. //# sourceMappingURL=babylon.condition.js.map
  172. var BABYLON;
  173. (function (BABYLON) {
  174. var Action = /** @class */ (function () {
  175. function Action(triggerOptions, condition) {
  176. this.triggerOptions = triggerOptions;
  177. this.onBeforeExecuteObservable = new BABYLON.Observable();
  178. if (triggerOptions.parameter) {
  179. this.trigger = triggerOptions.trigger;
  180. this._triggerParameter = triggerOptions.parameter;
  181. }
  182. else {
  183. this.trigger = triggerOptions;
  184. }
  185. this._nextActiveAction = this;
  186. this._condition = condition;
  187. }
  188. // Methods
  189. Action.prototype._prepare = function () {
  190. };
  191. Action.prototype.getTriggerParameter = function () {
  192. return this._triggerParameter;
  193. };
  194. Action.prototype._executeCurrent = function (evt) {
  195. if (this._nextActiveAction._condition) {
  196. var condition = this._nextActiveAction._condition;
  197. var currentRenderId = this._actionManager.getScene().getRenderId();
  198. // We cache the current evaluation for the current frame
  199. if (condition._evaluationId === currentRenderId) {
  200. if (!condition._currentResult) {
  201. return;
  202. }
  203. }
  204. else {
  205. condition._evaluationId = currentRenderId;
  206. if (!condition.isValid()) {
  207. condition._currentResult = false;
  208. return;
  209. }
  210. condition._currentResult = true;
  211. }
  212. }
  213. this.onBeforeExecuteObservable.notifyObservers(this);
  214. this._nextActiveAction.execute(evt);
  215. this.skipToNextActiveAction();
  216. };
  217. Action.prototype.execute = function (evt) {
  218. };
  219. Action.prototype.skipToNextActiveAction = function () {
  220. if (this._nextActiveAction._child) {
  221. if (!this._nextActiveAction._child._actionManager) {
  222. this._nextActiveAction._child._actionManager = this._actionManager;
  223. }
  224. this._nextActiveAction = this._nextActiveAction._child;
  225. }
  226. else {
  227. this._nextActiveAction = this;
  228. }
  229. };
  230. Action.prototype.then = function (action) {
  231. this._child = action;
  232. action._actionManager = this._actionManager;
  233. action._prepare();
  234. return action;
  235. };
  236. Action.prototype._getProperty = function (propertyPath) {
  237. return this._actionManager._getProperty(propertyPath);
  238. };
  239. Action.prototype._getEffectiveTarget = function (target, propertyPath) {
  240. return this._actionManager._getEffectiveTarget(target, propertyPath);
  241. };
  242. Action.prototype.serialize = function (parent) {
  243. };
  244. // Called by BABYLON.Action objects in serialize(...). Internal use
  245. Action.prototype._serialize = function (serializedAction, parent) {
  246. var serializationObject = {
  247. type: 1,
  248. children: [],
  249. name: serializedAction.name,
  250. properties: serializedAction.properties || []
  251. };
  252. // Serialize child
  253. if (this._child) {
  254. this._child.serialize(serializationObject);
  255. }
  256. // Check if "this" has a condition
  257. if (this._condition) {
  258. var serializedCondition = this._condition.serialize();
  259. serializedCondition.children.push(serializationObject);
  260. if (parent) {
  261. parent.children.push(serializedCondition);
  262. }
  263. return serializedCondition;
  264. }
  265. if (parent) {
  266. parent.children.push(serializationObject);
  267. }
  268. return serializationObject;
  269. };
  270. Action._SerializeValueAsString = function (value) {
  271. if (typeof value === "number") {
  272. return value.toString();
  273. }
  274. if (typeof value === "boolean") {
  275. return value ? "true" : "false";
  276. }
  277. if (value instanceof BABYLON.Vector2) {
  278. return value.x + ", " + value.y;
  279. }
  280. if (value instanceof BABYLON.Vector3) {
  281. return value.x + ", " + value.y + ", " + value.z;
  282. }
  283. if (value instanceof BABYLON.Color3) {
  284. return value.r + ", " + value.g + ", " + value.b;
  285. }
  286. if (value instanceof BABYLON.Color4) {
  287. return value.r + ", " + value.g + ", " + value.b + ", " + value.a;
  288. }
  289. return value; // string
  290. };
  291. Action._GetTargetProperty = function (target) {
  292. return {
  293. name: "target",
  294. targetType: target instanceof BABYLON.Mesh ? "MeshProperties"
  295. : target instanceof BABYLON.Light ? "LightProperties"
  296. : target instanceof BABYLON.Camera ? "CameraProperties"
  297. : "SceneProperties",
  298. value: target instanceof BABYLON.Scene ? "Scene" : target.name
  299. };
  300. };
  301. return Action;
  302. }());
  303. BABYLON.Action = Action;
  304. })(BABYLON || (BABYLON = {}));
  305. //# sourceMappingURL=babylon.action.js.map
  306. BABYLON.Effect.ShadersStore['defaultVertexShader'] = "#include<__decl__defaultVertex>\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 VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\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(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<bumpVertexDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[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<logDepthDeclaration>\nvoid main(void) {\nvec3 positionUpdated=position;\n#ifdef NORMAL \nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvPositionUVW=positionUpdated;\n#endif \n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\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 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,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(uv,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(uv,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(uv,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(uv,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(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include<bumpVertex>\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include<pointCloudVertex>\n#include<logDepthVertex>\n}";
  307. BABYLON.Effect.ShadersStore['defaultPixelShader'] = "#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\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<helperFunctions>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\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\n#include<fresnelFunction>\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<reflectionFunction>\n#endif\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\nvoid main(void) {\n#include<clipPlaneFragment>\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<bumpFragment>\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#ifdef ALPHAFROMDIFFUSE\nalpha*=baseColor.a;\n#endif\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#include<depthPrePass>\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\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\nvec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb*vLightmapInfos.y;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n\nvec3 refractionColor=vec3(0.,0.,0.);\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)\n{\nrefractionColor=textureCube(refractionCubeSampler,refractionVector).rgb*vRefractionInfos.x;\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).rgb*vRefractionInfos.x;\n#endif\n#endif\n\nvec3 reflectionColor=vec3(0.,0.,0.);\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).rgb*vReflectionInfos.x;\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW).rgb*vReflectionInfos.x;\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).rgb*vReflectionInfos.x;\n#endif\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor*=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*=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\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);\nemissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);\ndiffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+emissiveColor+refractionColor,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+refractionColor,alpha);\n#endif\n\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor;\n#else\ncolor.rgb+=lightmapColor;\n#endif\n#endif\n#endif\n#include<logDepthFragment>\n#include<fogFragment>\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\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\ngl_FragColor=color;\n}";
  308. var BABYLON;
  309. (function (BABYLON) {
  310. /**
  311. * ActionEvent is the event beint sent when an action is triggered.
  312. */
  313. var ActionEvent = /** @class */ (function () {
  314. /**
  315. * @param source The mesh or sprite that triggered the action.
  316. * @param pointerX The X mouse cursor position at the time of the event
  317. * @param pointerY The Y mouse cursor position at the time of the event
  318. * @param meshUnderPointer The mesh that is currently pointed at (can be null)
  319. * @param sourceEvent the original (browser) event that triggered the ActionEvent
  320. */
  321. function ActionEvent(source, pointerX, pointerY, meshUnderPointer, sourceEvent, additionalData) {
  322. this.source = source;
  323. this.pointerX = pointerX;
  324. this.pointerY = pointerY;
  325. this.meshUnderPointer = meshUnderPointer;
  326. this.sourceEvent = sourceEvent;
  327. this.additionalData = additionalData;
  328. }
  329. /**
  330. * Helper function to auto-create an ActionEvent from a source mesh.
  331. * @param source The source mesh that triggered the event
  332. * @param evt {Event} The original (browser) event
  333. */
  334. ActionEvent.CreateNew = function (source, evt, additionalData) {
  335. var scene = source.getScene();
  336. return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);
  337. };
  338. /**
  339. * Helper function to auto-create an ActionEvent from a source mesh.
  340. * @param source The source sprite that triggered the event
  341. * @param scene Scene associated with the sprite
  342. * @param evt {Event} The original (browser) event
  343. */
  344. ActionEvent.CreateNewFromSprite = function (source, scene, evt, additionalData) {
  345. return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);
  346. };
  347. /**
  348. * Helper function to auto-create an ActionEvent from a scene. If triggered by a mesh use ActionEvent.CreateNew
  349. * @param scene the scene where the event occurred
  350. * @param evt {Event} The original (browser) event
  351. */
  352. ActionEvent.CreateNewFromScene = function (scene, evt) {
  353. return new ActionEvent(null, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt);
  354. };
  355. ActionEvent.CreateNewFromPrimitive = function (prim, pointerPos, evt, additionalData) {
  356. return new ActionEvent(prim, pointerPos.x, pointerPos.y, null, evt, additionalData);
  357. };
  358. return ActionEvent;
  359. }());
  360. BABYLON.ActionEvent = ActionEvent;
  361. /**
  362. * Action Manager manages all events to be triggered on a given mesh or the global scene.
  363. * A single scene can have many Action Managers to handle predefined actions on specific meshes.
  364. */
  365. var ActionManager = /** @class */ (function () {
  366. function ActionManager(scene) {
  367. // Members
  368. this.actions = new Array();
  369. this.hoverCursor = '';
  370. this._scene = scene;
  371. scene._actionManagers.push(this);
  372. }
  373. Object.defineProperty(ActionManager, "NothingTrigger", {
  374. get: function () {
  375. return ActionManager._NothingTrigger;
  376. },
  377. enumerable: true,
  378. configurable: true
  379. });
  380. Object.defineProperty(ActionManager, "OnPickTrigger", {
  381. get: function () {
  382. return ActionManager._OnPickTrigger;
  383. },
  384. enumerable: true,
  385. configurable: true
  386. });
  387. Object.defineProperty(ActionManager, "OnLeftPickTrigger", {
  388. get: function () {
  389. return ActionManager._OnLeftPickTrigger;
  390. },
  391. enumerable: true,
  392. configurable: true
  393. });
  394. Object.defineProperty(ActionManager, "OnRightPickTrigger", {
  395. get: function () {
  396. return ActionManager._OnRightPickTrigger;
  397. },
  398. enumerable: true,
  399. configurable: true
  400. });
  401. Object.defineProperty(ActionManager, "OnCenterPickTrigger", {
  402. get: function () {
  403. return ActionManager._OnCenterPickTrigger;
  404. },
  405. enumerable: true,
  406. configurable: true
  407. });
  408. Object.defineProperty(ActionManager, "OnPickDownTrigger", {
  409. get: function () {
  410. return ActionManager._OnPickDownTrigger;
  411. },
  412. enumerable: true,
  413. configurable: true
  414. });
  415. Object.defineProperty(ActionManager, "OnDoublePickTrigger", {
  416. get: function () {
  417. return ActionManager._OnDoublePickTrigger;
  418. },
  419. enumerable: true,
  420. configurable: true
  421. });
  422. Object.defineProperty(ActionManager, "OnPickUpTrigger", {
  423. get: function () {
  424. return ActionManager._OnPickUpTrigger;
  425. },
  426. enumerable: true,
  427. configurable: true
  428. });
  429. Object.defineProperty(ActionManager, "OnPickOutTrigger", {
  430. /// This trigger will only be raised if you also declared a OnPickDown
  431. get: function () {
  432. return ActionManager._OnPickOutTrigger;
  433. },
  434. enumerable: true,
  435. configurable: true
  436. });
  437. Object.defineProperty(ActionManager, "OnLongPressTrigger", {
  438. get: function () {
  439. return ActionManager._OnLongPressTrigger;
  440. },
  441. enumerable: true,
  442. configurable: true
  443. });
  444. Object.defineProperty(ActionManager, "OnPointerOverTrigger", {
  445. get: function () {
  446. return ActionManager._OnPointerOverTrigger;
  447. },
  448. enumerable: true,
  449. configurable: true
  450. });
  451. Object.defineProperty(ActionManager, "OnPointerOutTrigger", {
  452. get: function () {
  453. return ActionManager._OnPointerOutTrigger;
  454. },
  455. enumerable: true,
  456. configurable: true
  457. });
  458. Object.defineProperty(ActionManager, "OnEveryFrameTrigger", {
  459. get: function () {
  460. return ActionManager._OnEveryFrameTrigger;
  461. },
  462. enumerable: true,
  463. configurable: true
  464. });
  465. Object.defineProperty(ActionManager, "OnIntersectionEnterTrigger", {
  466. get: function () {
  467. return ActionManager._OnIntersectionEnterTrigger;
  468. },
  469. enumerable: true,
  470. configurable: true
  471. });
  472. Object.defineProperty(ActionManager, "OnIntersectionExitTrigger", {
  473. get: function () {
  474. return ActionManager._OnIntersectionExitTrigger;
  475. },
  476. enumerable: true,
  477. configurable: true
  478. });
  479. Object.defineProperty(ActionManager, "OnKeyDownTrigger", {
  480. get: function () {
  481. return ActionManager._OnKeyDownTrigger;
  482. },
  483. enumerable: true,
  484. configurable: true
  485. });
  486. Object.defineProperty(ActionManager, "OnKeyUpTrigger", {
  487. get: function () {
  488. return ActionManager._OnKeyUpTrigger;
  489. },
  490. enumerable: true,
  491. configurable: true
  492. });
  493. // Methods
  494. ActionManager.prototype.dispose = function () {
  495. var index = this._scene._actionManagers.indexOf(this);
  496. for (var i = 0; i < this.actions.length; i++) {
  497. var action = this.actions[i];
  498. ActionManager.Triggers[action.trigger]--;
  499. if (ActionManager.Triggers[action.trigger] === 0) {
  500. delete ActionManager.Triggers[action.trigger];
  501. }
  502. }
  503. if (index > -1) {
  504. this._scene._actionManagers.splice(index, 1);
  505. }
  506. };
  507. ActionManager.prototype.getScene = function () {
  508. return this._scene;
  509. };
  510. /**
  511. * Does this action manager handles actions of any of the given triggers
  512. * @param {number[]} triggers - the triggers to be tested
  513. * @return {boolean} whether one (or more) of the triggers is handeled
  514. */
  515. ActionManager.prototype.hasSpecificTriggers = function (triggers) {
  516. for (var index = 0; index < this.actions.length; index++) {
  517. var action = this.actions[index];
  518. if (triggers.indexOf(action.trigger) > -1) {
  519. return true;
  520. }
  521. }
  522. return false;
  523. };
  524. /**
  525. * Does this action manager handles actions of a given trigger
  526. * @param {number} trigger - the trigger to be tested
  527. * @return {boolean} whether the trigger is handeled
  528. */
  529. ActionManager.prototype.hasSpecificTrigger = function (trigger) {
  530. for (var index = 0; index < this.actions.length; index++) {
  531. var action = this.actions[index];
  532. if (action.trigger === trigger) {
  533. return true;
  534. }
  535. }
  536. return false;
  537. };
  538. Object.defineProperty(ActionManager.prototype, "hasPointerTriggers", {
  539. /**
  540. * Does this action manager has pointer triggers
  541. * @return {boolean} whether or not it has pointer triggers
  542. */
  543. get: function () {
  544. for (var index = 0; index < this.actions.length; index++) {
  545. var action = this.actions[index];
  546. if (action.trigger >= ActionManager._OnPickTrigger && action.trigger <= ActionManager._OnPointerOutTrigger) {
  547. return true;
  548. }
  549. }
  550. return false;
  551. },
  552. enumerable: true,
  553. configurable: true
  554. });
  555. Object.defineProperty(ActionManager.prototype, "hasPickTriggers", {
  556. /**
  557. * Does this action manager has pick triggers
  558. * @return {boolean} whether or not it has pick triggers
  559. */
  560. get: function () {
  561. for (var index = 0; index < this.actions.length; index++) {
  562. var action = this.actions[index];
  563. if (action.trigger >= ActionManager._OnPickTrigger && action.trigger <= ActionManager._OnPickUpTrigger) {
  564. return true;
  565. }
  566. }
  567. return false;
  568. },
  569. enumerable: true,
  570. configurable: true
  571. });
  572. Object.defineProperty(ActionManager, "HasTriggers", {
  573. /**
  574. * Does exist one action manager with at least one trigger
  575. * @return {boolean} whether or not it exists one action manager with one trigger
  576. **/
  577. get: function () {
  578. for (var t in ActionManager.Triggers) {
  579. if (ActionManager.Triggers.hasOwnProperty(t)) {
  580. return true;
  581. }
  582. }
  583. return false;
  584. },
  585. enumerable: true,
  586. configurable: true
  587. });
  588. Object.defineProperty(ActionManager, "HasPickTriggers", {
  589. /**
  590. * Does exist one action manager with at least one pick trigger
  591. * @return {boolean} whether or not it exists one action manager with one pick trigger
  592. **/
  593. get: function () {
  594. for (var t in ActionManager.Triggers) {
  595. if (ActionManager.Triggers.hasOwnProperty(t)) {
  596. var t_int = parseInt(t);
  597. if (t_int >= ActionManager._OnPickTrigger && t_int <= ActionManager._OnPickUpTrigger) {
  598. return true;
  599. }
  600. }
  601. }
  602. return false;
  603. },
  604. enumerable: true,
  605. configurable: true
  606. });
  607. /**
  608. * Does exist one action manager that handles actions of a given trigger
  609. * @param {number} trigger - the trigger to be tested
  610. * @return {boolean} whether the trigger is handeled by at least one action manager
  611. **/
  612. ActionManager.HasSpecificTrigger = function (trigger) {
  613. for (var t in ActionManager.Triggers) {
  614. if (ActionManager.Triggers.hasOwnProperty(t)) {
  615. var t_int = parseInt(t);
  616. if (t_int === trigger) {
  617. return true;
  618. }
  619. }
  620. }
  621. return false;
  622. };
  623. /**
  624. * Registers an action to this action manager
  625. * @param {BABYLON.Action} action - the action to be registered
  626. * @return {BABYLON.Action} the action amended (prepared) after registration
  627. */
  628. ActionManager.prototype.registerAction = function (action) {
  629. if (action.trigger === ActionManager.OnEveryFrameTrigger) {
  630. if (this.getScene().actionManager !== this) {
  631. BABYLON.Tools.Warn("OnEveryFrameTrigger can only be used with scene.actionManager");
  632. return null;
  633. }
  634. }
  635. this.actions.push(action);
  636. if (ActionManager.Triggers[action.trigger]) {
  637. ActionManager.Triggers[action.trigger]++;
  638. }
  639. else {
  640. ActionManager.Triggers[action.trigger] = 1;
  641. }
  642. action._actionManager = this;
  643. action._prepare();
  644. return action;
  645. };
  646. /**
  647. * Process a specific trigger
  648. * @param {number} trigger - the trigger to process
  649. * @param evt {BABYLON.ActionEvent} the event details to be processed
  650. */
  651. ActionManager.prototype.processTrigger = function (trigger, evt) {
  652. for (var index = 0; index < this.actions.length; index++) {
  653. var action = this.actions[index];
  654. if (action.trigger === trigger) {
  655. if (evt) {
  656. if (trigger === ActionManager.OnKeyUpTrigger
  657. || trigger === ActionManager.OnKeyDownTrigger) {
  658. var parameter = action.getTriggerParameter();
  659. if (parameter && parameter !== evt.sourceEvent.keyCode) {
  660. if (!parameter.toLowerCase) {
  661. continue;
  662. }
  663. var lowerCase = parameter.toLowerCase();
  664. if (lowerCase !== evt.sourceEvent.key) {
  665. var unicode = evt.sourceEvent.charCode ? evt.sourceEvent.charCode : evt.sourceEvent.keyCode;
  666. var actualkey = String.fromCharCode(unicode).toLowerCase();
  667. if (actualkey !== lowerCase) {
  668. continue;
  669. }
  670. }
  671. }
  672. }
  673. }
  674. action._executeCurrent(evt);
  675. }
  676. }
  677. };
  678. ActionManager.prototype._getEffectiveTarget = function (target, propertyPath) {
  679. var properties = propertyPath.split(".");
  680. for (var index = 0; index < properties.length - 1; index++) {
  681. target = target[properties[index]];
  682. }
  683. return target;
  684. };
  685. ActionManager.prototype._getProperty = function (propertyPath) {
  686. var properties = propertyPath.split(".");
  687. return properties[properties.length - 1];
  688. };
  689. ActionManager.prototype.serialize = function (name) {
  690. var root = {
  691. children: new Array(),
  692. name: name,
  693. type: 3,
  694. properties: new Array() // Empty for root but required
  695. };
  696. for (var i = 0; i < this.actions.length; i++) {
  697. var triggerObject = {
  698. type: 0,
  699. children: new Array(),
  700. name: ActionManager.GetTriggerName(this.actions[i].trigger),
  701. properties: new Array()
  702. };
  703. var triggerOptions = this.actions[i].triggerOptions;
  704. if (triggerOptions && typeof triggerOptions !== "number") {
  705. if (triggerOptions.parameter instanceof BABYLON.Node) {
  706. triggerObject.properties.push(BABYLON.Action._GetTargetProperty(triggerOptions.parameter));
  707. }
  708. else {
  709. var parameter = {};
  710. BABYLON.Tools.DeepCopy(triggerOptions.parameter, parameter, ["mesh"]);
  711. if (triggerOptions.parameter.mesh) {
  712. parameter._meshId = triggerOptions.parameter.mesh.id;
  713. }
  714. triggerObject.properties.push({ name: "parameter", targetType: null, value: parameter });
  715. }
  716. }
  717. // Serialize child action, recursively
  718. this.actions[i].serialize(triggerObject);
  719. // Add serialized trigger
  720. root.children.push(triggerObject);
  721. }
  722. return root;
  723. };
  724. ActionManager.Parse = function (parsedActions, object, scene) {
  725. var actionManager = new ActionManager(scene);
  726. if (object === null)
  727. scene.actionManager = actionManager;
  728. else
  729. object.actionManager = actionManager;
  730. // instanciate a new object
  731. var instanciate = function (name, params) {
  732. // TODO: We will need to find a solution for the next line when using commonjs / es6 .
  733. var newInstance = Object.create(BABYLON.Tools.Instantiate("BABYLON." + name).prototype);
  734. newInstance.constructor.apply(newInstance, params);
  735. return newInstance;
  736. };
  737. var parseParameter = function (name, value, target, propertyPath) {
  738. if (propertyPath === null) {
  739. // String, boolean or float
  740. var floatValue = parseFloat(value);
  741. if (value === "true" || value === "false")
  742. return value === "true";
  743. else
  744. return isNaN(floatValue) ? value : floatValue;
  745. }
  746. var effectiveTarget = propertyPath.split(".");
  747. var values = value.split(",");
  748. // Get effective Target
  749. for (var i = 0; i < effectiveTarget.length; i++) {
  750. target = target[effectiveTarget[i]];
  751. }
  752. // Return appropriate value with its type
  753. if (typeof (target) === "boolean")
  754. return values[0] === "true";
  755. if (typeof (target) === "string")
  756. return values[0];
  757. // Parameters with multiple values such as Vector3 etc.
  758. var split = new Array();
  759. for (var i = 0; i < values.length; i++)
  760. split.push(parseFloat(values[i]));
  761. if (target instanceof BABYLON.Vector3)
  762. return BABYLON.Vector3.FromArray(split);
  763. if (target instanceof BABYLON.Vector4)
  764. return BABYLON.Vector4.FromArray(split);
  765. if (target instanceof BABYLON.Color3)
  766. return BABYLON.Color3.FromArray(split);
  767. if (target instanceof BABYLON.Color4)
  768. return BABYLON.Color4.FromArray(split);
  769. return parseFloat(values[0]);
  770. };
  771. // traverse graph per trigger
  772. var traverse = function (parsedAction, trigger, condition, action, combineArray) {
  773. if (combineArray === void 0) { combineArray = null; }
  774. if (parsedAction.detached)
  775. return;
  776. var parameters = new Array();
  777. var target = null;
  778. var propertyPath = null;
  779. var combine = parsedAction.combine && parsedAction.combine.length > 0;
  780. // Parameters
  781. if (parsedAction.type === 2)
  782. parameters.push(actionManager);
  783. else
  784. parameters.push(trigger);
  785. if (combine) {
  786. var actions = new Array();
  787. for (var j = 0; j < parsedAction.combine.length; j++) {
  788. traverse(parsedAction.combine[j], ActionManager.NothingTrigger, condition, action, actions);
  789. }
  790. parameters.push(actions);
  791. }
  792. else {
  793. for (var i = 0; i < parsedAction.properties.length; i++) {
  794. var value = parsedAction.properties[i].value;
  795. var name = parsedAction.properties[i].name;
  796. var targetType = parsedAction.properties[i].targetType;
  797. if (name === "target")
  798. if (targetType !== null && targetType === "SceneProperties")
  799. value = target = scene;
  800. else
  801. value = target = scene.getNodeByName(value);
  802. else if (name === "parent")
  803. value = scene.getNodeByName(value);
  804. else if (name === "sound")
  805. value = scene.getSoundByName(value);
  806. else if (name !== "propertyPath") {
  807. if (parsedAction.type === 2 && name === "operator")
  808. value = BABYLON.ValueCondition[value];
  809. else
  810. value = parseParameter(name, value, target, name === "value" ? propertyPath : null);
  811. }
  812. else {
  813. propertyPath = value;
  814. }
  815. parameters.push(value);
  816. }
  817. }
  818. if (combineArray === null) {
  819. parameters.push(condition);
  820. }
  821. else {
  822. parameters.push(null);
  823. }
  824. // If interpolate value action
  825. if (parsedAction.name === "InterpolateValueAction") {
  826. var param = parameters[parameters.length - 2];
  827. parameters[parameters.length - 1] = param;
  828. parameters[parameters.length - 2] = condition;
  829. }
  830. // Action or condition(s) and not CombineAction
  831. var newAction = instanciate(parsedAction.name, parameters);
  832. if (newAction instanceof BABYLON.Condition && condition !== null) {
  833. var nothing = new BABYLON.DoNothingAction(trigger, condition);
  834. if (action)
  835. action.then(nothing);
  836. else
  837. actionManager.registerAction(nothing);
  838. action = nothing;
  839. }
  840. if (combineArray === null) {
  841. if (newAction instanceof BABYLON.Condition) {
  842. condition = newAction;
  843. newAction = action;
  844. }
  845. else {
  846. condition = null;
  847. if (action)
  848. action.then(newAction);
  849. else
  850. actionManager.registerAction(newAction);
  851. }
  852. }
  853. else {
  854. combineArray.push(newAction);
  855. }
  856. for (var i = 0; i < parsedAction.children.length; i++)
  857. traverse(parsedAction.children[i], trigger, condition, newAction, null);
  858. };
  859. // triggers
  860. for (var i = 0; i < parsedActions.children.length; i++) {
  861. var triggerParams;
  862. var trigger = parsedActions.children[i];
  863. if (trigger.properties.length > 0) {
  864. var param = trigger.properties[0].value;
  865. var value = trigger.properties[0].targetType === null ? param : scene.getMeshByName(param);
  866. if (value._meshId) {
  867. value.mesh = scene.getMeshByID(value._meshId);
  868. }
  869. triggerParams = { trigger: ActionManager[trigger.name], parameter: value };
  870. }
  871. else
  872. triggerParams = ActionManager[trigger.name];
  873. for (var j = 0; j < trigger.children.length; j++) {
  874. if (!trigger.detached)
  875. traverse(trigger.children[j], triggerParams, null, null);
  876. }
  877. }
  878. };
  879. ActionManager.GetTriggerName = function (trigger) {
  880. switch (trigger) {
  881. case 0: return "NothingTrigger";
  882. case 1: return "OnPickTrigger";
  883. case 2: return "OnLeftPickTrigger";
  884. case 3: return "OnRightPickTrigger";
  885. case 4: return "OnCenterPickTrigger";
  886. case 5: return "OnPickDownTrigger";
  887. case 6: return "OnPickUpTrigger";
  888. case 7: return "OnLongPressTrigger";
  889. case 8: return "OnPointerOverTrigger";
  890. case 9: return "OnPointerOutTrigger";
  891. case 10: return "OnEveryFrameTrigger";
  892. case 11: return "OnIntersectionEnterTrigger";
  893. case 12: return "OnIntersectionExitTrigger";
  894. case 13: return "OnKeyDownTrigger";
  895. case 14: return "OnKeyUpTrigger";
  896. case 15: return "OnPickOutTrigger";
  897. default: return "";
  898. }
  899. };
  900. // Statics
  901. ActionManager._NothingTrigger = 0;
  902. ActionManager._OnPickTrigger = 1;
  903. ActionManager._OnLeftPickTrigger = 2;
  904. ActionManager._OnRightPickTrigger = 3;
  905. ActionManager._OnCenterPickTrigger = 4;
  906. ActionManager._OnPickDownTrigger = 5;
  907. ActionManager._OnDoublePickTrigger = 6;
  908. ActionManager._OnPickUpTrigger = 7;
  909. ActionManager._OnLongPressTrigger = 8;
  910. ActionManager._OnPointerOverTrigger = 9;
  911. ActionManager._OnPointerOutTrigger = 10;
  912. ActionManager._OnEveryFrameTrigger = 11;
  913. ActionManager._OnIntersectionEnterTrigger = 12;
  914. ActionManager._OnIntersectionExitTrigger = 13;
  915. ActionManager._OnKeyDownTrigger = 14;
  916. ActionManager._OnKeyUpTrigger = 15;
  917. ActionManager._OnPickOutTrigger = 16;
  918. ActionManager.Triggers = {};
  919. return ActionManager;
  920. }());
  921. BABYLON.ActionManager = ActionManager;
  922. })(BABYLON || (BABYLON = {}));
  923. //# sourceMappingURL=babylon.actionManager.js.map
  924. var BABYLON;
  925. (function (BABYLON) {
  926. var InterpolateValueAction = /** @class */ (function (_super) {
  927. __extends(InterpolateValueAction, _super);
  928. function InterpolateValueAction(triggerOptions, target, propertyPath, value, duration, condition, stopOtherAnimations, onInterpolationDone) {
  929. if (duration === void 0) { duration = 1000; }
  930. var _this = _super.call(this, triggerOptions, condition) || this;
  931. _this.propertyPath = propertyPath;
  932. _this.value = value;
  933. _this.duration = duration;
  934. _this.stopOtherAnimations = stopOtherAnimations;
  935. _this.onInterpolationDone = onInterpolationDone;
  936. _this.onInterpolationDoneObservable = new BABYLON.Observable();
  937. _this._target = _this._effectiveTarget = target;
  938. return _this;
  939. }
  940. InterpolateValueAction.prototype._prepare = function () {
  941. this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);
  942. this._property = this._getProperty(this.propertyPath);
  943. };
  944. InterpolateValueAction.prototype.execute = function () {
  945. var _this = this;
  946. var scene = this._actionManager.getScene();
  947. var keys = [
  948. {
  949. frame: 0,
  950. value: this._effectiveTarget[this._property]
  951. }, {
  952. frame: 100,
  953. value: this.value
  954. }
  955. ];
  956. var dataType;
  957. if (typeof this.value === "number") {
  958. dataType = BABYLON.Animation.ANIMATIONTYPE_FLOAT;
  959. }
  960. else if (this.value instanceof BABYLON.Color3) {
  961. dataType = BABYLON.Animation.ANIMATIONTYPE_COLOR3;
  962. }
  963. else if (this.value instanceof BABYLON.Vector3) {
  964. dataType = BABYLON.Animation.ANIMATIONTYPE_VECTOR3;
  965. }
  966. else if (this.value instanceof BABYLON.Matrix) {
  967. dataType = BABYLON.Animation.ANIMATIONTYPE_MATRIX;
  968. }
  969. else if (this.value instanceof BABYLON.Quaternion) {
  970. dataType = BABYLON.Animation.ANIMATIONTYPE_QUATERNION;
  971. }
  972. else {
  973. BABYLON.Tools.Warn("InterpolateValueAction: Unsupported type (" + typeof this.value + ")");
  974. return;
  975. }
  976. var animation = new BABYLON.Animation("InterpolateValueAction", this._property, 100 * (1000.0 / this.duration), dataType, BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT);
  977. animation.setKeys(keys);
  978. if (this.stopOtherAnimations) {
  979. scene.stopAnimation(this._effectiveTarget);
  980. }
  981. var wrapper = function () {
  982. _this.onInterpolationDoneObservable.notifyObservers(_this);
  983. if (_this.onInterpolationDone) {
  984. _this.onInterpolationDone();
  985. }
  986. };
  987. scene.beginDirectAnimation(this._effectiveTarget, [animation], 0, 100, false, 1, wrapper);
  988. };
  989. InterpolateValueAction.prototype.serialize = function (parent) {
  990. return _super.prototype._serialize.call(this, {
  991. name: "InterpolateValueAction",
  992. properties: [
  993. BABYLON.Action._GetTargetProperty(this._target),
  994. { name: "propertyPath", value: this.propertyPath },
  995. { name: "value", value: BABYLON.Action._SerializeValueAsString(this.value) },
  996. { name: "duration", value: BABYLON.Action._SerializeValueAsString(this.duration) },
  997. { name: "stopOtherAnimations", value: BABYLON.Action._SerializeValueAsString(this.stopOtherAnimations) || false }
  998. ]
  999. }, parent);
  1000. };
  1001. return InterpolateValueAction;
  1002. }(BABYLON.Action));
  1003. BABYLON.InterpolateValueAction = InterpolateValueAction;
  1004. })(BABYLON || (BABYLON = {}));
  1005. //# sourceMappingURL=babylon.interpolateValueAction.js.map
  1006. var BABYLON;
  1007. (function (BABYLON) {
  1008. var SwitchBooleanAction = /** @class */ (function (_super) {
  1009. __extends(SwitchBooleanAction, _super);
  1010. function SwitchBooleanAction(triggerOptions, target, propertyPath, condition) {
  1011. var _this = _super.call(this, triggerOptions, condition) || this;
  1012. _this.propertyPath = propertyPath;
  1013. _this._target = _this._effectiveTarget = target;
  1014. return _this;
  1015. }
  1016. SwitchBooleanAction.prototype._prepare = function () {
  1017. this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);
  1018. this._property = this._getProperty(this.propertyPath);
  1019. };
  1020. SwitchBooleanAction.prototype.execute = function () {
  1021. this._effectiveTarget[this._property] = !this._effectiveTarget[this._property];
  1022. };
  1023. SwitchBooleanAction.prototype.serialize = function (parent) {
  1024. return _super.prototype._serialize.call(this, {
  1025. name: "SwitchBooleanAction",
  1026. properties: [
  1027. BABYLON.Action._GetTargetProperty(this._target),
  1028. { name: "propertyPath", value: this.propertyPath }
  1029. ]
  1030. }, parent);
  1031. };
  1032. return SwitchBooleanAction;
  1033. }(BABYLON.Action));
  1034. BABYLON.SwitchBooleanAction = SwitchBooleanAction;
  1035. var SetStateAction = /** @class */ (function (_super) {
  1036. __extends(SetStateAction, _super);
  1037. function SetStateAction(triggerOptions, target, value, condition) {
  1038. var _this = _super.call(this, triggerOptions, condition) || this;
  1039. _this.value = value;
  1040. _this._target = target;
  1041. return _this;
  1042. }
  1043. SetStateAction.prototype.execute = function () {
  1044. this._target.state = this.value;
  1045. };
  1046. SetStateAction.prototype.serialize = function (parent) {
  1047. return _super.prototype._serialize.call(this, {
  1048. name: "SetStateAction",
  1049. properties: [
  1050. BABYLON.Action._GetTargetProperty(this._target),
  1051. { name: "value", value: this.value }
  1052. ]
  1053. }, parent);
  1054. };
  1055. return SetStateAction;
  1056. }(BABYLON.Action));
  1057. BABYLON.SetStateAction = SetStateAction;
  1058. var SetValueAction = /** @class */ (function (_super) {
  1059. __extends(SetValueAction, _super);
  1060. function SetValueAction(triggerOptions, target, propertyPath, value, condition) {
  1061. var _this = _super.call(this, triggerOptions, condition) || this;
  1062. _this.propertyPath = propertyPath;
  1063. _this.value = value;
  1064. _this._target = _this._effectiveTarget = target;
  1065. return _this;
  1066. }
  1067. SetValueAction.prototype._prepare = function () {
  1068. this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);
  1069. this._property = this._getProperty(this.propertyPath);
  1070. };
  1071. SetValueAction.prototype.execute = function () {
  1072. this._effectiveTarget[this._property] = this.value;
  1073. if (this._target.markAsDirty) {
  1074. this._target.markAsDirty(this._property);
  1075. }
  1076. };
  1077. SetValueAction.prototype.serialize = function (parent) {
  1078. return _super.prototype._serialize.call(this, {
  1079. name: "SetValueAction",
  1080. properties: [
  1081. BABYLON.Action._GetTargetProperty(this._target),
  1082. { name: "propertyPath", value: this.propertyPath },
  1083. { name: "value", value: BABYLON.Action._SerializeValueAsString(this.value) }
  1084. ]
  1085. }, parent);
  1086. };
  1087. return SetValueAction;
  1088. }(BABYLON.Action));
  1089. BABYLON.SetValueAction = SetValueAction;
  1090. var IncrementValueAction = /** @class */ (function (_super) {
  1091. __extends(IncrementValueAction, _super);
  1092. function IncrementValueAction(triggerOptions, target, propertyPath, value, condition) {
  1093. var _this = _super.call(this, triggerOptions, condition) || this;
  1094. _this.propertyPath = propertyPath;
  1095. _this.value = value;
  1096. _this._target = _this._effectiveTarget = target;
  1097. return _this;
  1098. }
  1099. IncrementValueAction.prototype._prepare = function () {
  1100. this._effectiveTarget = this._getEffectiveTarget(this._effectiveTarget, this.propertyPath);
  1101. this._property = this._getProperty(this.propertyPath);
  1102. if (typeof this._effectiveTarget[this._property] !== "number") {
  1103. BABYLON.Tools.Warn("Warning: IncrementValueAction can only be used with number values");
  1104. }
  1105. };
  1106. IncrementValueAction.prototype.execute = function () {
  1107. this._effectiveTarget[this._property] += this.value;
  1108. if (this._target.markAsDirty) {
  1109. this._target.markAsDirty(this._property);
  1110. }
  1111. };
  1112. IncrementValueAction.prototype.serialize = function (parent) {
  1113. return _super.prototype._serialize.call(this, {
  1114. name: "IncrementValueAction",
  1115. properties: [
  1116. BABYLON.Action._GetTargetProperty(this._target),
  1117. { name: "propertyPath", value: this.propertyPath },
  1118. { name: "value", value: BABYLON.Action._SerializeValueAsString(this.value) }
  1119. ]
  1120. }, parent);
  1121. };
  1122. return IncrementValueAction;
  1123. }(BABYLON.Action));
  1124. BABYLON.IncrementValueAction = IncrementValueAction;
  1125. var PlayAnimationAction = /** @class */ (function (_super) {
  1126. __extends(PlayAnimationAction, _super);
  1127. function PlayAnimationAction(triggerOptions, target, from, to, loop, condition) {
  1128. var _this = _super.call(this, triggerOptions, condition) || this;
  1129. _this.from = from;
  1130. _this.to = to;
  1131. _this.loop = loop;
  1132. _this._target = target;
  1133. return _this;
  1134. }
  1135. PlayAnimationAction.prototype._prepare = function () {
  1136. };
  1137. PlayAnimationAction.prototype.execute = function () {
  1138. var scene = this._actionManager.getScene();
  1139. scene.beginAnimation(this._target, this.from, this.to, this.loop);
  1140. };
  1141. PlayAnimationAction.prototype.serialize = function (parent) {
  1142. return _super.prototype._serialize.call(this, {
  1143. name: "PlayAnimationAction",
  1144. properties: [
  1145. BABYLON.Action._GetTargetProperty(this._target),
  1146. { name: "from", value: String(this.from) },
  1147. { name: "to", value: String(this.to) },
  1148. { name: "loop", value: BABYLON.Action._SerializeValueAsString(this.loop) || false }
  1149. ]
  1150. }, parent);
  1151. };
  1152. return PlayAnimationAction;
  1153. }(BABYLON.Action));
  1154. BABYLON.PlayAnimationAction = PlayAnimationAction;
  1155. var StopAnimationAction = /** @class */ (function (_super) {
  1156. __extends(StopAnimationAction, _super);
  1157. function StopAnimationAction(triggerOptions, target, condition) {
  1158. var _this = _super.call(this, triggerOptions, condition) || this;
  1159. _this._target = target;
  1160. return _this;
  1161. }
  1162. StopAnimationAction.prototype._prepare = function () {
  1163. };
  1164. StopAnimationAction.prototype.execute = function () {
  1165. var scene = this._actionManager.getScene();
  1166. scene.stopAnimation(this._target);
  1167. };
  1168. StopAnimationAction.prototype.serialize = function (parent) {
  1169. return _super.prototype._serialize.call(this, {
  1170. name: "StopAnimationAction",
  1171. properties: [BABYLON.Action._GetTargetProperty(this._target)]
  1172. }, parent);
  1173. };
  1174. return StopAnimationAction;
  1175. }(BABYLON.Action));
  1176. BABYLON.StopAnimationAction = StopAnimationAction;
  1177. var DoNothingAction = /** @class */ (function (_super) {
  1178. __extends(DoNothingAction, _super);
  1179. function DoNothingAction(triggerOptions, condition) {
  1180. if (triggerOptions === void 0) { triggerOptions = BABYLON.ActionManager.NothingTrigger; }
  1181. return _super.call(this, triggerOptions, condition) || this;
  1182. }
  1183. DoNothingAction.prototype.execute = function () {
  1184. };
  1185. DoNothingAction.prototype.serialize = function (parent) {
  1186. return _super.prototype._serialize.call(this, {
  1187. name: "DoNothingAction",
  1188. properties: []
  1189. }, parent);
  1190. };
  1191. return DoNothingAction;
  1192. }(BABYLON.Action));
  1193. BABYLON.DoNothingAction = DoNothingAction;
  1194. var CombineAction = /** @class */ (function (_super) {
  1195. __extends(CombineAction, _super);
  1196. function CombineAction(triggerOptions, children, condition) {
  1197. var _this = _super.call(this, triggerOptions, condition) || this;
  1198. _this.children = children;
  1199. return _this;
  1200. }
  1201. CombineAction.prototype._prepare = function () {
  1202. for (var index = 0; index < this.children.length; index++) {
  1203. this.children[index]._actionManager = this._actionManager;
  1204. this.children[index]._prepare();
  1205. }
  1206. };
  1207. CombineAction.prototype.execute = function (evt) {
  1208. for (var index = 0; index < this.children.length; index++) {
  1209. this.children[index].execute(evt);
  1210. }
  1211. };
  1212. CombineAction.prototype.serialize = function (parent) {
  1213. var serializationObject = _super.prototype._serialize.call(this, {
  1214. name: "CombineAction",
  1215. properties: [],
  1216. combine: []
  1217. }, parent);
  1218. for (var i = 0; i < this.children.length; i++) {
  1219. serializationObject.combine.push(this.children[i].serialize(null));
  1220. }
  1221. return serializationObject;
  1222. };
  1223. return CombineAction;
  1224. }(BABYLON.Action));
  1225. BABYLON.CombineAction = CombineAction;
  1226. var ExecuteCodeAction = /** @class */ (function (_super) {
  1227. __extends(ExecuteCodeAction, _super);
  1228. function ExecuteCodeAction(triggerOptions, func, condition) {
  1229. var _this = _super.call(this, triggerOptions, condition) || this;
  1230. _this.func = func;
  1231. return _this;
  1232. }
  1233. ExecuteCodeAction.prototype.execute = function (evt) {
  1234. this.func(evt);
  1235. };
  1236. return ExecuteCodeAction;
  1237. }(BABYLON.Action));
  1238. BABYLON.ExecuteCodeAction = ExecuteCodeAction;
  1239. var SetParentAction = /** @class */ (function (_super) {
  1240. __extends(SetParentAction, _super);
  1241. function SetParentAction(triggerOptions, target, parent, condition) {
  1242. var _this = _super.call(this, triggerOptions, condition) || this;
  1243. _this._target = target;
  1244. _this._parent = parent;
  1245. return _this;
  1246. }
  1247. SetParentAction.prototype._prepare = function () {
  1248. };
  1249. SetParentAction.prototype.execute = function () {
  1250. if (this._target.parent === this._parent) {
  1251. return;
  1252. }
  1253. var invertParentWorldMatrix = this._parent.getWorldMatrix().clone();
  1254. invertParentWorldMatrix.invert();
  1255. this._target.position = BABYLON.Vector3.TransformCoordinates(this._target.position, invertParentWorldMatrix);
  1256. this._target.parent = this._parent;
  1257. };
  1258. SetParentAction.prototype.serialize = function (parent) {
  1259. return _super.prototype._serialize.call(this, {
  1260. name: "SetParentAction",
  1261. properties: [
  1262. BABYLON.Action._GetTargetProperty(this._target),
  1263. BABYLON.Action._GetTargetProperty(this._parent),
  1264. ]
  1265. }, parent);
  1266. };
  1267. return SetParentAction;
  1268. }(BABYLON.Action));
  1269. BABYLON.SetParentAction = SetParentAction;
  1270. var PlaySoundAction = /** @class */ (function (_super) {
  1271. __extends(PlaySoundAction, _super);
  1272. function PlaySoundAction(triggerOptions, sound, condition) {
  1273. var _this = _super.call(this, triggerOptions, condition) || this;
  1274. _this._sound = sound;
  1275. return _this;
  1276. }
  1277. PlaySoundAction.prototype._prepare = function () {
  1278. };
  1279. PlaySoundAction.prototype.execute = function () {
  1280. if (this._sound !== undefined)
  1281. this._sound.play();
  1282. };
  1283. PlaySoundAction.prototype.serialize = function (parent) {
  1284. return _super.prototype._serialize.call(this, {
  1285. name: "PlaySoundAction",
  1286. properties: [{ name: "sound", value: this._sound.name }]
  1287. }, parent);
  1288. };
  1289. return PlaySoundAction;
  1290. }(BABYLON.Action));
  1291. BABYLON.PlaySoundAction = PlaySoundAction;
  1292. var StopSoundAction = /** @class */ (function (_super) {
  1293. __extends(StopSoundAction, _super);
  1294. function StopSoundAction(triggerOptions, sound, condition) {
  1295. var _this = _super.call(this, triggerOptions, condition) || this;
  1296. _this._sound = sound;
  1297. return _this;
  1298. }
  1299. StopSoundAction.prototype._prepare = function () {
  1300. };
  1301. StopSoundAction.prototype.execute = function () {
  1302. if (this._sound !== undefined)
  1303. this._sound.stop();
  1304. };
  1305. StopSoundAction.prototype.serialize = function (parent) {
  1306. return _super.prototype._serialize.call(this, {
  1307. name: "StopSoundAction",
  1308. properties: [{ name: "sound", value: this._sound.name }]
  1309. }, parent);
  1310. };
  1311. return StopSoundAction;
  1312. }(BABYLON.Action));
  1313. BABYLON.StopSoundAction = StopSoundAction;
  1314. })(BABYLON || (BABYLON = {}));
  1315. //# sourceMappingURL=babylon.directActions.js.map
  1316. BABYLON.Effect.IncludesShadersStore['depthPrePass'] = "#ifdef DEPTHPREPASS\ngl_FragColor=vec4(0.,0.,0.,1.0);\nreturn;\n#endif";
  1317. BABYLON.Effect.IncludesShadersStore['bonesDeclaration'] = "#if NUM_BONE_INFLUENCERS>0\nuniform mat4 mBones[BonesPerMesh];\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#endif";
  1318. BABYLON.Effect.IncludesShadersStore['instancesDeclaration'] = "#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#else\nuniform mat4 world;\n#endif";
  1319. BABYLON.Effect.IncludesShadersStore['pointCloudVertexDeclaration'] = "#ifdef POINTSIZE\nuniform float pointSize;\n#endif";
  1320. BABYLON.Effect.IncludesShadersStore['bumpVertexDeclaration'] = "#if defined(BUMP) || defined(PARALLAX)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#endif\n";
  1321. BABYLON.Effect.IncludesShadersStore['clipPlaneVertexDeclaration'] = "#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif";
  1322. BABYLON.Effect.IncludesShadersStore['fogVertexDeclaration'] = "#ifdef FOG\nvarying vec3 vFogDistance;\n#endif";
  1323. BABYLON.Effect.IncludesShadersStore['morphTargetsVertexGlobalDeclaration'] = "#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif";
  1324. BABYLON.Effect.IncludesShadersStore['morphTargetsVertexDeclaration'] = "#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#endif";
  1325. BABYLON.Effect.IncludesShadersStore['logDepthDeclaration'] = "#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif";
  1326. BABYLON.Effect.IncludesShadersStore['morphTargetsVertex'] = "#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#endif";
  1327. BABYLON.Effect.IncludesShadersStore['instancesVertex'] = "#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#else\nmat4 finalWorld=world;\n#endif";
  1328. BABYLON.Effect.IncludesShadersStore['bonesVertex'] = "#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\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 \nfinalWorld=finalWorld*influence;\n#endif";
  1329. BABYLON.Effect.IncludesShadersStore['bumpVertex'] = "#if defined(BUMP) || defined(PARALLAX)\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";
  1330. BABYLON.Effect.IncludesShadersStore['clipPlaneVertex'] = "#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif";
  1331. BABYLON.Effect.IncludesShadersStore['fogVertex'] = "#ifdef FOG\nvFogDistance=(view*worldPos).xyz;\n#endif";
  1332. BABYLON.Effect.IncludesShadersStore['shadowsVertex'] = "#ifdef SHADOWS\n#if defined(SHADOW{X}) && !defined(SHADOWCUBE{X})\nvPositionFromLight{X}=lightMatrix{X}*worldPos;\nvDepthMetric{X}=((vPositionFromLight{X}.z+light{X}.depthValues.x)/(light{X}.depthValues.y));\n#endif\n#endif";
  1333. BABYLON.Effect.IncludesShadersStore['pointCloudVertex'] = "#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif";
  1334. BABYLON.Effect.IncludesShadersStore['logDepthVertex'] = "#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+gl_Position.w;\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif";
  1335. BABYLON.Effect.IncludesShadersStore['helperFunctions'] = "const float PI=3.1415926535897932384626433832795;\nconst float LinearEncodePowerApprox=2.2;\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\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 computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\n{\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.0,clamp(dot(clipSpace,clipSpace),0.,1.));\nreturn mix(value,1.0,mask);\n}\nvec3 applyEaseInOut(vec3 x){\nreturn x*x*(3.0-2.0*x);\n}\nvec3 toLinearSpace(vec3 color)\n{\nreturn pow(color,vec3(LinearEncodePowerApprox));\n}\nvec3 toGammaSpace(vec3 color)\n{\nreturn pow(color,vec3(GammaEncodePowerApprox));\n}\nfloat square(float value)\n{\nreturn value*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}\nvec3 dither(vec2 seed,vec3 color) {\nfloat rand=getRand(seed);\ncolor+=mix(-0.5/255.0,0.5/255.0,rand);\ncolor=max(color,0.0);\nreturn color;\n}";
  1336. BABYLON.Effect.IncludesShadersStore['lightFragmentDeclaration'] = "#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec3 vLightSpecular{X};\n#else\nvec3 vLightSpecular{X}=vec3(0.);\n#endif\n#ifdef SHADOW{X}\n#if defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\nuniform sampler2D shadowSampler{X};\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\n#endif\n#ifdef HEMILIGHT{X}\nuniform vec3 vLightGround{X};\n#endif\n#endif";
  1337. BABYLON.Effect.IncludesShadersStore['lightsFragmentFunctions'] = "\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";
  1338. BABYLON.Effect.IncludesShadersStore['lightUboDeclaration'] = "#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec3 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\n#endif\n#ifdef HEMILIGHT{X}\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef SHADOW{X}\n#if defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\nuniform sampler2D shadowSampler{X};\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif";
  1339. BABYLON.Effect.IncludesShadersStore['defaultVertexDeclaration'] = "\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 POINTSIZE\nuniform float pointSize;\n#endif\n";
  1340. BABYLON.Effect.IncludesShadersStore['defaultFragmentDeclaration'] = "uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\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#ifdef REFLECTIONMAP_SKYBOX\n#else\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION)\nuniform mat4 reflectionMatrix;\n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif";
  1341. BABYLON.Effect.IncludesShadersStore['defaultUboDeclaration'] = "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;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec2 vSpecularInfos;\nvec3 vBumpInfos;\nmat4 diffuseMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 reflectionMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 specularMatrix;\nmat4 bumpMatrix; \nvec4 vTangentSpaceParams;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nvec4 vDiffuseColor;\nfloat pointSize; \n};\nuniform Scene {\nmat4 viewProjection;\nmat4 view;\n};";
  1342. BABYLON.Effect.IncludesShadersStore['shadowsFragmentFunctions'] = "#ifdef SHADOWS\n#ifndef SHADOWFLOAT\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 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\nif (depth>shadow)\n{\nreturn darkness;\n}\nreturn 1.0;\n}\nfloat computeShadowWithPCFCube(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))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<depth) visibility-=0.25;\n#else\nif (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<depth) visibility-=0.25;\n#endif\nreturn min(1.0,visibility+darkness);\n}\nfloat computeShadowWithESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadowMapSample=textureCube(shadowSampler,directionToLight).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness); \nreturn esm;\n}\nfloat computeShadowWithCloseESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadowMapSample=textureCube(shadowSampler,directionToLight).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn esm;\n}\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}\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\nif (shadowPixelDepth>shadow)\n{\nreturn computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff);\n}\nreturn 1.;\n}\nfloat computeShadowWithPCF(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}\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))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[1]*mapSize))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[2]*mapSize))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[3]*mapSize))<shadowPixelDepth) visibility-=0.25;\n#else\nif (texture2D(shadowSampler,uv+poissonDisk[0]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[1]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[2]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[3]*mapSize).x<shadowPixelDepth) visibility-=0.25;\n#endif\nreturn computeFallOff(min(1.0,visibility+darkness),clipSpace.xy,frustumEdgeFalloff);\n}\nfloat computeShadowWithESM(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}\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}\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}\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#endif\n";
  1343. BABYLON.Effect.IncludesShadersStore['fresnelFunction'] = "#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";
  1344. BABYLON.Effect.IncludesShadersStore['reflectionFunction'] = "vec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\n{\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvec3 direction=normalize(vDirectionW);\nfloat t=clamp(direction.y*-0.5+0.5,0.,1.0);\nfloat s=atan(direction.z,direction.x)*RECIPROCAL_PI2+0.5;\n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\nreturn vec3(1.0-s,t,0);\n#else\nreturn vec3(s,t,0);\n#endif\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\nvec3 cameraToVertex=normalize(worldPos.xyz-vEyePosition.xyz);\nvec3 r=reflect(cameraToVertex,worldNormal);\nfloat t=clamp(r.y*-0.5+0.5,0.,1.0);\nfloat s=atan(r.z,r.x)*RECIPROCAL_PI2+0.5;\nreturn vec3(s,t,0);\n#endif\n#ifdef REFLECTIONMAP_SPHERICAL\nvec3 viewDir=normalize(vec3(view*worldPos));\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\nvec3 r=reflect(viewDir,viewNormal);\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#endif\n#ifdef REFLECTIONMAP_PLANAR\nvec3 viewDir=worldPos.xyz-vEyePosition.xyz;\nvec3 coords=normalize(reflect(viewDir,worldNormal));\nreturn vec3(reflectionMatrix*vec4(coords,1));\n#endif\n#ifdef REFLECTIONMAP_CUBIC\nvec3 viewDir=worldPos.xyz-vEyePosition.xyz;\nvec3 coords=reflect(viewDir,worldNormal);\n#ifdef INVERTCUBICMAP\ncoords.y=1.0-coords.y;\n#endif\nreturn vec3(reflectionMatrix*vec4(coords,0));\n#endif\n#ifdef REFLECTIONMAP_PROJECTION\nreturn vec3(reflectionMatrix*(view*worldPos));\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nreturn vPositionUVW;\n#endif\n#ifdef REFLECTIONMAP_EXPLICIT\nreturn vec3(0,0,0);\n#endif\n}";
  1345. BABYLON.Effect.IncludesShadersStore['imageProcessingDeclaration'] = "#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";
  1346. BABYLON.Effect.IncludesShadersStore['imageProcessingFunctions'] = "#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n\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=clamp(sliceUV,0.,1.);\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\nsliceUV.x+=sliceSize;\nsliceUV=clamp(sliceUV,0.,1.);\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\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\nconst float tonemappingCalibration=1.590579;\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\n#endif\n\nresult.rgb=toGammaSpace(result.rgb);\nresult.rgb=clamp(result.rgb,0.0,1.0);\n#ifdef CONTRAST\n\nvec3 resultHighContrast=applyEaseInOut(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}";
  1347. BABYLON.Effect.IncludesShadersStore['bumpFragmentFunctions'] = "#ifdef 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;\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\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*=vTangentSpaceParams.x;\nbitangent*=vTangentSpaceParams.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\n}\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv)\n{\nvec3 map=texture2D(bumpSampler,uv).xyz;\nmap=map*2.0-1.0;\n#ifdef NORMALXYSCALE\nmap=normalize(map*vec3(vBumpInfos.y,vBumpInfos.y,1.0));\n#endif\nreturn normalize(cotangentFrame*map);\n}\n#ifdef 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; i<iMaxSamples; i++)\n{\ncurrSampledHeight=texture2D(bumpSampler,vBumpUV+vCurrOffset).w;\n\nif (currSampledHeight>currRayHeight)\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\n#endif";
  1348. BABYLON.Effect.IncludesShadersStore['clipPlaneFragmentDeclaration'] = "#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif";
  1349. BABYLON.Effect.IncludesShadersStore['fogFragmentDeclaration'] = "#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";
  1350. BABYLON.Effect.IncludesShadersStore['clipPlaneFragment'] = "#ifdef CLIPPLANE\nif (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif";
  1351. BABYLON.Effect.IncludesShadersStore['bumpFragment'] = "vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#else \nfloat normalScale=vBumpInfos.y;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vBumpUV);\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 BUMP\nnormalW=perturbNormal(TBN,vBumpUV+uvOffset);\n#endif";
  1352. BABYLON.Effect.IncludesShadersStore['lightFragment'] = "#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || (defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X}))\n\n#else\n#ifdef PBR\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,roughness,NdotV,specularEnvironmentR0,specularEnvironmentR90,NdotL);\n#endif\n#ifdef HEMILIGHT{X}\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightGround,roughness,NdotV,specularEnvironmentR0,specularEnvironmentR90,NdotL);\n#endif\n#if defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,roughness,NdotV,specularEnvironmentR0,specularEnvironmentR90,NdotL);\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,light{X}.vLightDiffuse.a,glossiness);\n#endif\n#ifdef HEMILIGHT{X}\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightGround,glossiness);\n#endif\n#if defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,glossiness);\n#endif\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef 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#else\n#ifdef 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#else \n#ifdef SHADOWPCF{X}\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPCFCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPCF(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,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#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*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor;\n#endif\n#endif\n#else\ndiffuseBase+=info.diffuse*shadow;\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#endif\n#endif\n#endif";
  1353. BABYLON.Effect.IncludesShadersStore['logDepthFragment'] = "#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif";
  1354. BABYLON.Effect.IncludesShadersStore['fogFragment'] = "#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif";
  1355. (function() {
  1356. var EXPORTS = {};EXPORTS['Condition'] = BABYLON['Condition'];EXPORTS['ValueCondition'] = BABYLON['ValueCondition'];EXPORTS['PredicateCondition'] = BABYLON['PredicateCondition'];EXPORTS['StateCondition'] = BABYLON['StateCondition'];EXPORTS['Action'] = BABYLON['Action'];EXPORTS['ActionEvent'] = BABYLON['ActionEvent'];EXPORTS['ActionManager'] = BABYLON['ActionManager'];EXPORTS['InterpolateValueAction'] = BABYLON['InterpolateValueAction'];EXPORTS['SwitchBooleanAction'] = BABYLON['SwitchBooleanAction'];EXPORTS['SetStateAction'] = BABYLON['SetStateAction'];EXPORTS['SetValueAction'] = BABYLON['SetValueAction'];EXPORTS['IncrementValueAction'] = BABYLON['IncrementValueAction'];EXPORTS['PlayAnimationAction'] = BABYLON['PlayAnimationAction'];EXPORTS['StopAnimationAction'] = BABYLON['StopAnimationAction'];EXPORTS['DoNothingAction'] = BABYLON['DoNothingAction'];EXPORTS['CombineAction'] = BABYLON['CombineAction'];EXPORTS['ExecuteCodeAction'] = BABYLON['ExecuteCodeAction'];EXPORTS['SetParentAction'] = BABYLON['SetParentAction'];EXPORTS['PlaySoundAction'] = BABYLON['PlaySoundAction'];EXPORTS['StopSoundAction'] = BABYLON['StopSoundAction'];
  1357. globalObject["BABYLON"] = globalObject["BABYLON"] || BABYLON;
  1358. module.exports = EXPORTS;
  1359. })();
  1360. }