babylon.cellMaterial.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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-cell.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/cell/cell.fragment.fx":
  122. /*!************************************!*\
  123. !*** ../src/cell/cell.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\nvarying vec3 vPositionW;\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..maxSimultaneousLights]\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>\n\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{\ndiffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;\nif (info.ndl<0.5)\nlevel=0.5;\ndiffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];\nToonThresholds[0]=0.95;\nToonThresholds[1]=0.5;\nToonThresholds[2]=0.2;\nToonThresholds[3]=0.03;\nfloat ToonBrightnessLevels[5];\nToonBrightnessLevels[0]=1.0;\nToonBrightnessLevels[1]=0.8;\nToonBrightnessLevels[2]=0.6;\nToonBrightnessLevels[3]=0.35;\nToonBrightnessLevels[4]=0.2;\nif (info.ndl>ToonThresholds[0])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[0];\n}\nelse if (info.ndl>ToonThresholds[1])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[1];\n}\nelse if (info.ndl>ToonThresholds[2])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[2];\n}\nelse if (info.ndl>ToonThresholds[3])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[3];\n}\nelse\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[4];\n}\n#endif\nreturn max(diffuseBase,vec3(0.2));\n}\nvoid main(void)\n{\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#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\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\nlightingInfo info;\nvec3 diffuseBase=vec3(0.,0.,0.);\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif \n#include<lightFragment>[0..maxSimultaneousLights]\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}"
  128. /***/ }),
  129. /***/ "../src/cell/cell.vertex.fx":
  130. /*!**********************************!*\
  131. !*** ../src/cell/cell.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;\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);\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/cell/cellMaterial.ts":
  138. /*!***********************************!*\
  139. !*** ../src/cell/cellMaterial.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["cellPixelShader"] = __webpack_require__(/*! ./cell.fragment.fx */ "../src/cell/cell.fragment.fx");
  166. babylonjs_1.Effect.ShadersStore["cellVertexShader"] = __webpack_require__(/*! ./cell.vertex.fx */ "../src/cell/cell.vertex.fx");
  167. var CellMaterialDefines = /** @class */ (function (_super) {
  168. __extends(CellMaterialDefines, _super);
  169. function CellMaterialDefines() {
  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.POINTSIZE = false;
  178. _this.FOG = false;
  179. _this.NORMAL = false;
  180. _this.UV1 = false;
  181. _this.UV2 = false;
  182. _this.VERTEXCOLOR = false;
  183. _this.VERTEXALPHA = false;
  184. _this.NUM_BONE_INFLUENCERS = 0;
  185. _this.BonesPerMesh = 0;
  186. _this.INSTANCES = false;
  187. _this.NDOTL = true;
  188. _this.CUSTOMUSERLIGHTING = true;
  189. _this.CELLBASIC = true;
  190. _this.DEPTHPREPASS = false;
  191. _this.rebuild();
  192. return _this;
  193. }
  194. return CellMaterialDefines;
  195. }(babylonjs_1.MaterialDefines));
  196. var CellMaterial = /** @class */ (function (_super) {
  197. __extends(CellMaterial, _super);
  198. function CellMaterial(name, scene) {
  199. var _this = _super.call(this, name, scene) || this;
  200. _this.diffuseColor = new babylonjs_1.Color3(1, 1, 1);
  201. _this._computeHighLevel = false;
  202. _this._disableLighting = false;
  203. _this._maxSimultaneousLights = 4;
  204. return _this;
  205. }
  206. CellMaterial.prototype.needAlphaBlending = function () {
  207. return (this.alpha < 1.0);
  208. };
  209. CellMaterial.prototype.needAlphaTesting = function () {
  210. return false;
  211. };
  212. CellMaterial.prototype.getAlphaTestTexture = function () {
  213. return null;
  214. };
  215. // Methods
  216. CellMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {
  217. if (this.isFrozen) {
  218. if (this._wasPreviouslyReady && subMesh.effect) {
  219. return true;
  220. }
  221. }
  222. if (!subMesh._materialDefines) {
  223. subMesh._materialDefines = new CellMaterialDefines();
  224. }
  225. var defines = subMesh._materialDefines;
  226. var scene = this.getScene();
  227. if (!this.checkReadyOnEveryCall && subMesh.effect) {
  228. if (this._renderId === scene.getRenderId()) {
  229. return true;
  230. }
  231. }
  232. var engine = scene.getEngine();
  233. // Textures
  234. if (defines._areTexturesDirty) {
  235. defines._needUVs = false;
  236. if (scene.texturesEnabled) {
  237. if (this._diffuseTexture && babylonjs_1.StandardMaterial.DiffuseTextureEnabled) {
  238. if (!this._diffuseTexture.isReady()) {
  239. return false;
  240. }
  241. else {
  242. defines._needUVs = true;
  243. defines.DIFFUSE = true;
  244. }
  245. }
  246. }
  247. }
  248. // High level
  249. defines.CELLBASIC = !this.computeHighLevel;
  250. // Misc.
  251. babylonjs_1.MaterialHelper.PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
  252. // Lights
  253. defines._needNormals = babylonjs_1.MaterialHelper.PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
  254. // Values that need to be evaluated on every frame
  255. babylonjs_1.MaterialHelper.PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);
  256. // Attribs
  257. babylonjs_1.MaterialHelper.PrepareDefinesForAttributes(mesh, defines, true, true);
  258. // Get correct effect
  259. if (defines.isDirty) {
  260. defines.markAsProcessed();
  261. scene.resetCachedMaterial();
  262. // Fallbacks
  263. var fallbacks = new babylonjs_1.EffectFallbacks();
  264. if (defines.FOG) {
  265. fallbacks.addFallback(1, "FOG");
  266. }
  267. babylonjs_1.MaterialHelper.HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
  268. if (defines.NUM_BONE_INFLUENCERS > 0) {
  269. fallbacks.addCPUSkinningFallback(0, mesh);
  270. }
  271. //Attributes
  272. var attribs = [babylonjs_1.VertexBuffer.PositionKind];
  273. if (defines.NORMAL) {
  274. attribs.push(babylonjs_1.VertexBuffer.NormalKind);
  275. }
  276. if (defines.UV1) {
  277. attribs.push(babylonjs_1.VertexBuffer.UVKind);
  278. }
  279. if (defines.UV2) {
  280. attribs.push(babylonjs_1.VertexBuffer.UV2Kind);
  281. }
  282. if (defines.VERTEXCOLOR) {
  283. attribs.push(babylonjs_1.VertexBuffer.ColorKind);
  284. }
  285. babylonjs_1.MaterialHelper.PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
  286. babylonjs_1.MaterialHelper.PrepareAttributesForInstances(attribs, defines);
  287. var shaderName = "cell";
  288. var join = defines.toString();
  289. var uniforms = ["world", "view", "viewProjection", "vEyePosition", "vLightsType", "vDiffuseColor",
  290. "vFogInfos", "vFogColor", "pointSize",
  291. "vDiffuseInfos",
  292. "mBones",
  293. "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "diffuseMatrix"
  294. ];
  295. var samplers = ["diffuseSampler"];
  296. var uniformBuffers = new Array();
  297. babylonjs_1.MaterialHelper.PrepareUniformsAndSamplersList({
  298. uniformsNames: uniforms,
  299. uniformBuffersNames: uniformBuffers,
  300. samplers: samplers,
  301. defines: defines,
  302. maxSimultaneousLights: this.maxSimultaneousLights
  303. });
  304. subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
  305. attributes: attribs,
  306. uniformsNames: uniforms,
  307. uniformBuffersNames: uniformBuffers,
  308. samplers: samplers,
  309. defines: join,
  310. fallbacks: fallbacks,
  311. onCompiled: this.onCompiled,
  312. onError: this.onError,
  313. indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights - 1 }
  314. }, engine), defines);
  315. }
  316. if (!subMesh.effect || !subMesh.effect.isReady()) {
  317. return false;
  318. }
  319. this._renderId = scene.getRenderId();
  320. this._wasPreviouslyReady = true;
  321. return true;
  322. };
  323. CellMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {
  324. var scene = this.getScene();
  325. var defines = subMesh._materialDefines;
  326. if (!defines) {
  327. return;
  328. }
  329. var effect = subMesh.effect;
  330. if (!effect) {
  331. return;
  332. }
  333. this._activeEffect = effect;
  334. // Matrices
  335. this.bindOnlyWorldMatrix(world);
  336. this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
  337. // Bones
  338. babylonjs_1.MaterialHelper.BindBonesParameters(mesh, this._activeEffect);
  339. if (this._mustRebind(scene, effect)) {
  340. // Textures
  341. if (this._diffuseTexture && babylonjs_1.StandardMaterial.DiffuseTextureEnabled) {
  342. this._activeEffect.setTexture("diffuseSampler", this._diffuseTexture);
  343. this._activeEffect.setFloat2("vDiffuseInfos", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);
  344. this._activeEffect.setMatrix("diffuseMatrix", this._diffuseTexture.getTextureMatrix());
  345. }
  346. // Clip plane
  347. babylonjs_1.MaterialHelper.BindClipPlane(this._activeEffect, scene);
  348. // Point size
  349. if (this.pointsCloud) {
  350. this._activeEffect.setFloat("pointSize", this.pointSize);
  351. }
  352. babylonjs_1.MaterialHelper.BindEyePosition(effect, scene);
  353. }
  354. this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
  355. // Lights
  356. if (scene.lightsEnabled && !this.disableLighting) {
  357. babylonjs_1.MaterialHelper.BindLights(scene, mesh, this._activeEffect, defines, this._maxSimultaneousLights);
  358. }
  359. // View
  360. if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== babylonjs_1.Scene.FOGMODE_NONE) {
  361. this._activeEffect.setMatrix("view", scene.getViewMatrix());
  362. }
  363. console.log("TOTO");
  364. // Fog
  365. babylonjs_1.MaterialHelper.BindFogParameters(scene, mesh, this._activeEffect);
  366. this._afterBind(mesh, this._activeEffect);
  367. };
  368. CellMaterial.prototype.getAnimatables = function () {
  369. var results = [];
  370. if (this._diffuseTexture && this._diffuseTexture.animations && this._diffuseTexture.animations.length > 0) {
  371. results.push(this._diffuseTexture);
  372. }
  373. return results;
  374. };
  375. CellMaterial.prototype.getActiveTextures = function () {
  376. var activeTextures = _super.prototype.getActiveTextures.call(this);
  377. if (this._diffuseTexture) {
  378. activeTextures.push(this._diffuseTexture);
  379. }
  380. return activeTextures;
  381. };
  382. CellMaterial.prototype.hasTexture = function (texture) {
  383. if (_super.prototype.hasTexture.call(this, texture)) {
  384. return true;
  385. }
  386. return this._diffuseTexture === texture;
  387. };
  388. CellMaterial.prototype.dispose = function (forceDisposeEffect) {
  389. if (this._diffuseTexture) {
  390. this._diffuseTexture.dispose();
  391. }
  392. _super.prototype.dispose.call(this, forceDisposeEffect);
  393. };
  394. CellMaterial.prototype.getClassName = function () {
  395. return "CellMaterial";
  396. };
  397. CellMaterial.prototype.clone = function (name) {
  398. var _this = this;
  399. return babylonjs_1.SerializationHelper.Clone(function () { return new CellMaterial(name, _this.getScene()); }, this);
  400. };
  401. CellMaterial.prototype.serialize = function () {
  402. var serializationObject = babylonjs_1.SerializationHelper.Serialize(this);
  403. serializationObject.customType = "BABYLON.CellMaterial";
  404. return serializationObject;
  405. };
  406. // Statics
  407. CellMaterial.Parse = function (source, scene, rootUrl) {
  408. return babylonjs_1.SerializationHelper.Parse(function () { return new CellMaterial(source.name, scene); }, source, scene, rootUrl);
  409. };
  410. __decorate([
  411. babylonjs_1.serializeAsTexture("diffuseTexture")
  412. ], CellMaterial.prototype, "_diffuseTexture", void 0);
  413. __decorate([
  414. babylonjs_1.expandToProperty("_markAllSubMeshesAsTexturesDirty")
  415. ], CellMaterial.prototype, "diffuseTexture", void 0);
  416. __decorate([
  417. babylonjs_1.serializeAsColor3("diffuse")
  418. ], CellMaterial.prototype, "diffuseColor", void 0);
  419. __decorate([
  420. babylonjs_1.serialize("computeHighLevel")
  421. ], CellMaterial.prototype, "_computeHighLevel", void 0);
  422. __decorate([
  423. babylonjs_1.expandToProperty("_markAllSubMeshesAsTexturesDirty")
  424. ], CellMaterial.prototype, "computeHighLevel", void 0);
  425. __decorate([
  426. babylonjs_1.serialize("disableLighting")
  427. ], CellMaterial.prototype, "_disableLighting", void 0);
  428. __decorate([
  429. babylonjs_1.expandToProperty("_markAllSubMeshesAsLightsDirty")
  430. ], CellMaterial.prototype, "disableLighting", void 0);
  431. __decorate([
  432. babylonjs_1.serialize("maxSimultaneousLights")
  433. ], CellMaterial.prototype, "_maxSimultaneousLights", void 0);
  434. __decorate([
  435. babylonjs_1.expandToProperty("_markAllSubMeshesAsLightsDirty")
  436. ], CellMaterial.prototype, "maxSimultaneousLights", void 0);
  437. return CellMaterial;
  438. }(babylonjs_1.PushMaterial));
  439. exports.CellMaterial = CellMaterial;
  440. /***/ }),
  441. /***/ "../src/cell/index.ts":
  442. /*!****************************!*\
  443. !*** ../src/cell/index.ts ***!
  444. \****************************/
  445. /*! no static exports found */
  446. /***/ (function(module, exports, __webpack_require__) {
  447. "use strict";
  448. function __export(m) {
  449. for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  450. }
  451. Object.defineProperty(exports, "__esModule", { value: true });
  452. __export(__webpack_require__(/*! ./cellMaterial */ "../src/cell/cellMaterial.ts"));
  453. /***/ }),
  454. /***/ "./legacy-cell.ts":
  455. /*!************************!*\
  456. !*** ./legacy-cell.ts ***!
  457. \************************/
  458. /*! no static exports found */
  459. /***/ (function(module, exports, __webpack_require__) {
  460. "use strict";
  461. /* WEBPACK VAR INJECTION */(function(global) {
  462. function __export(m) {
  463. for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  464. }
  465. Object.defineProperty(exports, "__esModule", { value: true });
  466. var MatLib = __webpack_require__(/*! ../src/cell/index */ "../src/cell/index.ts");
  467. /**
  468. * This is the entry point for the UMD module.
  469. * The entry point for a future ESM package should be index.ts
  470. */
  471. var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
  472. if (typeof globalObject !== "undefined") {
  473. for (var key in MatLib) {
  474. globalObject.BABYLON[key] = MatLib[key];
  475. }
  476. }
  477. __export(__webpack_require__(/*! ../src/cell/index */ "../src/cell/index.ts"));
  478. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../Tools/Gulp/node_modules/webpack/buildin/global.js */ "../../Tools/Gulp/node_modules/webpack/buildin/global.js")))
  479. /***/ }),
  480. /***/ "babylonjs":
  481. /*!****************************************************************************************************!*\
  482. !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
  483. \****************************************************************************************************/
  484. /*! no static exports found */
  485. /***/ (function(module, exports) {
  486. module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs__;
  487. /***/ })
  488. /******/ });
  489. });
  490. //# sourceMappingURL=babylon.cellMaterial.js.map