babylon.mixMaterial.js 54 KB

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