babylon.gradientMaterial.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("babylonjs"));
  4. else if(typeof define === 'function' && define.amd)
  5. define("babylonjs-materials", ["babylonjs"], factory);
  6. else if(typeof exports === 'object')
  7. exports["babylonjs-materials"] = factory(require("babylonjs"));
  8. else
  9. root["MATLIB"] = factory(root["BABYLON"]);
  10. })(window, function(__WEBPACK_EXTERNAL_MODULE_babylonjs__) {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./legacy-gradient.ts");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "../../Tools/Gulp/node_modules/webpack/buildin/global.js":
  99. /*!***********************************!*\
  100. !*** (webpack)/buildin/global.js ***!
  101. \***********************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports) {
  104. var g;
  105. // This works in non-strict mode
  106. g = (function() {
  107. return this;
  108. })();
  109. try {
  110. // This works if eval is allowed (see CSP)
  111. g = g || Function("return this")() || (1, eval)("this");
  112. } catch (e) {
  113. // This works if the window reference is available
  114. if (typeof window === "object") g = window;
  115. }
  116. // g can still be undefined, but nothing to do about it...
  117. // We return undefined, instead of nothing here, so it's
  118. // easier to handle this case. if(!global) { ...}
  119. module.exports = g;
  120. /***/ }),
  121. /***/ "../src/gradient/gradient.fragment.fx":
  122. /*!********************************************!*\
  123. !*** ../src/gradient/gradient.fragment.fx ***!
  124. \********************************************/
  125. /*! no static exports found */
  126. /***/ (function(module, exports) {
  127. module.exports = "precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nuniform vec4 topColor;\nuniform vec4 bottomColor;\nuniform float offset;\nuniform float scale;\nuniform float smoothness;\n\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<helperFunctions>\n\n#include<__decl__lightFragment>[0]\n#include<__decl__lightFragment>[1]\n#include<__decl__lightFragment>[2]\n#include<__decl__lightFragment>[3]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n\n#include<fogFragmentDeclaration>\nvoid main(void) {\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\nfloat h=vPosition.y*scale+offset;\nfloat mysmoothness=clamp(smoothness,0.01,max(smoothness,10.));\nvec4 baseColor=mix(bottomColor,topColor,max(pow(max(h,0.0),mysmoothness),0.0));\n\nvec3 diffuseColor=baseColor.rgb;\n\nfloat alpha=baseColor.a;\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#include<lightFragment>[0]\n#include<lightFragment>[1]\n#include<lightFragment>[2]\n#include<lightFragment>[3]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n}\n"
  128. /***/ }),
  129. /***/ "../src/gradient/gradient.vertex.fx":
  130. /*!******************************************!*\
  131. !*** ../src/gradient/gradient.vertex.fx ***!
  132. \******************************************/
  133. /*! no static exports found */
  134. /***/ (function(module, exports) {
  135. module.exports = "precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\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<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\nvarying vec3 vPosition;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include<instancesVertex>\n#include<bonesVertex> \ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\nvPosition=position;\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,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 DIFFUSE\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\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n"
  136. /***/ }),
  137. /***/ "../src/gradient/gradientMaterial.ts":
  138. /*!*******************************************!*\
  139. !*** ../src/gradient/gradientMaterial.ts ***!
  140. \*******************************************/
  141. /*! no static exports found */
  142. /***/ (function(module, exports, __webpack_require__) {
  143. "use strict";
  144. var __extends = (this && this.__extends) || (function () {
  145. var extendStatics = function (d, b) {
  146. extendStatics = Object.setPrototypeOf ||
  147. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  148. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  149. return extendStatics(d, b);
  150. }
  151. return function (d, b) {
  152. extendStatics(d, b);
  153. function __() { this.constructor = d; }
  154. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  155. };
  156. })();
  157. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  158. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  159. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  160. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  161. return c > 3 && r && Object.defineProperty(target, key, r), r;
  162. };
  163. Object.defineProperty(exports, "__esModule", { value: true });
  164. var babylonjs_1 = __webpack_require__(/*! babylonjs */ "babylonjs");
  165. babylonjs_1.Effect.ShadersStore["gradientPixelShader"] = __webpack_require__(/*! ./gradient.fragment.fx */ "../src/gradient/gradient.fragment.fx");
  166. babylonjs_1.Effect.ShadersStore["gradientVertexShader"] = __webpack_require__(/*! ./gradient.vertex.fx */ "../src/gradient/gradient.vertex.fx");
  167. var GradientMaterialDefines = /** @class */ (function (_super) {
  168. __extends(GradientMaterialDefines, _super);
  169. function GradientMaterialDefines() {
  170. var _this = _super.call(this) || this;
  171. _this.DIFFUSE = false;
  172. _this.CLIPPLANE = false;
  173. _this.CLIPPLANE2 = false;
  174. _this.CLIPPLANE3 = false;
  175. _this.CLIPPLANE4 = false;
  176. _this.ALPHATEST = false;
  177. _this.DEPTHPREPASS = false;
  178. _this.POINTSIZE = false;
  179. _this.FOG = false;
  180. _this.LIGHT0 = false;
  181. _this.LIGHT1 = false;
  182. _this.LIGHT2 = false;
  183. _this.LIGHT3 = false;
  184. _this.SPOTLIGHT0 = false;
  185. _this.SPOTLIGHT1 = false;
  186. _this.SPOTLIGHT2 = false;
  187. _this.SPOTLIGHT3 = false;
  188. _this.HEMILIGHT0 = false;
  189. _this.HEMILIGHT1 = false;
  190. _this.HEMILIGHT2 = false;
  191. _this.HEMILIGHT3 = false;
  192. _this.DIRLIGHT0 = false;
  193. _this.DIRLIGHT1 = false;
  194. _this.DIRLIGHT2 = false;
  195. _this.DIRLIGHT3 = false;
  196. _this.POINTLIGHT0 = false;
  197. _this.POINTLIGHT1 = false;
  198. _this.POINTLIGHT2 = false;
  199. _this.POINTLIGHT3 = false;
  200. _this.SHADOW0 = false;
  201. _this.SHADOW1 = false;
  202. _this.SHADOW2 = false;
  203. _this.SHADOW3 = false;
  204. _this.SHADOWS = false;
  205. _this.SHADOWESM0 = false;
  206. _this.SHADOWESM1 = false;
  207. _this.SHADOWESM2 = false;
  208. _this.SHADOWESM3 = false;
  209. _this.SHADOWPOISSON0 = false;
  210. _this.SHADOWPOISSON1 = false;
  211. _this.SHADOWPOISSON2 = false;
  212. _this.SHADOWPOISSON3 = false;
  213. _this.SHADOWPCF0 = false;
  214. _this.SHADOWPCF1 = false;
  215. _this.SHADOWPCF2 = false;
  216. _this.SHADOWPCF3 = false;
  217. _this.SHADOWPCSS0 = false;
  218. _this.SHADOWPCSS1 = false;
  219. _this.SHADOWPCSS2 = false;
  220. _this.SHADOWPCSS3 = false;
  221. _this.NORMAL = false;
  222. _this.UV1 = false;
  223. _this.UV2 = false;
  224. _this.VERTEXCOLOR = false;
  225. _this.VERTEXALPHA = false;
  226. _this.NUM_BONE_INFLUENCERS = 0;
  227. _this.BonesPerMesh = 0;
  228. _this.INSTANCES = false;
  229. _this.rebuild();
  230. return _this;
  231. }
  232. return GradientMaterialDefines;
  233. }(babylonjs_1.MaterialDefines));
  234. var GradientMaterial = /** @class */ (function (_super) {
  235. __extends(GradientMaterial, _super);
  236. function GradientMaterial(name, scene) {
  237. var _this = _super.call(this, name, scene) || this;
  238. _this._maxSimultaneousLights = 4;
  239. // The gradient top color, red by default
  240. _this.topColor = new babylonjs_1.Color3(1, 0, 0);
  241. _this.topColorAlpha = 1.0;
  242. // The gradient top color, blue by default
  243. _this.bottomColor = new babylonjs_1.Color3(0, 0, 1);
  244. _this.bottomColorAlpha = 1.0;
  245. // Gradient offset
  246. _this.offset = 0;
  247. _this.scale = 1.0;
  248. _this.smoothness = 1.0;
  249. _this.disableLighting = false;
  250. _this._scaledDiffuse = new babylonjs_1.Color3();
  251. return _this;
  252. }
  253. GradientMaterial.prototype.needAlphaBlending = function () {
  254. return (this.alpha < 1.0 || this.topColorAlpha < 1.0 || this.bottomColorAlpha < 1.0);
  255. };
  256. GradientMaterial.prototype.needAlphaTesting = function () {
  257. return true;
  258. };
  259. GradientMaterial.prototype.getAlphaTestTexture = function () {
  260. return null;
  261. };
  262. // Methods
  263. GradientMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {
  264. if (this.isFrozen) {
  265. if (this._wasPreviouslyReady && subMesh.effect) {
  266. return true;
  267. }
  268. }
  269. if (!subMesh._materialDefines) {
  270. subMesh._materialDefines = new GradientMaterialDefines();
  271. }
  272. var defines = subMesh._materialDefines;
  273. var scene = this.getScene();
  274. if (!this.checkReadyOnEveryCall && subMesh.effect) {
  275. if (this._renderId === scene.getRenderId()) {
  276. return true;
  277. }
  278. }
  279. var engine = scene.getEngine();
  280. babylonjs_1.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);
  281. babylonjs_1.MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
  282. defines._needNormals = babylonjs_1.MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights);
  283. // Attribs
  284. babylonjs_1.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, false, true);
  285. // Get correct effect
  286. if (defines.isDirty) {
  287. defines.markAsProcessed();
  288. scene.resetCachedMaterial();
  289. // Fallbacks
  290. var fallbacks = new babylonjs_1.EffectFallbacks();
  291. if (defines.FOG) {
  292. fallbacks.addFallback(1, "FOG");
  293. }
  294. babylonjs_1.MaterialHelper.HandleFallbacksForShadows(defines, fallbacks);
  295. if (defines.NUM_BONE_INFLUENCERS > 0) {
  296. fallbacks.addCPUSkinningFallback(0, mesh);
  297. }
  298. //Attributes
  299. var attribs = [babylonjs_1.VertexBuffer.PositionKind];
  300. if (defines.NORMAL) {
  301. attribs.push(babylonjs_1.VertexBuffer.NormalKind);
  302. }
  303. if (defines.UV1) {
  304. attribs.push(babylonjs_1.VertexBuffer.UVKind);
  305. }
  306. if (defines.UV2) {
  307. attribs.push(babylonjs_1.VertexBuffer.UV2Kind);
  308. }
  309. if (defines.VERTEXCOLOR) {
  310. attribs.push(babylonjs_1.VertexBuffer.ColorKind);
  311. }
  312. babylonjs_1.MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
  313. babylonjs_1.MaterialHelper.PrepareAttributesForInstances(attribs, defines);
  314. // Legacy browser patch
  315. var shaderName = "gradient";
  316. var join = defines.toString();
  317. var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vDiffuseColor",
  318. "vFogInfos", "vFogColor", "pointSize",
  319. "vDiffuseInfos",
  320. "mBones",
  321. "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "diffuseMatrix",
  322. "topColor", "bottomColor", "offset", "smoothness", "scale"
  323. ];
  324. var samplers = ["diffuseSampler"];
  325. var uniformBuffers = new Array();
  326. babylonjs_1.MaterialHelper.PrepareUniformsAndSamplersList({
  327. uniformsNames: uniforms,
  328. uniformBuffersNames: uniformBuffers,
  329. samplers: samplers,
  330. defines: defines,
  331. maxSimultaneousLights: 4
  332. });
  333. subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
  334. attributes: attribs,
  335. uniformsNames: uniforms,
  336. uniformBuffersNames: uniformBuffers,
  337. samplers: samplers,
  338. defines: join,
  339. fallbacks: fallbacks,
  340. onCompiled: this.onCompiled,
  341. onError: this.onError,
  342. indexParameters: { maxSimultaneousLights: 4 }
  343. }, engine), defines);
  344. }
  345. if (!subMesh.effect || !subMesh.effect.isReady()) {
  346. return false;
  347. }
  348. this._renderId = scene.getRenderId();
  349. this._wasPreviouslyReady = true;
  350. return true;
  351. };
  352. GradientMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {
  353. var scene = this.getScene();
  354. var defines = subMesh._materialDefines;
  355. if (!defines) {
  356. return;
  357. }
  358. var effect = subMesh.effect;
  359. if (!effect) {
  360. return;
  361. }
  362. this._activeEffect = effect;
  363. // Matrices
  364. this.bindOnlyWorldMatrix(world);
  365. this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
  366. // Bones
  367. babylonjs_1.MaterialHelper.BindBonesParameters(mesh, effect);
  368. if (this._mustRebind(scene, effect)) {
  369. // Clip plane
  370. babylonjs_1.MaterialHelper.BindClipPlane(effect, scene);
  371. // Point size
  372. if (this.pointsCloud) {
  373. this._activeEffect.setFloat("pointSize", this.pointSize);
  374. }
  375. babylonjs_1.MaterialHelper.BindEyePosition(effect, scene);
  376. }
  377. this._activeEffect.setColor4("vDiffuseColor", this._scaledDiffuse, this.alpha * mesh.visibility);
  378. if (scene.lightsEnabled && !this.disableLighting) {
  379. babylonjs_1.MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines);
  380. }
  381. // View
  382. if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== babylonjs_1.Scene.FOGMODE_NONE) {
  383. this._activeEffect.setMatrix("view", scene.getViewMatrix());
  384. }
  385. // Fog
  386. babylonjs_1.MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);
  387. this._activeEffect.setColor4("topColor", this.topColor, this.topColorAlpha);
  388. this._activeEffect.setColor4("bottomColor", this.bottomColor, this.bottomColorAlpha);
  389. this._activeEffect.setFloat("offset", this.offset);
  390. this._activeEffect.setFloat("scale", this.scale);
  391. this._activeEffect.setFloat("smoothness", this.smoothness);
  392. this._afterBind(mesh, this._activeEffect);
  393. };
  394. GradientMaterial.prototype.getAnimatables = function () {
  395. return [];
  396. };
  397. GradientMaterial.prototype.dispose = function (forceDisposeEffect) {
  398. _super.prototype.dispose.call(this, forceDisposeEffect);
  399. };
  400. GradientMaterial.prototype.clone = function (name) {
  401. var _this = this;
  402. return babylonjs_1.SerializationHelper.Clone(function () { return new GradientMaterial(name, _this.getScene()); }, this);
  403. };
  404. GradientMaterial.prototype.serialize = function () {
  405. var serializationObject = babylonjs_1.SerializationHelper.Serialize(this);
  406. serializationObject.customType = "BABYLON.GradientMaterial";
  407. return serializationObject;
  408. };
  409. GradientMaterial.prototype.getClassName = function () {
  410. return "GradientMaterial";
  411. };
  412. // Statics
  413. GradientMaterial.Parse = function (source, scene, rootUrl) {
  414. return babylonjs_1.SerializationHelper.Parse(function () { return new GradientMaterial(source.name, scene); }, source, scene, rootUrl);
  415. };
  416. __decorate([
  417. babylonjs_1.serialize("maxSimultaneousLights")
  418. ], GradientMaterial.prototype, "_maxSimultaneousLights", void 0);
  419. __decorate([
  420. babylonjs_1.expandToProperty("_markAllSubMeshesAsLightsDirty")
  421. ], GradientMaterial.prototype, "maxSimultaneousLights", void 0);
  422. __decorate([
  423. babylonjs_1.serializeAsColor3()
  424. ], GradientMaterial.prototype, "topColor", void 0);
  425. __decorate([
  426. babylonjs_1.serialize()
  427. ], GradientMaterial.prototype, "topColorAlpha", void 0);
  428. __decorate([
  429. babylonjs_1.serializeAsColor3()
  430. ], GradientMaterial.prototype, "bottomColor", void 0);
  431. __decorate([
  432. babylonjs_1.serialize()
  433. ], GradientMaterial.prototype, "bottomColorAlpha", void 0);
  434. __decorate([
  435. babylonjs_1.serialize()
  436. ], GradientMaterial.prototype, "offset", void 0);
  437. __decorate([
  438. babylonjs_1.serialize()
  439. ], GradientMaterial.prototype, "scale", void 0);
  440. __decorate([
  441. babylonjs_1.serialize()
  442. ], GradientMaterial.prototype, "smoothness", void 0);
  443. __decorate([
  444. babylonjs_1.serialize()
  445. ], GradientMaterial.prototype, "disableLighting", void 0);
  446. return GradientMaterial;
  447. }(babylonjs_1.PushMaterial));
  448. exports.GradientMaterial = GradientMaterial;
  449. /***/ }),
  450. /***/ "../src/gradient/index.ts":
  451. /*!********************************!*\
  452. !*** ../src/gradient/index.ts ***!
  453. \********************************/
  454. /*! no static exports found */
  455. /***/ (function(module, exports, __webpack_require__) {
  456. "use strict";
  457. function __export(m) {
  458. for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  459. }
  460. Object.defineProperty(exports, "__esModule", { value: true });
  461. __export(__webpack_require__(/*! ./gradientMaterial */ "../src/gradient/gradientMaterial.ts"));
  462. /***/ }),
  463. /***/ "./legacy-gradient.ts":
  464. /*!****************************!*\
  465. !*** ./legacy-gradient.ts ***!
  466. \****************************/
  467. /*! no static exports found */
  468. /***/ (function(module, exports, __webpack_require__) {
  469. "use strict";
  470. /* WEBPACK VAR INJECTION */(function(global) {
  471. function __export(m) {
  472. for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  473. }
  474. Object.defineProperty(exports, "__esModule", { value: true });
  475. var MatLib = __webpack_require__(/*! ../src/gradient/index */ "../src/gradient/index.ts");
  476. /**
  477. * This is the entry point for the UMD module.
  478. * The entry point for a future ESM package should be index.ts
  479. */
  480. var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
  481. if (typeof globalObject !== "undefined") {
  482. for (var key in MatLib) {
  483. globalObject.BABYLON[key] = MatLib[key];
  484. }
  485. }
  486. __export(__webpack_require__(/*! ../src/gradient/index */ "../src/gradient/index.ts"));
  487. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../Tools/Gulp/node_modules/webpack/buildin/global.js */ "../../Tools/Gulp/node_modules/webpack/buildin/global.js")))
  488. /***/ }),
  489. /***/ "babylonjs":
  490. /*!****************************************************************************************************!*\
  491. !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
  492. \****************************************************************************************************/
  493. /*! no static exports found */
  494. /***/ (function(module, exports) {
  495. module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs__;
  496. /***/ })
  497. /******/ });
  498. });
  499. //# sourceMappingURL=babylon.gradientMaterial.js.map