es6.js 105 KB

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