babylon.mixMaterial.js 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  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["MATERIALS"] = factory(root["BABYLON"]);
  10. })((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), function(__WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__) {
  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/legacy-mix.ts");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "../../node_modules/tslib/tslib.es6.js":
  99. /*!***********************************************************!*\
  100. !*** C:/Repos/Babylon.js/node_modules/tslib/tslib.es6.js ***!
  101. \***********************************************************/
  102. /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault */
  103. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  104. "use strict";
  105. __webpack_require__.r(__webpack_exports__);
  106. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  107. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  108. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  109. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  110. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  111. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  112. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  113. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  114. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  115. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  116. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  117. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  118. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
  119. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  120. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  121. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  122. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  123. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  124. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  125. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  126. /*! *****************************************************************************
  127. Copyright (c) Microsoft Corporation. All rights reserved.
  128. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  129. this file except in compliance with the License. You may obtain a copy of the
  130. License at http://www.apache.org/licenses/LICENSE-2.0
  131. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  132. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  133. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  134. MERCHANTABLITY OR NON-INFRINGEMENT.
  135. See the Apache Version 2.0 License for specific language governing permissions
  136. and limitations under the License.
  137. ***************************************************************************** */
  138. /* global Reflect, Promise */
  139. var extendStatics = function(d, b) {
  140. extendStatics = Object.setPrototypeOf ||
  141. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  142. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  143. return extendStatics(d, b);
  144. };
  145. function __extends(d, b) {
  146. extendStatics(d, b);
  147. function __() { this.constructor = d; }
  148. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  149. }
  150. var __assign = function() {
  151. __assign = Object.assign || function __assign(t) {
  152. for (var s, i = 1, n = arguments.length; i < n; i++) {
  153. s = arguments[i];
  154. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  155. }
  156. return t;
  157. }
  158. return __assign.apply(this, arguments);
  159. }
  160. function __rest(s, e) {
  161. var t = {};
  162. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  163. t[p] = s[p];
  164. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  165. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  166. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  167. t[p[i]] = s[p[i]];
  168. }
  169. return t;
  170. }
  171. function __decorate(decorators, target, key, desc) {
  172. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  173. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  174. 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;
  175. return c > 3 && r && Object.defineProperty(target, key, r), r;
  176. }
  177. function __param(paramIndex, decorator) {
  178. return function (target, key) { decorator(target, key, paramIndex); }
  179. }
  180. function __metadata(metadataKey, metadataValue) {
  181. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  182. }
  183. function __awaiter(thisArg, _arguments, P, generator) {
  184. return new (P || (P = Promise))(function (resolve, reject) {
  185. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  186. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  187. function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
  188. step((generator = generator.apply(thisArg, _arguments || [])).next());
  189. });
  190. }
  191. function __generator(thisArg, body) {
  192. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  193. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  194. function verb(n) { return function (v) { return step([n, v]); }; }
  195. function step(op) {
  196. if (f) throw new TypeError("Generator is already executing.");
  197. while (_) try {
  198. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  199. if (y = 0, t) op = [op[0] & 2, t.value];
  200. switch (op[0]) {
  201. case 0: case 1: t = op; break;
  202. case 4: _.label++; return { value: op[1], done: false };
  203. case 5: _.label++; y = op[1]; op = [0]; continue;
  204. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  205. default:
  206. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  207. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  208. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  209. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  210. if (t[2]) _.ops.pop();
  211. _.trys.pop(); continue;
  212. }
  213. op = body.call(thisArg, _);
  214. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  215. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  216. }
  217. }
  218. function __exportStar(m, exports) {
  219. for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  220. }
  221. function __values(o) {
  222. var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
  223. if (m) return m.call(o);
  224. return {
  225. next: function () {
  226. if (o && i >= o.length) o = void 0;
  227. return { value: o && o[i++], done: !o };
  228. }
  229. };
  230. }
  231. function __read(o, n) {
  232. var m = typeof Symbol === "function" && o[Symbol.iterator];
  233. if (!m) return o;
  234. var i = m.call(o), r, ar = [], e;
  235. try {
  236. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  237. }
  238. catch (error) { e = { error: error }; }
  239. finally {
  240. try {
  241. if (r && !r.done && (m = i["return"])) m.call(i);
  242. }
  243. finally { if (e) throw e.error; }
  244. }
  245. return ar;
  246. }
  247. function __spread() {
  248. for (var ar = [], i = 0; i < arguments.length; i++)
  249. ar = ar.concat(__read(arguments[i]));
  250. return ar;
  251. }
  252. function __spreadArrays() {
  253. for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  254. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  255. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  256. r[k] = a[j];
  257. return r;
  258. };
  259. function __await(v) {
  260. return this instanceof __await ? (this.v = v, this) : new __await(v);
  261. }
  262. function __asyncGenerator(thisArg, _arguments, generator) {
  263. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  264. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  265. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  266. function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
  267. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  268. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  269. function fulfill(value) { resume("next", value); }
  270. function reject(value) { resume("throw", value); }
  271. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  272. }
  273. function __asyncDelegator(o) {
  274. var i, p;
  275. return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  276. function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
  277. }
  278. function __asyncValues(o) {
  279. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  280. var m = o[Symbol.asyncIterator], i;
  281. return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
  282. function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
  283. function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  284. }
  285. function __makeTemplateObject(cooked, raw) {
  286. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  287. return cooked;
  288. };
  289. function __importStar(mod) {
  290. if (mod && mod.__esModule) return mod;
  291. var result = {};
  292. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  293. result.default = mod;
  294. return result;
  295. }
  296. function __importDefault(mod) {
  297. return (mod && mod.__esModule) ? mod : { default: mod };
  298. }
  299. /***/ }),
  300. /***/ "../../node_modules/webpack/buildin/global.js":
  301. /*!***********************************!*\
  302. !*** (webpack)/buildin/global.js ***!
  303. \***********************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports) {
  306. var g;
  307. // This works in non-strict mode
  308. g = (function() {
  309. return this;
  310. })();
  311. try {
  312. // This works if eval is allowed (see CSP)
  313. g = g || new Function("return this")();
  314. } catch (e) {
  315. // This works if the window reference is available
  316. if (typeof window === "object") g = window;
  317. }
  318. // g can still be undefined, but nothing to do about it...
  319. // We return undefined, instead of nothing here, so it's
  320. // easier to handle this case. if(!global) { ...}
  321. module.exports = g;
  322. /***/ }),
  323. /***/ "./legacy/legacy-mix.ts":
  324. /*!******************************!*\
  325. !*** ./legacy/legacy-mix.ts ***!
  326. \******************************/
  327. /*! exports provided: MixMaterial */
  328. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  329. "use strict";
  330. __webpack_require__.r(__webpack_exports__);
  331. /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _mix_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mix/index */ "./mix/index.ts");
  332. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MixMaterial", function() { return _mix_index__WEBPACK_IMPORTED_MODULE_0__["MixMaterial"]; });
  333. /**
  334. * This is the entry point for the UMD module.
  335. * The entry point for a future ESM package should be index.ts
  336. */
  337. var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
  338. if (typeof globalObject !== "undefined") {
  339. for (var key in _mix_index__WEBPACK_IMPORTED_MODULE_0__) {
  340. globalObject.BABYLON[key] = _mix_index__WEBPACK_IMPORTED_MODULE_0__[key];
  341. }
  342. }
  343. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js")))
  344. /***/ }),
  345. /***/ "./mix/index.ts":
  346. /*!**********************!*\
  347. !*** ./mix/index.ts ***!
  348. \**********************/
  349. /*! exports provided: MixMaterial */
  350. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  351. "use strict";
  352. __webpack_require__.r(__webpack_exports__);
  353. /* harmony import */ var _mixMaterial__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mixMaterial */ "./mix/mixMaterial.ts");
  354. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MixMaterial", function() { return _mixMaterial__WEBPACK_IMPORTED_MODULE_0__["MixMaterial"]; });
  355. /***/ }),
  356. /***/ "./mix/mix.fragment.ts":
  357. /*!*****************************!*\
  358. !*** ./mix/mix.fragment.ts ***!
  359. \*****************************/
  360. /*! exports provided: mixPixelShader */
  361. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  362. "use strict";
  363. __webpack_require__.r(__webpack_exports__);
  364. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mixPixelShader", function() { return mixPixelShader; });
  365. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  366. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  367. var name = 'mixPixelShader';
  368. var shader = "precision highp float;\n\nuniform vec3 vEyePosition;\nuniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\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\n#ifdef DIFFUSE\nvarying vec2 vTextureUV;\nuniform sampler2D mixMap1Sampler;\nuniform vec2 vTextureInfos;\n#ifdef MIXMAP2\nuniform sampler2D mixMap2Sampler;\n#endif\nuniform sampler2D diffuse1Sampler;\nuniform sampler2D diffuse2Sampler;\nuniform sampler2D diffuse3Sampler;\nuniform sampler2D diffuse4Sampler;\nuniform vec2 diffuse1Infos;\nuniform vec2 diffuse2Infos;\nuniform vec2 diffuse3Infos;\nuniform vec2 diffuse4Infos;\n#ifdef MIXMAP2\nuniform sampler2D diffuse5Sampler;\nuniform sampler2D diffuse6Sampler;\nuniform sampler2D diffuse7Sampler;\nuniform sampler2D diffuse8Sampler;\nuniform vec2 diffuse5Infos;\nuniform vec2 diffuse6Infos;\nuniform vec2 diffuse7Infos;\nuniform vec2 diffuse8Infos;\n#endif\n#endif\n\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n\n#include<fogFragmentDeclaration>\nvoid main(void) {\n\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 finalMixColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n#ifdef MIXMAP2\nvec4 mixColor2=vec4(1.,1.,1.,1.);\n#endif\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#else\nfloat glossiness=0.;\n#endif\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef DIFFUSE\nvec4 mixColor=texture2D(mixMap1Sampler,vTextureUV);\n#include<depthPrePass>\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse1Color=texture2D(diffuse1Sampler,vTextureUV*diffuse1Infos);\nvec4 diffuse2Color=texture2D(diffuse2Sampler,vTextureUV*diffuse2Infos);\nvec4 diffuse3Color=texture2D(diffuse3Sampler,vTextureUV*diffuse3Infos);\nvec4 diffuse4Color=texture2D(diffuse4Sampler,vTextureUV*diffuse4Infos);\ndiffuse1Color.rgb*=mixColor.r;\ndiffuse2Color.rgb=mix(diffuse1Color.rgb,diffuse2Color.rgb,mixColor.g);\ndiffuse3Color.rgb=mix(diffuse2Color.rgb,diffuse3Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse3Color.rgb,diffuse4Color.rgb,1.0-mixColor.a);\n#ifdef MIXMAP2\nmixColor=texture2D(mixMap2Sampler,vTextureUV);\nmixColor.rgb*=vTextureInfos.y;\nvec4 diffuse5Color=texture2D(diffuse5Sampler,vTextureUV*diffuse5Infos);\nvec4 diffuse6Color=texture2D(diffuse6Sampler,vTextureUV*diffuse6Infos);\nvec4 diffuse7Color=texture2D(diffuse7Sampler,vTextureUV*diffuse7Infos);\nvec4 diffuse8Color=texture2D(diffuse8Sampler,vTextureUV*diffuse8Infos);\ndiffuse5Color.rgb=mix(finalMixColor.rgb,diffuse5Color.rgb,mixColor.r);\ndiffuse6Color.rgb=mix(diffuse5Color.rgb,diffuse6Color.rgb,mixColor.g);\ndiffuse7Color.rgb=mix(diffuse6Color.rgb,diffuse7Color.rgb,mixColor.b);\nfinalMixColor.rgb=mix(diffuse7Color.rgb,diffuse8Color.rgb,1.0-mixColor.a);\n#endif\n#endif\n#ifdef VERTEXCOLOR\nfinalMixColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor*finalMixColor.rgb,0.0,1.0);\n\nvec4 color=vec4(finalDiffuse+finalSpecular,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n}\n";
  369. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  370. /** @hidden */
  371. var mixPixelShader = { name: name, shader: shader };
  372. /***/ }),
  373. /***/ "./mix/mix.vertex.ts":
  374. /*!***************************!*\
  375. !*** ./mix/mix.vertex.ts ***!
  376. \***************************/
  377. /*! exports provided: mixVertexShader */
  378. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  379. "use strict";
  380. __webpack_require__.r(__webpack_exports__);
  381. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mixVertexShader", function() { return mixVertexShader; });
  382. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Materials/effect */ "babylonjs/Misc/decorators");
  383. /* harmony import */ var babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__);
  384. var name = 'mixVertexShader';
  385. var shader = "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 vTextureUV;\nuniform mat4 textureMatrix;\nuniform vec2 vTextureInfos;\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 (vTextureInfos.x == 0.)\n{\nvTextureUV=vec2(textureMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvTextureUV=vec2(textureMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";
  386. babylonjs_Materials_effect__WEBPACK_IMPORTED_MODULE_0__["Effect"].ShadersStore[name] = shader;
  387. /** @hidden */
  388. var mixVertexShader = { name: name, shader: shader };
  389. /***/ }),
  390. /***/ "./mix/mixMaterial.ts":
  391. /*!****************************!*\
  392. !*** ./mix/mixMaterial.ts ***!
  393. \****************************/
  394. /*! exports provided: MixMaterial */
  395. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  396. "use strict";
  397. __webpack_require__.r(__webpack_exports__);
  398. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MixMaterial", function() { return MixMaterial; });
  399. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../node_modules/tslib/tslib.es6.js");
  400. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babylonjs/Misc/decorators */ "babylonjs/Misc/decorators");
  401. /* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__);
  402. /* harmony import */ var _mix_fragment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mix.fragment */ "./mix/mix.fragment.ts");
  403. /* harmony import */ var _mix_vertex__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mix.vertex */ "./mix/mix.vertex.ts");
  404. var MixMaterialDefines = /** @class */ (function (_super) {
  405. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](MixMaterialDefines, _super);
  406. function MixMaterialDefines() {
  407. var _this = _super.call(this) || this;
  408. _this.DIFFUSE = false;
  409. _this.CLIPPLANE = false;
  410. _this.CLIPPLANE2 = false;
  411. _this.CLIPPLANE3 = false;
  412. _this.CLIPPLANE4 = false;
  413. _this.ALPHATEST = false;
  414. _this.DEPTHPREPASS = false;
  415. _this.POINTSIZE = false;
  416. _this.FOG = false;
  417. _this.SPECULARTERM = false;
  418. _this.NORMAL = false;
  419. _this.UV1 = false;
  420. _this.UV2 = false;
  421. _this.VERTEXCOLOR = false;
  422. _this.VERTEXALPHA = false;
  423. _this.NUM_BONE_INFLUENCERS = 0;
  424. _this.BonesPerMesh = 0;
  425. _this.INSTANCES = false;
  426. _this.MIXMAP2 = false;
  427. _this.rebuild();
  428. return _this;
  429. }
  430. return MixMaterialDefines;
  431. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialDefines"]));
  432. var MixMaterial = /** @class */ (function (_super) {
  433. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](MixMaterial, _super);
  434. function MixMaterial(name, scene) {
  435. var _this = _super.call(this, name, scene) || this;
  436. /**
  437. * Uniforms
  438. */
  439. _this.diffuseColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](1, 1, 1);
  440. _this.specularColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Color3"](0, 0, 0);
  441. _this.specularPower = 64;
  442. _this._disableLighting = false;
  443. _this._maxSimultaneousLights = 4;
  444. return _this;
  445. }
  446. MixMaterial.prototype.needAlphaBlending = function () {
  447. return (this.alpha < 1.0);
  448. };
  449. MixMaterial.prototype.needAlphaTesting = function () {
  450. return false;
  451. };
  452. MixMaterial.prototype.getAlphaTestTexture = function () {
  453. return null;
  454. };
  455. // Methods
  456. MixMaterial.prototype.isReadyForSubMesh = function (mesh, subMesh, useInstances) {
  457. if (this.isFrozen) {
  458. if (this._wasPreviouslyReady && subMesh.effect) {
  459. return true;
  460. }
  461. }
  462. if (!subMesh._materialDefines) {
  463. subMesh._materialDefines = new MixMaterialDefines();
  464. }
  465. var defines = subMesh._materialDefines;
  466. var scene = this.getScene();
  467. if (!this.checkReadyOnEveryCall && subMesh.effect) {
  468. if (this._renderId === scene.getRenderId()) {
  469. return true;
  470. }
  471. }
  472. var engine = scene.getEngine();
  473. // Textures
  474. if (scene.texturesEnabled) {
  475. if (!this._mixTexture1 || !this._mixTexture1.isReady()) {
  476. return false;
  477. }
  478. defines._needUVs = true;
  479. if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialFlags"].DiffuseTextureEnabled) {
  480. if (!this._diffuseTexture1 || !this._diffuseTexture1.isReady()) {
  481. return false;
  482. }
  483. defines.DIFFUSE = true;
  484. if (!this._diffuseTexture2 || !this._diffuseTexture2.isReady()) {
  485. return false;
  486. }
  487. if (!this._diffuseTexture3 || !this._diffuseTexture3.isReady()) {
  488. return false;
  489. }
  490. if (!this._diffuseTexture4 || !this._diffuseTexture4.isReady()) {
  491. return false;
  492. }
  493. if (this._mixTexture2) {
  494. if (!this._mixTexture2.isReady()) {
  495. return false;
  496. }
  497. defines.MIXMAP2 = true;
  498. if (!this._diffuseTexture5 || !this._diffuseTexture5.isReady()) {
  499. return false;
  500. }
  501. if (!this._diffuseTexture6 || !this._diffuseTexture6.isReady()) {
  502. return false;
  503. }
  504. if (!this._diffuseTexture7 || !this._diffuseTexture7.isReady()) {
  505. return false;
  506. }
  507. if (!this._diffuseTexture8 || !this._diffuseTexture8.isReady()) {
  508. return false;
  509. }
  510. }
  511. }
  512. }
  513. // Misc.
  514. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForMisc(mesh, scene, false, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);
  515. // Lights
  516. defines._needNormals = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);
  517. // Values that need to be evaluated on every frame
  518. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForFrameBoundValues(scene, engine, defines, useInstances ? true : false);
  519. // Attribs
  520. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareDefinesForAttributes(mesh, defines, true, true);
  521. // Get correct effect
  522. if (defines.isDirty) {
  523. defines.markAsProcessed();
  524. scene.resetCachedMaterial();
  525. // Fallbacks
  526. var fallbacks = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["EffectFallbacks"]();
  527. if (defines.FOG) {
  528. fallbacks.addFallback(1, "FOG");
  529. }
  530. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].HandleFallbacksForShadows(defines, fallbacks, this.maxSimultaneousLights);
  531. if (defines.NUM_BONE_INFLUENCERS > 0) {
  532. fallbacks.addCPUSkinningFallback(0, mesh);
  533. }
  534. //Attributes
  535. var attribs = [babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].PositionKind];
  536. if (defines.NORMAL) {
  537. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].NormalKind);
  538. }
  539. if (defines.UV1) {
  540. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UVKind);
  541. }
  542. if (defines.UV2) {
  543. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].UV2Kind);
  544. }
  545. if (defines.VERTEXCOLOR) {
  546. attribs.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["VertexBuffer"].ColorKind);
  547. }
  548. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareAttributesForBones(attribs, mesh, defines, fallbacks);
  549. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareAttributesForInstances(attribs, defines);
  550. // Legacy browser patch
  551. var shaderName = "mix";
  552. var join = defines.toString();
  553. var uniforms = [
  554. "world", "view", "viewProjection", "vEyePosition", "vLightsType", "vDiffuseColor", "vSpecularColor",
  555. "vFogInfos", "vFogColor", "pointSize",
  556. "vTextureInfos",
  557. "mBones",
  558. "vClipPlane", "vClipPlane2", "vClipPlane3", "vClipPlane4", "textureMatrix",
  559. "diffuse1Infos", "diffuse2Infos", "diffuse3Infos", "diffuse4Infos",
  560. "diffuse5Infos", "diffuse6Infos", "diffuse7Infos", "diffuse8Infos"
  561. ];
  562. var samplers = [
  563. "mixMap1Sampler", "mixMap2Sampler",
  564. "diffuse1Sampler", "diffuse2Sampler", "diffuse3Sampler", "diffuse4Sampler",
  565. "diffuse5Sampler", "diffuse6Sampler", "diffuse7Sampler", "diffuse8Sampler"
  566. ];
  567. var uniformBuffers = new Array();
  568. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].PrepareUniformsAndSamplersList({
  569. uniformsNames: uniforms,
  570. uniformBuffersNames: uniformBuffers,
  571. samplers: samplers,
  572. defines: defines,
  573. maxSimultaneousLights: this.maxSimultaneousLights
  574. });
  575. subMesh.setEffect(scene.getEngine().createEffect(shaderName, {
  576. attributes: attribs,
  577. uniformsNames: uniforms,
  578. uniformBuffersNames: uniformBuffers,
  579. samplers: samplers,
  580. defines: join,
  581. fallbacks: fallbacks,
  582. onCompiled: this.onCompiled,
  583. onError: this.onError,
  584. indexParameters: { maxSimultaneousLights: this.maxSimultaneousLights }
  585. }, engine), defines);
  586. }
  587. if (!subMesh.effect || !subMesh.effect.isReady()) {
  588. return false;
  589. }
  590. this._renderId = scene.getRenderId();
  591. this._wasPreviouslyReady = true;
  592. return true;
  593. };
  594. MixMaterial.prototype.bindForSubMesh = function (world, mesh, subMesh) {
  595. var scene = this.getScene();
  596. var defines = subMesh._materialDefines;
  597. if (!defines) {
  598. return;
  599. }
  600. var effect = subMesh.effect;
  601. if (!effect) {
  602. return;
  603. }
  604. this._activeEffect = effect;
  605. // Matrices
  606. this.bindOnlyWorldMatrix(world);
  607. this._activeEffect.setMatrix("viewProjection", scene.getTransformMatrix());
  608. // Bones
  609. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindBonesParameters(mesh, this._activeEffect);
  610. if (this._mustRebind(scene, effect)) {
  611. // Textures
  612. if (this._mixTexture1) {
  613. this._activeEffect.setTexture("mixMap1Sampler", this._mixTexture1);
  614. this._activeEffect.setFloat2("vTextureInfos", this._mixTexture1.coordinatesIndex, this._mixTexture1.level);
  615. this._activeEffect.setMatrix("textureMatrix", this._mixTexture1.getTextureMatrix());
  616. if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialFlags"].DiffuseTextureEnabled) {
  617. if (this._diffuseTexture1) {
  618. this._activeEffect.setTexture("diffuse1Sampler", this._diffuseTexture1);
  619. this._activeEffect.setFloat2("diffuse1Infos", this._diffuseTexture1.uScale, this._diffuseTexture1.vScale);
  620. }
  621. if (this._diffuseTexture2) {
  622. this._activeEffect.setTexture("diffuse2Sampler", this._diffuseTexture2);
  623. this._activeEffect.setFloat2("diffuse2Infos", this._diffuseTexture2.uScale, this._diffuseTexture2.vScale);
  624. }
  625. if (this._diffuseTexture3) {
  626. this._activeEffect.setTexture("diffuse3Sampler", this._diffuseTexture3);
  627. this._activeEffect.setFloat2("diffuse3Infos", this._diffuseTexture3.uScale, this._diffuseTexture3.vScale);
  628. }
  629. if (this._diffuseTexture4) {
  630. this._activeEffect.setTexture("diffuse4Sampler", this._diffuseTexture4);
  631. this._activeEffect.setFloat2("diffuse4Infos", this._diffuseTexture4.uScale, this._diffuseTexture4.vScale);
  632. }
  633. }
  634. }
  635. if (this._mixTexture2) {
  636. this._activeEffect.setTexture("mixMap2Sampler", this._mixTexture2);
  637. if (babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialFlags"].DiffuseTextureEnabled) {
  638. if (this._diffuseTexture5) {
  639. this._activeEffect.setTexture("diffuse5Sampler", this._diffuseTexture5);
  640. this._activeEffect.setFloat2("diffuse5Infos", this._diffuseTexture5.uScale, this._diffuseTexture5.vScale);
  641. }
  642. if (this._diffuseTexture6) {
  643. this._activeEffect.setTexture("diffuse6Sampler", this._diffuseTexture6);
  644. this._activeEffect.setFloat2("diffuse6Infos", this._diffuseTexture6.uScale, this._diffuseTexture6.vScale);
  645. }
  646. if (this._diffuseTexture7) {
  647. this._activeEffect.setTexture("diffuse7Sampler", this._diffuseTexture7);
  648. this._activeEffect.setFloat2("diffuse7Infos", this._diffuseTexture7.uScale, this._diffuseTexture7.vScale);
  649. }
  650. if (this._diffuseTexture8) {
  651. this._activeEffect.setTexture("diffuse8Sampler", this._diffuseTexture8);
  652. this._activeEffect.setFloat2("diffuse8Infos", this._diffuseTexture8.uScale, this._diffuseTexture8.vScale);
  653. }
  654. }
  655. }
  656. // Clip plane
  657. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindClipPlane(this._activeEffect, scene);
  658. // Point size
  659. if (this.pointsCloud) {
  660. this._activeEffect.setFloat("pointSize", this.pointSize);
  661. }
  662. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindEyePosition(effect, scene);
  663. }
  664. this._activeEffect.setColor4("vDiffuseColor", this.diffuseColor, this.alpha * mesh.visibility);
  665. if (defines.SPECULARTERM) {
  666. this._activeEffect.setColor4("vSpecularColor", this.specularColor, this.specularPower);
  667. }
  668. if (scene.lightsEnabled && !this.disableLighting) {
  669. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);
  670. }
  671. // View
  672. if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["Scene"].FOGMODE_NONE) {
  673. this._activeEffect.setMatrix("view", scene.getViewMatrix());
  674. }
  675. // Fog
  676. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["MaterialHelper"].BindFogParameters(scene, mesh, this._activeEffect);
  677. this._afterBind(mesh, this._activeEffect);
  678. };
  679. MixMaterial.prototype.getAnimatables = function () {
  680. var results = [];
  681. if (this._mixTexture1 && this._mixTexture1.animations && this._mixTexture1.animations.length > 0) {
  682. results.push(this._mixTexture1);
  683. }
  684. if (this._mixTexture2 && this._mixTexture2.animations && this._mixTexture2.animations.length > 0) {
  685. results.push(this._mixTexture2);
  686. }
  687. return results;
  688. };
  689. MixMaterial.prototype.getActiveTextures = function () {
  690. var activeTextures = _super.prototype.getActiveTextures.call(this);
  691. // Mix map 1
  692. if (this._mixTexture1) {
  693. activeTextures.push(this._mixTexture1);
  694. }
  695. if (this._diffuseTexture1) {
  696. activeTextures.push(this._diffuseTexture1);
  697. }
  698. if (this._diffuseTexture2) {
  699. activeTextures.push(this._diffuseTexture2);
  700. }
  701. if (this._diffuseTexture3) {
  702. activeTextures.push(this._diffuseTexture3);
  703. }
  704. if (this._diffuseTexture4) {
  705. activeTextures.push(this._diffuseTexture4);
  706. }
  707. // Mix map 2
  708. if (this._mixTexture2) {
  709. activeTextures.push(this._mixTexture2);
  710. }
  711. if (this._diffuseTexture5) {
  712. activeTextures.push(this._diffuseTexture5);
  713. }
  714. if (this._diffuseTexture6) {
  715. activeTextures.push(this._diffuseTexture6);
  716. }
  717. if (this._diffuseTexture7) {
  718. activeTextures.push(this._diffuseTexture7);
  719. }
  720. if (this._diffuseTexture8) {
  721. activeTextures.push(this._diffuseTexture8);
  722. }
  723. return activeTextures;
  724. };
  725. MixMaterial.prototype.hasTexture = function (texture) {
  726. if (_super.prototype.hasTexture.call(this, texture)) {
  727. return true;
  728. }
  729. // Mix map 1
  730. if (this._mixTexture1 === texture) {
  731. return true;
  732. }
  733. if (this._diffuseTexture1 === texture) {
  734. return true;
  735. }
  736. if (this._diffuseTexture2 === texture) {
  737. return true;
  738. }
  739. if (this._diffuseTexture3 === texture) {
  740. return true;
  741. }
  742. if (this._diffuseTexture4 === texture) {
  743. return true;
  744. }
  745. // Mix map 2
  746. if (this._mixTexture2 === texture) {
  747. return true;
  748. }
  749. if (this._diffuseTexture5 === texture) {
  750. return true;
  751. }
  752. if (this._diffuseTexture6 === texture) {
  753. return true;
  754. }
  755. if (this._diffuseTexture7 === texture) {
  756. return true;
  757. }
  758. if (this._diffuseTexture8 === texture) {
  759. return true;
  760. }
  761. return false;
  762. };
  763. MixMaterial.prototype.dispose = function (forceDisposeEffect) {
  764. if (this._mixTexture1) {
  765. this._mixTexture1.dispose();
  766. }
  767. _super.prototype.dispose.call(this, forceDisposeEffect);
  768. };
  769. MixMaterial.prototype.clone = function (name) {
  770. var _this = this;
  771. return babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Clone(function () { return new MixMaterial(name, _this.getScene()); }, this);
  772. };
  773. MixMaterial.prototype.serialize = function () {
  774. var serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Serialize(this);
  775. serializationObject.customType = "BABYLON.MixMaterial";
  776. return serializationObject;
  777. };
  778. MixMaterial.prototype.getClassName = function () {
  779. return "MixMaterial";
  780. };
  781. // Statics
  782. MixMaterial.Parse = function (source, scene, rootUrl) {
  783. return babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Parse(function () { return new MixMaterial(source.name, scene); }, source, scene, rootUrl);
  784. };
  785. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  786. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("mixTexture1")
  787. ], MixMaterial.prototype, "_mixTexture1", void 0);
  788. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  789. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  790. ], MixMaterial.prototype, "mixTexture1", void 0);
  791. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  792. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("mixTexture2")
  793. ], MixMaterial.prototype, "_mixTexture2", void 0);
  794. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  795. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  796. ], MixMaterial.prototype, "mixTexture2", void 0);
  797. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  798. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("diffuseTexture1")
  799. ], MixMaterial.prototype, "_diffuseTexture1", void 0);
  800. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  801. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  802. ], MixMaterial.prototype, "diffuseTexture1", void 0);
  803. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  804. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("diffuseTexture2")
  805. ], MixMaterial.prototype, "_diffuseTexture2", void 0);
  806. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  807. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  808. ], MixMaterial.prototype, "diffuseTexture2", void 0);
  809. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  810. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("diffuseTexture3")
  811. ], MixMaterial.prototype, "_diffuseTexture3", void 0);
  812. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  813. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  814. ], MixMaterial.prototype, "diffuseTexture3", void 0);
  815. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  816. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("diffuseTexture4")
  817. ], MixMaterial.prototype, "_diffuseTexture4", void 0);
  818. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  819. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  820. ], MixMaterial.prototype, "diffuseTexture4", void 0);
  821. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  822. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("diffuseTexture1")
  823. ], MixMaterial.prototype, "_diffuseTexture5", void 0);
  824. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  825. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  826. ], MixMaterial.prototype, "diffuseTexture5", void 0);
  827. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  828. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("diffuseTexture2")
  829. ], MixMaterial.prototype, "_diffuseTexture6", void 0);
  830. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  831. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  832. ], MixMaterial.prototype, "diffuseTexture6", void 0);
  833. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  834. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("diffuseTexture3")
  835. ], MixMaterial.prototype, "_diffuseTexture7", void 0);
  836. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  837. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  838. ], MixMaterial.prototype, "diffuseTexture7", void 0);
  839. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  840. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsTexture"])("diffuseTexture4")
  841. ], MixMaterial.prototype, "_diffuseTexture8", void 0);
  842. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  843. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsTexturesDirty")
  844. ], MixMaterial.prototype, "diffuseTexture8", void 0);
  845. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  846. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  847. ], MixMaterial.prototype, "diffuseColor", void 0);
  848. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  849. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serializeAsColor3"])()
  850. ], MixMaterial.prototype, "specularColor", void 0);
  851. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  852. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
  853. ], MixMaterial.prototype, "specularPower", void 0);
  854. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  855. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("disableLighting")
  856. ], MixMaterial.prototype, "_disableLighting", void 0);
  857. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  858. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsLightsDirty")
  859. ], MixMaterial.prototype, "disableLighting", void 0);
  860. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  861. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])("maxSimultaneousLights")
  862. ], MixMaterial.prototype, "_maxSimultaneousLights", void 0);
  863. tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"]([
  864. Object(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["expandToProperty"])("_markAllSubMeshesAsLightsDirty")
  865. ], MixMaterial.prototype, "maxSimultaneousLights", void 0);
  866. return MixMaterial;
  867. }(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["PushMaterial"]));
  868. babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["_TypeStore"].RegisteredTypes["BABYLON.MixMaterial"] = MixMaterial;
  869. /***/ }),
  870. /***/ "babylonjs/Misc/decorators":
  871. /*!****************************************************************************************************!*\
  872. !*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
  873. \****************************************************************************************************/
  874. /*! no static exports found */
  875. /***/ (function(module, exports) {
  876. module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__;
  877. /***/ })
  878. /******/ });
  879. });
  880. //# sourceMappingURL=babylon.mixMaterial.js.map