

!function (u) {

    // var e = arequire("../@babel/runtime/helpers/assertThisInitialized"),
    //     a = arequire("../@babel/runtime/helpers/set"),
    //     t = arequire("../@babel/runtime/helpers/typeof"),
    //     n = arequire("../@babel/runtime/helpers/get"),
    //     i = arequire("../@babel/runtime/helpers/getPrototypeOf"),
    //     r = arequire("../@babel/runtime/helpers/inherits"),
    //     o = arequire("../@babel/runtime/helpers/createSuper"),
    //     s = arequire("../@babel/runtime/helpers/createClass"),
    //     l = arequire("../@babel/runtime/helpers/classCallCheck");

    //#region 折叠代码
    Array.prototype.includes || Object.defineProperty(Array.prototype, "includes", {
        value: function (r, e) {
            if (null == this) throw new TypeError('"this" is null or not defined');
            var t = Object(this), n = t.length >>> 0;
            if (0 == n) return !1;
            for (var i, o, a = 0 | e, u = Math.max(0 <= a ? a : n - Math.abs(a), 0); u < n;) {
                if ((i = t[u]) === (o = r) || "number" == typeof i && "number" == typeof o && isNaN(i) && isNaN(o)) return !0;
                u++;
            }
            return !1;
        }
    });

    function _arrayLikeToArray2(r, a) {
        (null == a || a > r.length) && (a = r.length);
        for (var e = 0, n = new Array(a); e < a; e++) n[e] = r[e];
        return n;
    }

    function _arrayWithHoles2(r) {
        if (Array.isArray(r)) return r;
    }

    function _arrayWithoutHoles2(r) {
        if (Array.isArray(r)) return _arrayLikeToArray2(r);
    }

    function _assertThisInitialized2(e) {
        if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
        return e;
    }

    function _classCallCheck2(a, l) {
        if (!(a instanceof l)) throw new TypeError("Cannot call a class as a function");
    }

    function _construct2(t, e, r) {
        return _isNativeReflectConstruct2() ? /**/_construct2 = Reflect.construct : /**/_construct2 = function (t, e, r) {
            var o = [null];
            o.push.apply(o, e);
            var c = new (Function.bind.apply(t, o))();
            return r && _setPrototypeOf2(c, r.prototype), c;
        }, _construct2.apply(null, arguments);
    }

    function _defineProperties2(e, r) {
        for (var t = 0; t < r.length; t++) {
            var n = r[t];
            n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0),
                Object.defineProperty(e, n.key, n);
        }
    }

    function _createClass2(e, r, t) {
        return r && _defineProperties2(e.prototype, r), t && _defineProperties2(e, t), e;
    }

    function _createForOfIteratorHelper2(r, e) {
        var t;
        if ("undefined" == typeof Symbol || null == r[Symbol.iterator]) {
            if (Array.isArray(r) || (t = _unsupportedIterableToArray2(r)) || e && r && "number" == typeof r.length) {
                t && (r = t);
                var n = 0, o = function () { };
                return {
                    s: o,
                    n: function () {
                        return n >= r.length ? {
                            done: !0
                        } : {
                            done: !1,
                            value: r[n++]
                        };
                    },
                    e: function (r) {
                        throw r;
                    },
                    f: o
                };
            }
            throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
        }
        var a, u = !0, i = !1;
        return {
            s: function () {
                t = r[Symbol.iterator]();
            },
            n: function () {
                var r = t.next();
                return u = r.done, r;
            },
            e: function (r) {
                i = !0, a = r;
            },
            f: function () {
                try {
                    u || null == t.return || t.return();
                } finally {
                    if (i) throw a;
                }
            }
        };
    }

    function _createSuper2(t) {
        var e = _isNativeReflectConstruct2();
        return function () {
            var r, o = _getPrototypeOf2(t);
            if (e) {
                var s = _getPrototypeOf2(this).constructor;
                r = Reflect.construct(o, arguments, s);
            } else r = o.apply(this, arguments);
            return _possibleConstructorReturn2(this, r);
        };
    }

    function _defineProperty2(e, r, n) {
        return r in e ? Object.defineProperty(e, r, {
            value: n,
            enumerable: !0,
            configurable: !0,
            writable: !0
        }) : e[r] = n, e;
    }

    function _get2(e, t, r) {
        return "undefined" != typeof Reflect && Reflect.get ? /**/_get2 = Reflect.get : /**/_get2 = function (e, t, r) {
            var o = _superPropBase2(e, t);
            if (o) {
                var u = Object.getOwnPropertyDescriptor(o, t);
                return u.get ? u.get.call(r) : u.value;
            }
        }, _get2(e, t, r || e);
    }

    function _getPrototypeOf2(t) {
        return /**/_getPrototypeOf2 = Object.setPrototypeOf ? Object.getPrototypeOf : function (t) {
            return t.__proto__ || Object.getPrototypeOf(t);
        }, _getPrototypeOf2(t);
    }

    function _inherits2(e, t) {
        if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
        e.prototype = Object.create(t && t.prototype, {
            constructor: {
                value: e,
                writable: !0,
                configurable: !0
            }
        }), t && _setPrototypeOf2(e, t);
    }

    function _interopRequireDefault(e) {
        return e && e.__esModule ? e : {
            default: e
        };
    }

    function _isNativeReflectConstruct2() {
        if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
        if (Reflect.construct.sham) return !1;
        if ("function" == typeof Proxy) return !0;
        try {
            return Date.prototype.toString.call(Reflect.construct(Date, [], function () { })),
                !0;
        } catch (t) {
            return !1;
        }
    }

    function _iterableToArray2(r) {
        if ("undefined" != typeof Symbol && Symbol.iterator in Object(r)) return Array.from(r);
    }

    function _iterableToArrayLimit2(r, t) {
        if ("undefined" != typeof Symbol && Symbol.iterator in Object(r)) {
            var e = [], i = !0, o = !1, l = void 0;
            try {
                for (var n, a = r[Symbol.iterator](); !(i = (n = a.next()).done) && (e.push(n.value),
                    !t || e.length !== t); i = !0);
            } catch (r) {
                o = !0, l = r;
            } finally {
                try {
                    i || null == a.return || a.return();
                } finally {
                    if (o) throw l;
                }
            }
            return e;
        }
    }

    function _nonIterableRest2() {
        throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }

    function _nonIterableSpread2() {
        throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }

    function _possibleConstructorReturn2(e, t) {
        return !t || "object" !== _typeof2(t) && "function" != typeof t ? _assertThisInitialized2(e) : t;
    }

    function set(e, r, t, i) {
        return (set = "undefined" != typeof Reflect && Reflect.set ? Reflect.set : function (e, r, t, i) {
            var n, o = _superPropBase2(e, r);
            if (o) {
                if ((n = Object.getOwnPropertyDescriptor(o, r)).set) return n.set.call(i, t), !0;
                if (!n.writable) return !1;
            }
            if (n = Object.getOwnPropertyDescriptor(i, r)) {
                if (!n.writable) return !1;
                n.value = t, Object.defineProperty(i, r, n);
            } else _defineProperty2(i, r, t);
            return !0;
        })(e, r, t, i);
    }

    function _set2(e, r, t, i, n) {
        if (!set(e, r, t, i || e) && n) throw new Error("failed to set property");
        return t;
    }

    function _setPrototypeOf2(t, o) {
        return /**/_setPrototypeOf2 = Object.setPrototypeOf || function (t, o) {
            return t.__proto__ = o, t;
        }, _setPrototypeOf2(t, o);
    }

    function _slicedToArray2(r, e) {
        return _arrayWithHoles2(r) || _iterableToArrayLimit2(r, e) || _unsupportedIterableToArray2(r, e) || _nonIterableRest2();
    }

    function _superPropBase2(e, r) {
        for (; !Object.prototype.hasOwnProperty.call(e, r) && null !== (e = _getPrototypeOf2(e)););
        return e;
    }

    function _toConsumableArray2(r) {
        return _arrayWithoutHoles2(r) || _iterableToArray2(r) || _unsupportedIterableToArray2(r) || nonIterableSpread();
    }

    function _typeof2(o) {
        return "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? /**/_typeof2 = function (o) {
            return typeof o;
        } : /**/_typeof2 = function (o) {
            return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
        }, _typeof2(o);
    }

    function _unsupportedIterableToArray2(r, e) {
        if (r) {
            if ("string" == typeof r) return _arrayLikeToArray2(r, e);
            var t = Object.prototype.toString.call(r).slice(8, -1);
            return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray2(r, e) : void 0;
        }
    }

    var _regeneratorRequire;

    !function (t) {
        "use strict";
        _regeneratorRequire = {}
        var r, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol :
            {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator",
            c = o.toStringTag || "@@toStringTag", u = "object" == typeof module,
            h = t.regeneratorRuntime;
        if (h) u && (_regeneratorRequire = h);
        else {
            (h = t.regeneratorRuntime = _regeneratorRequire).wrap = w;
            var f = "suspendedStart", s = "suspendedYield", l = "executing", p = "completed", y = {}, v = {};
            v[i] = function () {
                return this;
            };
            var d = Object.getPrototypeOf, g = d && d(d(P([])));
            g && g !== e && n.call(g, i) && (v = g);
            var m = b.prototype = x.prototype = Object.create(v);
            E.prototype = m.constructor = b, b.constructor = E, b[c] = E.displayName = "GeneratorFunction",
                h.isGeneratorFunction = function (t) {
                    var r = "function" == typeof t && t.constructor;
                    return !!r && (r === E || "GeneratorFunction" === (r.displayName || r.name));
                }, h.mark = function (t) {
                    return Object.setPrototypeOf ? Object.setPrototypeOf(t, b) : (t.__proto__ = b, c in t || (t[c] = "GeneratorFunction")),
                        t.prototype = Object.create(m), t;
                }, h.awrap = function (t) {
                    return {
                        __await: t
                    };
                }, _(j.prototype), j.prototype[a] = function () {
                    return this;
                }, h.AsyncIterator = j, h.async = function (t, r, e, n) {
                    var o = new j(w(t, r, e, n));
                    return h.isGeneratorFunction(r) ? o : o.next().then(function (t) {
                        return t.done ? t.value : o.next();
                    });
                }, _(m), m[c] = "Generator", m[i] = function () {
                    return this;
                }, m.toString = function () {
                    return "[object Generator]";
                }, h.keys = function (t) {
                    var r = [];
                    for (var e in t) r.push(e);
                    return r.reverse(), function e() {
                        for (; r.length;) {
                            var n = r.pop();
                            if (n in t) return e.value = n, e.done = !1, e;
                        }
                        return e.done = !0, e;
                    };
                }, h.values = P, N.prototype = {
                    constructor: N,
                    reset: function (t) {
                        if (this.prev = 0, this.next = 0, this.sent = this._sent = r, this.done = !1, this.delegate = null,
                            this.method = "next", this.arg = r, this.tryEntries.forEach(G), !t) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = r);
                    },
                    stop: function () {
                        this.done = !0;
                        var t = this.tryEntries[0].completion;
                        if ("throw" === t.type) throw t.arg;
                        return this.rval;
                    },
                    dispatchException: function (t) {
                        if (this.done) throw t;
                        var e = this;
                        function o(n, o) {
                            return c.type = "throw", c.arg = t, e.next = n, o && (e.method = "next", e.arg = r),
                                !!o;
                        }
                        for (var i = this.tryEntries.length - 1; i >= 0; --i) {
                            var a = this.tryEntries[i], c = a.completion;
                            if ("root" === a.tryLoc) return o("end");
                            if (a.tryLoc <= this.prev) {
                                var u = n.call(a, "catchLoc"), h = n.call(a, "finallyLoc");
                                if (u && h) {
                                    if (this.prev < a.catchLoc) return o(a.catchLoc, !0);
                                    if (this.prev < a.finallyLoc) return o(a.finallyLoc);
                                } else if (u) {
                                    if (this.prev < a.catchLoc) return o(a.catchLoc, !0);
                                } else {
                                    if (!h) throw new Error("try statement without catch or finally");
                                    if (this.prev < a.finallyLoc) return o(a.finallyLoc);
                                }
                            }
                        }
                    },
                    abrupt: function (t, r) {
                        for (var e = this.tryEntries.length - 1; e >= 0; --e) {
                            var o = this.tryEntries[e];
                            if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
                                var i = o;
                                break;
                            }
                        }
                        i && ("break" === t || "continue" === t) && i.tryLoc <= r && r <= i.finallyLoc && (i = null);
                        var a = i ? i.completion : {};
                        return a.type = t, a.arg = r, i ? (this.method = "next", this.next = i.finallyLoc,
                            y) : this.complete(a);
                    },
                    complete: function (t, r) {
                        if ("throw" === t.type) throw t.arg;
                        return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg,
                            this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r),
                            y;
                    },
                    finish: function (t) {
                        for (var r = this.tryEntries.length - 1; r >= 0; --r) {
                            var e = this.tryEntries[r];
                            if (e.finallyLoc === t) return this.complete(e.completion, e.afterLoc), G(e), y;
                        }
                    },
                    catch: function (t) {
                        for (var r = this.tryEntries.length - 1; r >= 0; --r) {
                            var e = this.tryEntries[r];
                            if (e.tryLoc === t) {
                                var n = e.completion;
                                if ("throw" === n.type) {
                                    var o = n.arg;
                                    G(e);
                                }
                                return o;
                            }
                        }
                        throw new Error("illegal catch attempt");
                    },
                    delegateYield: function (t, e, n) {
                        return this.delegate = {
                            iterator: P(t),
                            resultName: e,
                            nextLoc: n
                        }, "next" === this.method && (this.arg = r), y;
                    }
                };
        }
        function w(t, r, e, n) {
            var o = r && r.prototype instanceof x ? r : x, i = Object.create(o.prototype), a = new N(n || []);
            return i._invoke = function (t, r, e) {
                var n = f;
                return function (o, i) {
                    if (n === l) throw new Error("Generator is already running");
                    if (n === p) {
                        if ("throw" === o) throw i;
                        return F();
                    }
                    for (e.method = o, e.arg = i; ;) {
                        var a = e.delegate;
                        if (a) {
                            var c = O(a, e);
                            if (c) {
                                if (c === y) continue;
                                return c;
                            }
                        }
                        if ("next" === e.method) e.sent = e._sent = e.arg; else if ("throw" === e.method) {
                            if (n === f) throw n = p, e.arg;
                            e.dispatchException(e.arg);
                        } else "return" === e.method && e.abrupt("return", e.arg);
                        n = l;
                        var u = L(t, r, e);
                        if ("normal" === u.type) {
                            if (n = e.done ? p : s, u.arg === y) continue;
                            return {
                                value: u.arg,
                                done: e.done
                            };
                        }
                        "throw" === u.type && (n = p, e.method = "throw", e.arg = u.arg);
                    }
                };
            }(t, e, a), i;
        }
        function L(t, r, e) {
            try {
                return {
                    type: "normal",
                    arg: t.call(r, e)
                };
            } catch (t) {
                return {
                    type: "throw",
                    arg: t
                };
            }
        }
        function x() { }
        function E() { }
        function b() { }
        function _(t) {
            ["next", "throw", "return"].forEach(function (r) {
                t[r] = function (t) {
                    return this._invoke(r, t);
                };
            });
        }
        function j(t) {
            var r;
            this._invoke = function (e, o) {
                function i() {
                    return new Promise(function (r, i) {
                        !function r(e, o, i, a) {
                            var c = L(t[e], t, o);
                            if ("throw" !== c.type) {
                                var u = c.arg, h = u.value;
                                return h && "object" == typeof h && n.call(h, "__await") ? Promise.resolve(h.__await).then(function (t) {
                                    r("next", t, i, a);
                                }, function (t) {
                                    r("throw", t, i, a);
                                }) : Promise.resolve(h).then(function (t) {
                                    u.value = t, i(u);
                                }, function (t) {
                                    return r("throw", t, i, a);
                                });
                            }
                            a(c.arg);
                        }(e, o, r, i);
                    });
                }
                return r = r ? r.then(i, i) : i();
            };
        }
        function O(t, e) {
            var n = t.iterator[e.method];
            if (n === r) {
                if (e.delegate = null, "throw" === e.method) {
                    if (t.iterator.return && (e.method = "return", e.arg = r, O(t, e), "throw" === e.method)) return y;
                    e.method = "throw", e.arg = new TypeError("The iterator does not provide a 'throw' method");
                }
                return y;
            }
            var o = L(n, t.iterator, e.arg);
            if ("throw" === o.type) return e.method = "throw", e.arg = o.arg, e.delegate = null,
                y;
            var i = o.arg;
            return i ? i.done ? (e[t.resultName] = i.value, e.next = t.nextLoc, "return" !== e.method && (e.method = "next",
                e.arg = r), e.delegate = null, y) : i : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"),
                    e.delegate = null, y);
        }
        function k(t) {
            var r = {
                tryLoc: t[0]
            };
            1 in t && (r.catchLoc = t[1]), 2 in t && (r.finallyLoc = t[2], r.afterLoc = t[3]),
                this.tryEntries.push(r);
        }
        function G(t) {
            var r = t.completion || {};
            r.type = "normal", delete r.arg, t.completion = r;
        }
        function N(t) {
            this.tryEntries = [{
                tryLoc: "root"
            }], t.forEach(k, this), this.reset(!0);
        }
        function P(t) {
            if (t) {
                var e = t[i];
                if (e) return e.call(t);
                if ("function" == typeof t.next) return t;
                if (!isNaN(t.length)) {
                    var o = -1, a = function e() {
                        for (; ++o < t.length;) if (n.call(t, o)) return e.value = t[o], e.done = !1, e;
                        return e.value = r, e.done = !0, e;
                    };
                    return a.next = a;
                }
            }
            return {
                next: F
            };
        }
        function F() {
            return {
                value: r,
                done: !0
            };
        }
    }(function () {
        return this || "object" == typeof self && self;
    });

    var _regenerator = _interopRequireDefault(_regeneratorRequire);
    //#endregion

    var e = _assertThisInitialized2,
        a = _set2,
        t = _typeof2,
        n = _get2,
        i = _getPrototypeOf2,
        r = _inherits2,
        o = _createSuper2,
        s = _createClass2,
        l = _classCallCheck2;

    var h;
    !function (e) {
        e[e.Unset = 0] = "Unset", e[e.Linear = 1] = "Linear", e[e.InSine = 2] = "InSine",
            e[e.OutSine = 3] = "OutSine", e[e.InOutSine = 4] = "InOutSine", e[e.InQuad = 5] = "InQuad",
            e[e.OutQuad = 6] = "OutQuad", e[e.InOutQuad = 7] = "InOutQuad", e[e.InCubic = 8] = "InCubic",
            e[e.OutCubic = 9] = "OutCubic", e[e.InOutCubic = 10] = "InOutCubic", e[e.InQuart = 11] = "InQuart",
            e[e.OutQuart = 12] = "OutQuart", e[e.InOutQuart = 13] = "InOutQuart", e[e.InQuint = 14] = "InQuint",
            e[e.OutQuint = 15] = "OutQuint", e[e.InOutQuint = 16] = "InOutQuint", e[e.InExpo = 17] = "InExpo",
            e[e.OutExpo = 18] = "OutExpo", e[e.InOutExpo = 19] = "InOutExpo", e[e.InCirc = 20] = "InCirc",
            e[e.OutCirc = 21] = "OutCirc", e[e.InOutCirc = 22] = "InOutCirc", e[e.InElastic = 23] = "InElastic",
            e[e.OutElastic = 24] = "OutElastic", e[e.InOutElastic = 25] = "InOutElastic", e[e.InBack = 26] = "InBack",
            e[e.OutBack = 27] = "OutBack", e[e.InOutBack = 28] = "InOutBack", e[e.InBounce = 29] = "InBounce",
            e[e.OutBounce = 30] = "OutBounce", e[e.InOutBounce = 31] = "InOutBounce", e[e.Flash = 32] = "Flash",
            e[e.InFlash = 33] = "InFlash", e[e.OutFlash = 34] = "OutFlash", e[e.InOutFlash = 35] = "InOutFlash",
            e[e.INTERNAL_Zero = 36] = "INTERNAL_Zero", e[e.INTERNAL_Custom = 37] = "INTERNAL_Custom";
    }(h || (h = {}));
    var d, _ = Object.freeze({
        __proto__: null,
        get Ease() {
            return h;
        }
    }), c = Object.freeze({
        __proto__: null
    }), E = Object.freeze({
        __proto__: null
    });
    !function (e) {
        e[e.user = 0] = "user", e[e.privacy = 1] = "privacy";
    }(d || (d = {}));
    var S, f = Object.freeze({
        __proto__: null,
        get ProtocolContentType() {
            return d;
        }
    }), L = Object.freeze({
        __proto__: null
    }), D = Object.freeze({
        __proto__: null
    }), T = s(function e() {
        l(this, e);
    });
    T.None = 0, T.VivoQG = T.None + 1, T.OppoQG = T.VivoQG + 1, T.TT = T.OppoQG + 1,
        T.MP = T.TT + 1, T.QQMiniGame = T.MP + 1, T.HWMiniGame = T.QQMiniGame + 1, T.android = T.HWMiniGame + 1;
    var y = function () {
        function e() {
            l(this, e), this.useHttps = !0, this.needServices = [I.ISDKConfig], this.mAdRate = {},
                this._isPingbi = !0;
        }
        return s(e, [{
            key: "onServiceSet",
            value: function (e) {
                this.sdkConfig = e;
            }
        }, {
            key: "isPingbi",
            get: function () {
                return this._isPingbi;
            }
        }, {
            key: "setPingbi",
            value: function (e) {
                this._isPingbi = e;
            }
        }, {
            key: "init",
            value: function (e, a, t) {
                var n = this;
                R.init(this.sdkConfig.GameId, this.sdkConfig.APIVersion, this.useHttps, e);
                var i = 3, r = function () {
                    --i <= 0 && a && (a(), a = null);
                };
                TY.LayaCore.Server.GameServer.login(function () {
                    r();
                }, t), TY.LayaCore.Server.GameServer.isPinBi(function (e) {
                    e = 1;
                    n._isPingbi = 1 == e, r()/*, console.log("屏蔽地区：", n.isPingbi)*/;
                }), TY.LayaCore.Server.GameServer.getAdRate(function (e) {
                    for (var a = 0; a < e.length; a++) {
                        var t = e[a];
                        n.mAdRate[t.key] = t.rate;
                    }
                    console.log("后台参数:", e), r();
                });
            }
        }, {
            key: "getAdRate",
            value: function (e) {
                return this.mAdRate[e];
            }
        }]), e;
    }(), R = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "createOpenId",
            value: function () {
                return new Date().getTime() + "" + Math.ceil(1e4 * Math.random());
            }
        }, {
            key: "init",
            value: function (e, a) {
                var t = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "";
                this.httpRoot = t ? "https://wxxcx.tanyu.mobi:4443" : "http://wxxcx.tanyu.mobi:8082",
                    this.serVersion = a, this.mGameId = e, n || (n = Laya.LocalStorage.getItem("__GAME_USER_OPENID")) && 0 != n.length || (n = this.createOpenId()),
                    this.openId = n, Laya.LocalStorage.setItem("__GAME_USER_OPENID", n);
            }
        }, {
            key: "httpDefaultGet",
            value: function (e, a, t) {
                var n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null;
                this.httpGet(e, Object.assign(Object.assign({}, a), {
                    version: this.serVersion
                }), t, n);
            }
        }, {
            key: "httpGet",
            value: function (e, a, t) {
                var n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null, i = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 2e3, r = "".concat(this.httpRoot, "/").concat(e, "?gameId=").concat(this.mGameId);
                if (a) for (var o in a) r += "&".concat(o, "=").concat(a[o]);
                var s = new Laya.HttpRequest();
                s.http.timeout = i, s.once(Laya.Event.ERROR, this, function (e) {
                    n && n(e);
                }), s.once(Laya.Event.COMPLETE, this, function (e) {
                    null != e ? t && t(e) : console.error("请求服务数据失败:", e, "url=" + r);
                }), s.send(r, null, "get", "json");
            }
        }, {
            key: "autoErrHttpGet",
            value: function (e, a, t) {
                this.httpDefaultGet(e, a, t, function (e) {
                    console.warn("请求失败", e), t && t(null);
                });
            }
        }, {
            key: "login",
            value: function (e) {
                var a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
                this.autoErrHttpGet("admin/api/login", {
                    openId: this.openId,
                    channel_id: a
                }, function (a) {
                    e && e();
                });
            }
        }, {
            key: "isPinBi",
            value: function (e) {
                this.autoErrHttpGet("admin/api/isPinbi", null, e);
            }
        }, {
            key: "getWxOpenId",
            value: function (e, a) {
                this.autoErrHttpGet("admin/api/getopenid", {
                    code: e
                }, function (e) {
                    a && a(e);
                });
            }
        }, {
            key: "getAdRate",
            value: function (e) {
                this.autoErrHttpGet("admin/api/adrate2", null, function (a) {
                    var t = null;
                    if (a && a.rateJson) try {
                        t = JSON.parse(a.rateJson);
                    } catch (e) { }
                    e && e(t);
                });
            }
        }, {
            key: "ovRate",
            value: function (e, a, t) {
                this.autoErrHttpGet("admin/api/ovrate", {
                    adid: e,
                    type: a
                }, t);
            }
        }, {
            key: "ovShowAdRate",
            value: function (e, a) {
                this.ovRate(e, "show", a);
            }
        }, {
            key: "ovCanClickAdRate",
            value: function (e, a) {
                this.ovRate(e, "canclick", a);
            }
        }, {
            key: "ovClickAd",
            value: function (e, a) {
                this.ovRate(e, "click", a);
            }
        }]), e;
    }();
    R.httpRoot = "", R.mGameId = "", R.serVersion = "";
    var m = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "UMA",
            get: function () {
                switch (this.channelId) {
                    case T.VivoQG:
                    case T.OppoQG:
                        return qg.uma;

                    case T.TT:
                        return tt.uma;

                    case T.MP:
                        return wx.uma;

                    case T.QQMiniGame:
                        return qq.uma;

                    case T.HWMiniGame:
                        return qg.uma;

                    case T.android:
                        return wx.uma;
                }
            }
        }, {
            key: "callUMAFunc",
            value: function (e) {
                for (var a, t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++) n[i - 1] = arguments[i];
                this.UMA && this.UMA[e] && (a = this.UMA)[e].apply(a, n);
            }
        }, {
            key: "init",
            value: function (e) {
                this.channelId = e;
            }
        }, {
            key: "setOpenId",
            value: function (e) {
                this.callUMAFunc("setOpenid", e);
            }
        }, {
            key: "report",
            value: function (e, a) {
                this.callUMAFunc("trackEvent", e, a);
            }
        }]), e;
    }(), g = function () {
        function e() {
            l(this, e), this.useUMA = !1, this.needServices = [I.ISDKModel, I.ISDKConfig];
        }
        return s(e, [{
            key: "onServiceSet",
            value: function (e, a) {
                this.sdkConfig = a, this.sdkModel = e;
            }
        }, {
            key: "init",
            value: function (e) {
                this.sdkModel && this.sdkModel.init(R.createOpenId(), e), this.useUMA && m.init(this.channel);
            }
        }, {
            key: "showInsert",
            value: function (e, a) { }
        }, {
            key: "showVideo",
            value: function (e, a) { }
        }, {
            key: "showBanner",
            value: function (e, a) { }
        }, {
            key: "hideBanner",
            value: function () { }
        }, {
            key: "setVibrate",
            value: function (e) { }
        }, {
            key: "showToast",
            value: function (e) { }
        }, {
            key: "loadFont",
            value: function (e) { }
        }, {
            key: "report",
            value: function (e, a) {
                this.useUMA && m.report(e, a);
            }
        }, {
            key: "exit",
            value: function (e) { }
        }]), e;
    }();
    !function (e) {
        e.Start = "Start", e.Loading = "Loading", e.Complete = "Complete", e.Guide = "Guide",
            e.Battle = "Battle", e.periphery = "periphery", e.Video_request = "Video_request",
            e.Video_success = "Video_success";
    }(S || (S = {}));
    var p = Object.freeze({
        __proto__: null,
        SDKChannel: T,
        SDKConfigBase: s(function e() {
            l(this, e),
                this.GameId = "826",
                this.APIVersion = "1.0.1", this.AppID = "", this.VideoAdPos = "";
        }),
        SDKModelBase: y,
        SDKMgrBase: g,
        MoveTask: function () {
            function e(a, t, n) {
                l(this, e), this.obj = a, this.delay = t, this.moveDistance = n;
            }
            return s(e, [{
                key: "onStart",
                value: function () {
                    this.obj.touchable = !1, this.obj.y += this.moveDistance;
                }
            }, {
                key: "onCompleted",
                value: function () {
                    this.obj.touchable = !0, this.obj.y -= this.moveDistance;
                }
            }, {
                key: "start",
                value: function () {
                    return this.onStart(), new TY.Task.DelayTask(this.delay, this.onCompleted.bind(this)).run(TY.LayaCore.Services.StandardSchedulers.standardScheduler),
                        this;
                }
            }]), e;
        }(),
        DelayShowTask: function () {
            function e(a, t) {
                l(this, e), this.obj = a, this.delay = t, this.obj.visible = !1, this.task = new TY.Task.DelayTask(this.delay, this.completed.bind(this));
            }
            return s(e, [{
                key: "run",
                value: function () {
                    return this.task.run(TY.LayaCore.Services.StandardSchedulers.standardScheduler),
                        this;
                }
            }, {
                key: "kill",
                value: function () {
                    return this.task.stop(), this;
                }
            }, {
                key: "completed",
                value: function () {
                    this.obj.visible = !0;
                }
            }]), e;
        }(),
        get ReportEventType() {
            return S;
        }
    }), I = s(function e() {
        l(this, e);
    });
    I.IConfig = "IConfig", I.ITWeen = "ITWeen", I.IResource = "IResource", I.ISceneMgr = "ISceneMgr",
        I.D3SceneRoot = "D3SceneRoot", I.UIRoot = "UIRoot", I.IUIMgr = "IUIMgr", I.ISoundMgr = "ISoundMgr",
        I.ISDK = "ISDK", I.ISDKModel = "ISDKModel", I.ISDKConfig = "ISDKConfig", I.ISDKView = "ISDKView",
        I.IQuickGameBoxUI = "IQuickGameBoxUI", I.IProtocolContentUI = "IProtocolContentUI",
        I.IProtocolBoxUI = "IProtocolBoxUI";
    var P, v = Object.freeze({
        __proto__: null,
        Tween: _,
        Resource: c,
        Scene: E,
        UI: f,
        Sound: D,
        Physics: L,
        SDK: p,
        ServiceType: I
    }), A = function () {
        function e() {
            l(this, e);
        }
        return s(e, [{
            key: "to",
            value: function (e, a, t) {
                return fgui.GTween.to(e, a, t);
            }
        }, {
            key: "to2",
            value: function (e, a, t, n, i) {
                return fgui.GTween.to2(e, a, t, n, i);
            }
        }, {
            key: "to3",
            value: function (e, a, t, n, i, r, o) {
                return fgui.GTween.to3(e, a, t, n, i, r, o);
            }
        }, {
            key: "to4",
            value: function (e, a, t, n, i, r, o, s, l) {
                return fgui.GTween.to4(e, a, t, n, i, r, o, s, l);
            }
        }, {
            key: "toColor",
            value: function (e, a, t) {
                return fgui.GTween.toColor(e, a, t);
            }
        }, {
            key: "delayedCall",
            value: function (e) {
                return fgui.GTween.delayedCall(e);
            }
        }, {
            key: "shake",
            value: function (e, a, t, n) {
                return fgui.GTween.shake(e, a, t, n);
            }
        }, {
            key: "kill",
            value: function (e, a, t) {
                fgui.GTween.kill(e, a, t);
            }
        }, {
            key: "getTween",
            value: function (e, a) {
                return fgui.GTween.getTween(e, a);
            }
        }]), e;
    }(), C = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, [{
            key: "register",
            value: function () {
                n(i(t.prototype), "register", this).call(this), TY.App.singleton(I.ITWeen, A);
            }
        }]), t;
    }(TY.ServiceProvider), O = function () {
        function e() {
            l(this, e), this.curAllRes = new Map();
        }
        return s(e, [{
            key: "loadRes",
            value: function (e, a, t) {
                var n = this;
                if (e instanceof Array) !function () {
                    for (var i, r = e, o = !0, s = 0, l = [], u = 0; u < r.length; u++) {
                        var h, d = r[u];
                        h = "string" == typeof d ? d : d.url, l.push({
                            url: h,
                            progress: 0
                        });
                    }
                    i = l.length;
                    for (var _ = function (e) {
                        var u = r[e], h = void 0, d = !1, _ = null, c = null, E = null;
                        "string" == typeof u ? (h = u, d = !1, d = null, c = null, E = null) : (h = u.url,
                            d = u.isKeepMemory, _ = u.params, c = u.propertyParams, E = u.type);
                        n.loadResForUrl(h, E, d, _, c, function (e) {
                            e || (o = !1), i <= ++s && a && a(o);
                            var t = l.find(function (e) {
                                return e.url == h;
                            });
                            if (t && (t.progress = 1), !o) throw new Error("资源加载失败--" + h);
                        }, function (e) {
                            var a = l.find(function (e) {
                                return e.url == h;
                            }), n = 0;
                            a && (a.progress = e), l.forEach(function (e) {
                                n += e.progress;
                            }), n /= i, t && t(n);
                        });
                    }, c = 0; c < r.length; c++) _(c);
                }(); else if ("string" == typeof e) this.loadResForUrl(e, null, !1, null, null, a, t); else {
                    var i = e;
                    this.loadResForUrl(i.url, i.type, i.isKeepMemory, i.params, i.propertyParams, a, t);
                }
            }
        }, {
            key: "loadResForUrl",
            value: function (e, a, n, i, r, o, s) {
                var l = this, u = this.getRes(e), h = this.curAllRes.has(e) ? this.curAllRes.get(e) : {
                    url: e,
                    isKeepMemory: n,
                    params: i,
                    propertyParams: r,
                    type: a
                };
                h.refCount = h.refCount ? h.refCount + 1 : 1, u ? (u.lock = n, s && s(1), o && o(u)) : Laya.loader.create(h.url, Laya.Handler.create(this, function (e) {
                    l.curAllRes.set(h.url, h), e && "object" == t(e) && (e.lock = n), o && o(e);
                }), new Laya.Handler(this, function (e) {
                    s && s(e);
                }), h.type, h.params, h.propertyParams);
            }
        }, {
            key: "getRes",
            value: function (e) {
                return Laya.loader.getRes(e);
            }
        }, {
            key: "pop",
            value: function (e) {
                var a = this, t = [];
                this.curAllRes.forEach(function (a) {
                    a.refCount--, (e || !a.isKeepMemory && a.refCount <= 1) && t.push(a.url);
                }), t.forEach(function (e) {
                    a.curAllRes.delete(e);
                });
            }
        }, {
            key: "preLoad",
            value: function (e) {
                throw new Error("预加载资源");
            }
        }]), e;
    }(), M = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, [{
            key: "register",
            value: function () {
                n(i(t.prototype), "register", this).call(this), TY.App.singleton(I.IResource, O);
            }
        }]), t;
    }(TY.ServiceProvider), N = function () {
        function e() {
            l(this, e), this.needServices = [I.D3SceneRoot, I.IResource, I.IConfig], this.allScenes = new Map();
        }
        return s(e, [{
            key: "onServiceSet",
            value: function (e, a, t) {
                this.mSceneRoot = e, this.resMgr = a, this.startScene = t.startScene;
            }
        }, {
            key: "sceneRoot",
            get: function () {
                return this.mSceneRoot;
            }
        }, {
            key: "gotoScene",
            value: function (e, a, t, n) {
                var i = this;
                this.curScene && this.curScene.sceneId == e && console.warn("当前场景和要切换的场景一致无法切换");
                var r = this.allScenes.has(e) ? this.allScenes.get(e) : null;
                r ? (this.curScene && this.curScene.sceneSprite && this.curScene.sceneSprite.destroy(),
                    r.loadRes(a, function () {
                        if (i.curScene && i.curScene.onExit(), i.curScene = r, i.curScene.sceneUrl) {
                            var e = i.resMgr.getRes(i.curScene.sceneUrl);
                            e ? (i.sceneRoot.addChild(e), e.active = !0, i.curScene.sceneSprite = e) : console.error("场景加载失败:", i.curScene.sceneUrl);
                        }
                        i.resMgr.pop(), i.curScene.onEnter(a), t && t();
                    }, function (e) {
                        n && n(e);
                    })) : console.error("要进入的场景不存在【".concat(e, "】"));
            }
        }, {
            key: "regScene",
            value: function (e) {
                var a = new e();
                this.allScenes.has(a.sceneId) ? console.warn("注册场景失败【".concat(a.sceneId, "】")) : this.allScenes.set(a.sceneId, a);
            }
        }, {
            key: "start",
            value: function () {
                this.allScenes.has(this.startScene) ? this.gotoScene(this.startScene) : console.warn("开始场景不存在加载失败:", this.startScene);
            }
        }]), e;
    }(), x = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, [{
            key: "register",
            value: function () {
                var e = this;
                n(i(t.prototype), "register", this).call(this), TY.App.singleton(I.ISceneMgr, N).onAfterResolving(function (a, t) {
                    var n = e.app.make(I.IConfig);
                    if (n && n.scnene) for (var i = 0; i < n.scnene.length; i++) {
                        var r = n.scnene[i];
                        t.regScene(r);
                    }
                });
            }
        }]), t;
    }(TY.ServiceProvider), w = function () {
        function e() {
            l(this, e), this.updateRoutines = [], this.lateUpdateRoutines = [], this.fixedUpdateRoutines = [],
                Laya.updateTimer.frameLoop(1, this, this.onUpdate), Laya.physicsTimer.frameLoop(1, this, this.fixedUpdate),
                Laya.lateTimer.frameLoop(1, this, this.lateUpdate);
        }
        return s(e, [{
            key: "onUpdate",
            value: function () {
                var e = .001 * Laya.updateTimer.delta;
                this.executeRoutines(this.updateRoutines, e);
            }
        }, {
            key: "lateUpdate",
            value: function () {
                var e = .001 * Laya.lateTimer.delta;
                this.executeRoutines(this.lateUpdateRoutines, e);
            }
        }, {
            key: "fixedUpdate",
            value: function () {
                var e = .001 * Laya.physicsTimer.delta;
                this.executeRoutines(this.fixedUpdateRoutines, e);
            }
        }, {
            key: "startUpdateCoroutine",
            value: function (e) {
                -1 == this.updateRoutines.indexOf(e) && this.updateRoutines.push(e);
            }
        }, {
            key: "startLateUpdateCoroutine",
            value: function (e) {
                -1 == this.lateUpdateRoutines.indexOf(e) && this.lateUpdateRoutines.push(e);
            }
        }, {
            key: "startFixedUpdateCoroutine",
            value: function (e) {
                -1 == this.fixedUpdateRoutines.indexOf(e) && this.fixedUpdateRoutines.push(e);
            }
        }, {
            key: "executeRoutines",
            value: function (e, a) {
                if (e && e.length > 0) for (var t = 0; t < e.length; t++) e[t].process(a) == TY.Task.Status.Success && (e.splice(t),
                    t--);
            }
        }], [{
            key: "inst",
            get: function () {
                return this.mInst || (this.mInst = new e()), this.mInst;
            }
        }]), e;
    }(), V = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, [{
            key: "waitTime",
            value: function (e, a) {
                var t = new TY.Task.DelayTask(e, a);
                return this.run(t), t;
            }
        }, {
            key: "loop",
            value: function (e, a) {
                var t = new TY.Task.LoopTask(e, a);
                return this.run(t), t;
            }
        }]), t;
    }(TY.Task.Runner), B = function (e) {
        r(t, e);
        var a = o(t);
        function t(e) {
            var n;
            return l(this, t), n = a.call(this), w.inst.startFixedUpdateCoroutine(new TY.Task.Process(e, n.coroutines, n.readyTask, n.flushingOperation)),
                n;
        }
        return s(t);
    }(V), k = function (e) {
        r(t, e);
        var a = o(t);
        function t(e) {
            var n;
            return l(this, t), n = a.call(this), w.inst.startLateUpdateCoroutine(new TY.Task.Process(e, n.coroutines, n.readyTask, n.flushingOperation)),
                n;
        }
        return s(t);
    }(V), b = function (e) {
        r(t, e);
        var a = o(t);
        function t(e) {
            var n;
            return l(this, t), n = a.call(this), w.inst.startUpdateCoroutine(new TY.Task.Process(e, n.coroutines, n.readyTask, n.flushingOperation)),
                n;
        }
        return s(t);
    }(V), H = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "standardScheduler",
            get: function () {
                return this.updateScheduler;
            }
        }, {
            key: "updateScheduler",
            get: function () {
                return this.mUpdateRunner || (this.mUpdateRunner = new b("Standard")), this.mUpdateRunner;
            }
        }, {
            key: "physicScheduler",
            get: function () {
                return this.mFixedUpdateRunner || (this.mFixedUpdateRunner = new B("StandardPhysic")),
                    this.mFixedUpdateRunner;
            }
        }, {
            key: "lateScheduler",
            get: function () {
                return this.mLeteUpdateRunner || (this.mLeteUpdateRunner = new k("StandardPhysic")),
                    this.mLeteUpdateRunner;
            }
        }, {
            key: "killSchedulers",
            value: function () {
                this.mFixedUpdateRunner && this.mFixedUpdateRunner.shutDown(), this.mUpdateRunner && this.mUpdateRunner.shutDown(),
                    this.mLeteUpdateRunner && this.mLeteUpdateRunner.shutDown();
            }
        }, {
            key: "pause",
            value: function (e) {
                this.mFixedUpdateRunner && (this.mFixedUpdateRunner.isPaused = e), this.mUpdateRunner && (this.mUpdateRunner.isPaused = e),
                    this.mLeteUpdateRunner && (this.mLeteUpdateRunner.isPaused = e);
            }
        }, {
            key: "run",
            value: function (e) {
                this.standardScheduler.run(e);
            }
        }]), e;
    }();
    !function (e) {
        e[e.Show = 0] = "Show", e[e.Hide = 1] = "Hide", e[e.Del = 2] = "Del";
    }(P || (P = {}));
    var U = function () {
        function e() {
            l(this, e), this.state = 0, this.type = P.Show;
        }
        return s(e, [{
            key: "setCallback",
            value: function (e) {
                return this.callback = e, this;
            }
        }, {
            key: "setUIData",
            value: function (e, a) {
                return this.url = e, this.data = a, this;
            }
        }, {
            key: "run",
            value: function () {
                if (this.uiWind = e.uiMgr.getUI(this.url), null == this.uiWind) throw "当前UI没有注册" + this.url;
                e.curCMDs.push(this);
            }
        }, {
            key: "restData",
            value: function () {
                this.data = null, this.uiWind = null, this.state = 0, this.url = null, this.callback = null;
            }
        }, {
            key: "del",
            value: function () {
                e.uiMgr.destory(this.uiWind.url), this.state = 2;
            }
        }, {
            key: "show",
            value: function () {
                var a = this, t = e.uiMgr.getUI(this.url);
                t ? t.isShowing ? (t.isTop || t.bringToFront(), this.state = 2, this.callback && (this.callback(),
                    this.callback = null)) : (t.setLoadData(function () {
                        a.callback && (a.callback(), a.callback = null), a.state = 2;
                    }, this.data), t.show()) : this.state = 2;
            }
        }, {
            key: "hide",
            value: function () {
                var a = e.uiMgr.getUI(this.url);
                a && a.isShowing ? (a.setLoadData(null, this.data), a.hide(), this.state = 2) : this.state = 2;
            }
        }], [{
            key: "getCmd",
            value: function (a) {
                var t = this.pools.length > 0 ? this.pools.pop() : null;
                return t || (t = new e()), t.type = a, t;
            }
        }, {
            key: "revertCmd",
            value: function (e) {
                e.restData(), this.pools.push(e);
            }
        }, {
            key: "hasCmd",
            value: function (e, a) {
                return this.curCMDs.find(function (t) {
                    return t.url == e && t.type == a;
                });
            }
        }, {
            key: "init",
            value: function (e) {
                this.uiMgr = e, H.run(new TY.Task.LoopTask(this.onUpdate.bind(this)));
            }
        }, {
            key: "onUpdate",
            value: function () {
                if (!(e.curCMDs.length <= 0)) {
                    var a = e.curCMDs[0];
                    if (0 == a.state) switch (a.state = 1, a.type) {
                        case P.Del:
                            a.del();
                            break;

                        case P.Hide:
                            a.hide();
                            break;

                        case P.Show:
                            a.show();
                    } else if (2 == a.state) {
                        var t = e.curCMDs.shift();
                        t && e.revertCmd(t);
                    }
                }
            }
        }]), e;
    }();
    U.pools = [], U.curCMDs = [];
    var F = function () {
        function e() {
            l(this, e), this.needServices = [I.IConfig, I.UIRoot], this.allUI = new Map();
        }
        return s(e, [{
            key: "onServiceSet",
            value: function (e, a) {
                this.uiConfig = e, this.uiRoot = a, this.mUiPackRootUrl = e.fguiPackRootUrl;
            }
        }, {
            key: "uiPackRootUrl",
            get: function () {
                return this.mUiPackRootUrl;
            }
        }, {
            key: "init",
            value: function () {
                var e = this;
                this.uiRoot.addChild(fgui.GRoot.inst.displayObject), this.uiConfig.uiExtensions && this.uiConfig.uiExtensions.forEach(function (a) {
                    for (var t in a) if (Object.prototype.hasOwnProperty.call(a, t)) {
                        var n = a[t];
                        e.regUIExtension(t, n);
                    }
                }), this.uiConfig.uiClass && this.uiConfig.uiClass.forEach(function (a) {
                    e.regUI(a);
                }), U.uiMgr = this, U.init(this);
            }
        }, {
            key: "show",
            value: function (e, a, t) {
                this.allUI.has(e) ? U.getCmd(P.Show).setCallback(t).setUIData(e, a).run() : console.error("要显示的界面没有注册", e);
            }
        }, {
            key: "hide",
            value: function (e, a) {
                this.allUI.has(e) ? U.getCmd(P.Hide).setUIData(e, a).run() : console.error("要隐藏的界面没有注册", e);
            }
        }, {
            key: "destory",
            value: function (e) {
                this.allUI.has(e) ? U.getCmd(P.Del).setUIData(e, null).run() : console.error("要显示的界面没有注册", e);
            }
        }, {
            key: "getUI",
            value: function (e) {
                return this.allUI.has(e) ? this.allUI.get(e) : null;
            }
        }, {
            key: "regUI",
            value: function (e) {
                var a = new e(this.uiConfig.fguiPackRootUrl);
                return this.allUI.has(a.url) ? (console.warn("注册界面失败 界面已经存在了 [".concat(a.url, "]"), e),
                    null) : (this.allUI.set(a.url, a), a);
            }
        }, {
            key: "regUIExtension",
            value: function (e, a) {
                fgui.UIObjectFactory.setExtension(e, a);
            }
        }, {
            key: "hideAll",
            value: function () {
                this.allUI.forEach(function (e) {
                    e.isShowing && e.hideUI();
                });
            }
        }, {
            key: "getAllUI",
            value: function () {
                var e = [];
                return this.allUI.forEach(function (a) {
                    e.push(a);
                }), e;
            }
        }]), e;
    }(), G = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, [{
            key: "register",
            value: function () {
                n(i(t.prototype), "register", this).call(this), TY.App.singleton(I.IUIMgr, F).onAfterResolving(function (e, a) {
                    a.init();
                });
            }
        }, {
            key: "init",
            value: function () {
                n(i(t.prototype), "init", this).call(this);
                var e = this.app.make(I.IConfig);
                fgui.UIConfig.tooltipsWin = e.tooltipsWin, fgui.UIConfig.defaultFont = e.defaultFont,
                    fgui.UIConfig.globalModalWaiting = e.globalModalWaiting, fgui.UIConfig.packageFileExtension = e.packageFileExtension,
                    fgui.UIConfig.bringWindowToFrontOnClick = !1, fgui.UIConfig.buttonSound = e.buttonSound ? e.buttonSound : fgui.UIConfig.buttonSound,
                    fgui.UIConfig.modalLayerColor = e.modalLayerColor || "rgba(33,33,33,0.6)";
            }
        }]), t;
    }(TY.ServiceProvider), W = function () {
        function e() {
            l(this, e);
        }
        return s(e, [{
            key: "musicMuted",
            get: function () {
                return Laya.SoundManager.musicMuted;
            },
            set: function (e) {
                Laya.SoundManager.musicMuted = e;
            }
        }, {
            key: "muted",
            get: function () {
                return Laya.SoundManager.muted;
            },
            set: function (e) {
                Laya.SoundManager.muted = e;
            }
        }, {
            key: "soundMuted",
            get: function () {
                return Laya.SoundManager.soundMuted;
            },
            set: function (e) {
                Laya.SoundManager.soundMuted = e;
            }
        }, {
            key: "musicVolume",
            get: function () {
                return Laya.SoundManager.musicVolume;
            },
            set: function (e) {
                Laya.SoundManager.musicVolume = e;
            }
        }, {
            key: "soundVolume",
            get: function () {
                return Laya.SoundManager.soundVolume;
            },
            set: function (e) {
                Laya.SoundManager.soundVolume = e;
            }
        }, {
            key: "playSound",
            value: function (e, a) {
                return Laya.SoundManager.playSound(e, a);
            }
        }, {
            key: "stopSound",
            value: function (e) {
                Laya.SoundManager.stopSound(e);
            }
        }, {
            key: "playMusic",
            value: function (e, a) {
                return Laya.SoundManager.playMusic(e, a);
            }
        }, {
            key: "stopMusic",
            value: function () {
                Laya.SoundManager.stopMusic();
            }
        }]), e;
    }(), z = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, [{
            key: "register",
            value: function () {
                n(i(t.prototype), "register", this).call(this), TY.App.singleton(I.ISoundMgr, W);
            }
        }]), t;
    }(TY.ServiceProvider), X = s(function e() {
        l(this, e);
    });
    X.serviceProviders = [new M(), new C(), new x(), new G(), new z()];
    var Y = function () {
        function e(a) {
            l(this, e), this.config = a;
        }
        return s(e, [{
            key: "bootstrap",
            value: function () {
                var e = this;
                X.serviceProviders && X.serviceProviders.forEach(function (a) {
                    e.registerServiceProvider(a);
                }), this.config && this.config.providers && this.config.providers.forEach(function (a) {
                    e.registerServiceProvider(a);
                });
            }
        }, {
            key: "registerServiceProvider",
            value: function (e) {
                e && (TY.App.isRegisted(e) || TY.App.register(e));
            }
        }]), e;
    }(), j = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, null, [{
            key: "that",
            get: function () {
                return n(i(t), "getThat", this).call(this);
            }
        }, {
            key: "to",
            value: function (e, a, t) {
                return this.that.to(e, a, t);
            }
        }, {
            key: "to2",
            value: function (e, a, t, n, i) {
                return this.that.to2(e, a, t, n, i);
            }
        }, {
            key: "to3",
            value: function (e, a, t, n, i, r, o) {
                return this.that.to3(e, a, t, n, i, r, o);
            }
        }, {
            key: "to4",
            value: function (e, a, t, n, i, r, o, s, l) {
                return this.that.to3(e, a, t, i, r, o, l);
            }
        }, {
            key: "toColor",
            value: function (e, a, t) {
                return this.that.toColor(e, a, t);
            }
        }, {
            key: "delayedCall",
            value: function (e) {
                return this.that.delayedCall(e);
            }
        }, {
            key: "shake",
            value: function (e, a, t, n) {
                return this.that.shake(e, a, t, n);
            }
        }, {
            key: "kill",
            value: function (e, a, t) {
                this.that.kill(e, a, t);
            }
        }, {
            key: "getTween",
            value: function (e, a) {
                return this.that.getTween(e, a);
            }
        }]), t;
    }(TY.Facade);
    j.serviceName = I.ITWeen;
    var Q = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, null, [{
            key: "loadRes",
            value: function (e, a, t) {
                this.that.loadRes(e, a, t);
            }
        }, {
            key: "getRes",
            value: function (e) {
                return this.that.getRes(e);
            }
        }, {
            key: "pop",
            value: function () {
                var e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
                return this.that.pop(e);
            }
        }, {
            key: "that",
            get: function () {
                return n(i(t), "getThat", this).call(this);
            }
        }]), t;
    }(TY.Facade);
    Q.serviceName = I.IResource;
    var K = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, null, [{
            key: "that",
            get: function () {
                return n(i(t), "getThat", this).call(this);
            }
        }, {
            key: "curScene",
            get: function () {
                return this.that.curScene;
            }
        }, {
            key: "gotoScene",
            value: function (e, a, t, n) {
                this.that.gotoScene(e, a, t, n);
            }
        }, {
            key: "sceneRoot",
            get: function () {
                return TY.App.make(I.D3SceneRoot);
            }
        }, {
            key: "start",
            value: function () {
                return this.that.start();
            }
        }]), t;
    }(TY.Facade);
    K.serviceName = I.ISceneMgr;
    var q = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, null, [{
            key: "that",
            get: function () {
                return n(i(t), "getThat", this).call(this);
            }
        }, {
            key: "uiPackRootUrl",
            get: function () {
                return this.that.uiPackRootUrl;
            }
        }, {
            key: "show",
            value: function (e, a, t) {
                this.that.show(e, a, t);
            }
        }, {
            key: "hide",
            value: function (e, a) {
                this.that.hide(e, a);
            }
        }, {
            key: "hideAll",
            value: function () {
                this.that.hideAll();
            }
        }, {
            key: "getAllUI",
            value: function () {
                return this.that.getAllUI();
            }
        }, {
            key: "destory",
            value: function (e) {
                this.that.destory(e);
            }
        }, {
            key: "getUI",
            value: function (e) {
                return this.that.getUI(e);
            }
        }, {
            key: "regUI",
            value: function (e) {
                this.that.regUI(e);
            }
        }, {
            key: "regUIExtension",
            value: function (e, a) {
                this.that.regUIExtension(e, a);
            }
        }]), t;
    }(TY.Facade);
    q.serviceName = I.IUIMgr;
    var Z = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, null, [{
            key: "channel",
            get: function () {
                return this.that.channel;
            }
        }, {
            key: "init",
            value: function (e) {
                this.that.init(e);

            }
        }, {
            key: "showInsert",
            value: function (e, a) {
                this.that.showInsert(e, a);
            }
        }, {
            key: "showVideo",
            value: function (e, a) {
                this.that.showVideo(e, a);
            }
        }, {
            key: "showBanner",
            value: function (e, a) {
                this.that.showBanner(e, a);
            }
        }, {
            key: "hideBanner",
            value: function () {
                this.that.hideBanner();
            }
        }, {
            key: "setVibrate",
            value: function (e) {
                this.that.setVibrate(e);
            }
        }, {
            key: "showToast",
            value: function (e) {
                this.that.showToast(e);
            }
        }, {
            key: "loadFont",
            value: function (e) {
                this.that.loadFont(e);
            }
        }, {
            key: "report",
            value: function (e, a) {
                this.that.report(e, a);
            }
        }, {
            key: "that",
            get: function () {
                return n(i(t), "getThat", this).call(this);
            }
        }, {
            key: "exit",
            value: function () {
                var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
                this.that.exit(e);
            }
        }]), t;
    }(TY.Facade);
    Z.serviceName = I.ISDK;
    var J = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, null, [{
            key: "musicMuted",
            get: function () {
                return this.that.musicMuted;
            },
            set: function (e) {
                this.that.musicMuted = e;
            }
        }, {
            key: "muted",
            get: function () {
                return this.that.muted;
            },
            set: function (e) {
                this.that.muted = e;
            }
        }, {
            key: "soundMuted",
            get: function () {
                return this.that.soundMuted;
            },
            set: function (e) {
                this.that.soundMuted = e;
            }
        }, {
            key: "musicVolume",
            get: function () {
                return this.that.musicVolume;
            },
            set: function (e) {
                this.that.musicVolume = e;
            }
        }, {
            key: "soundVolume",
            get: function () {
                return this.that.soundVolume;
            },
            set: function (e) {
                this.that.soundVolume = e;
            }
        }, {
            key: "playSound",
            value: function (e, a) {
                return this.that.playSound(e, a);
            }
        }, {
            key: "stopSound",
            value: function (e) {
                this.that.stopSound(e);
            }
        }, {
            key: "playMusic",
            value: function (e, a) {
                return this.that.playMusic(e);
            }
        }, {
            key: "stopMusic",
            value: function () {
                return this.that.stopMusic();
            }
        }, {
            key: "that",
            get: function () {
                return n(i(t), "getThat", this).call(this);
            }
        }]), t;
    }(TY.Facade);
    J.serviceName = I.ISoundMgr;
    var $ = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, null, [{
            key: "isPingbi",
            get: function () {
                return this.that.isPingbi;
            }
        }, {
            key: "setPingbi",
            value: function (e) {
                this.that.setPingbi(e);
            }
        }, {
            key: "that",
            get: function () {
                return n(i(t), "getThat", this).call(this);
            }
        }, {
            key: "init",
            value: function (e, a) {
                this.that.init(e, a);
            }
        }, {
            key: "getAdRate",
            value: function (e) {
                return this.that.getAdRate(e);
            }
        }]), t;
    }(TY.Facade);
    $.serviceName = I.ISDKModel;
    var ee = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, null, [{
            key: "that",
            get: function () {
                return n(i(t), "getThat", this).call(this);
            }
        }, {
            key: "show",
            value: function (e, a) {
                this.that.onEnter(e).onCancel(a).showUI(null);
            }
        }, {
            key: "hide",
            value: function () {
                this.that.hideUI();
            }
        }]), t;
    }(TY.Facade);
    ee.serviceName = I.IQuickGameBoxUI;
    var ae = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, null, [{
            key: "that",
            get: function () {
                return n(i(t), "getThat", this).call(this);
            }
        }, {
            key: "show",
            value: function (e, a, t) {
                this.that.setType(e).onShowListener(a).onCloseListener(t).showUI(null);
            }
        }, {
            key: "hide",
            value: function () {
                this.that.hideUI();
            }
        }]), t;
    }(TY.Facade);
    ae.serviceName = I.IProtocolContentUI;
    var te = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, null, [{
            key: "that",
            get: function () {
                return n(i(t), "getThat", this).call(this);
            }
        }, {
            key: "show",
            value: function (e) {
                var a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
                this.that.onEnterListener(e).onShilingListener(a).showUI(null);
            }
        }]), t;
    }(TY.Facade);
    te.serviceName = I.IProtocolBoxUI;
    var ne = function (e) {
        r(t, e);
        var a = o(t);
        function t(e) {
            var n;
            l(this, t), n = a.call(this);
            var i = new Laya.Sprite();
            Laya.stage.addChild(i), i.name = "d3Root";
            var r = new Laya.Sprite();
            return Laya.stage.addChild(r), r.name = "uiRoot", n.instance(I.D3SceneRoot, i),
                n.instance(I.UIRoot, r), n.logLevel = e,
                // n.logLevel > TY.LogLevel.Log && console.log && (console.log = function() {}), 
                // n.logLevel > TY.LogLevel.Warn && console.warn && (console.warn = function() {}), 
                // n.logLevel > TY.LogLevel.Error && console.error && (console.error = function() {}), 
                n;
        }
        return s(t, [{
            key: "pause",
            value: function (e) {
                n(i(t.prototype), "pause", this).call(this, e), e ? (Laya.timer.scale = 0, Laya.lateTimer.scale = 0,
                    Laya.updateTimer.scale = 0, Laya.physicsTimer.scale = 0) : (Laya.timer.scale = 1,
                        Laya.lateTimer.scale = 1, Laya.updateTimer.scale = 1, Laya.physicsTimer.scale = 1);
            }
        }, {
            key: "exit",
            value: function () {
                var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
                n(i(t.prototype), "exit", this).call(this, e), Z.exit(e);
            }
        }]), t;
    }(TY.Application), ie = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            return l(this, t), a.apply(this, arguments);
        }
        return s(t, [{
            key: "_parse",
            value: function (e, a) {
                n(i(t.prototype), "_parse", this).call(this, e, a), this.fontInfo = e.fontInfo,
                    this.fontName = e.fontName;
            }
        }, {
            key: "onAwake",
            value: function () {
                n(i(t.prototype), "onAwake", this).call(this);
            }
        }, {
            key: "FontInfo",
            get: function () {
                return this.fontInfo;
            }
        }, {
            key: "FontName",
            get: function () {
                return this.fontName;
            }
        }, {
            key: "FontJsonInfo",
            get: function () {
                return JSON.parse(this.fontInfo);
            }
        }]), t;
    }(Laya.Script3D), re = function () {
        function e() {
            l(this, e), this.mapDec = null, this.jsondata = null, this.hw = 1, this.vertexs = [],
                this.triangles = [], this.pools = [];
        }
        return s(e, [{
            key: "AddVertices",
            value: function (e, a, t, n, i, r) {
                var o = this.jsondata[a];
                return null == o && console.error("没有该数据  " + a), e[t++] = i, e[t++] = -r, e[t++] = 0,
                    e[t++] = 0, e[t++] = -1, e[t++] = 0, e[t++] = o[0], e[t++] = o[1], e[t++] = i - n,
                    e[t++] = -r, e[t++] = 0, e[t++] = 0, e[t++] = -1, e[t++] = 0, e[t++] = o[2], e[t++] = o[1],
                    e[t++] = i - n, e[t++] = r, e[t++] = 0, e[t++] = 0, e[t++] = -1, e[t++] = 0, e[t++] = o[2],
                    e[t++] = o[3], e[t++] = i, e[t++] = r, e[t++] = 0, e[t++] = 0, e[t++] = -1, e[t++] = 0,
                    e[t++] = o[0], e[t++] = o[3], t;
            }
        }, {
            key: "RecoverObj",
            value: function (e) {
                if (null != e.meshFilter.sharedMesh) {
                    var a = e.meshFilter.sharedMesh;
                    this.RecoverMesh(a), e.meshFilter.sharedMesh = a;
                }
            }
        }, {
            key: "RecoverMesh",
            value: function (e) {
                if (null != e) {
                    var a = .25 * e.vertexCount - 1;
                    this.pools.length < a && this.pools[a].push(e);
                }
            }
        }, {
            key: "GetMesh",
            value: function (e) {
                --e > this.triangles.length && this.UpdateFontPools(e + 1);
                var a = this.pools[e];
                return a.length > 0 ? this.PopArray(a) : this.CreatorMesh(e + 1);
            }
        }, {
            key: "CreatorMesh",
            value: function (e) {
                (e -= 1) > this.triangles.length && this.UpdateFontPools(e + 1);
                var a = this.vertexs[e], t = this.triangles[e];
                return Laya.PrimitiveMesh._createMesh(this.mapDec, a, t);
            }
        }, {
            key: "UpdateFontPools",
            value: function (e) {
                for (var a = this.pools.length + 1; a <= e; ++a) this.AddFontNum(a);
            }
        }, {
            key: "InitData",
            value: function (e) {
                this.mapDec = Laya.VertexMesh.getVertexDeclaration("POSITION,NORMAL,UV"), this.jsondata = {};
                for (var a = 0; a < e.length; ++a) {
                    var t = e[a].datas;
                    t[2] = t[0] + t[2], t[3] = t[1] + t[3], t[1] = 1 - t[1], t[3] = 1 - t[3], this.jsondata[e[a].name] = t;
                }
                for (a = 0; a < 7; ++a) this.AddFontNum(a + 1);
            }
        }, {
            key: "AddFontNum",
            value: function (e) {
                for (var a = this.CreateTriangle(3 * e * 2), t = 0, n = 0; n < e; ++n) a[t++] = 4 * n + 0,
                    a[t++] = 4 * n + 3, a[t++] = 4 * n + 2, a[t++] = 4 * n + 0, a[t++] = 4 * n + 2,
                    a[t++] = 4 * n + 1;
                this.triangles.push(a), this.vertexs.push(new Float32Array(32 * e)), this.pools.push([]);
            }
        }, {
            key: "CreateTriangle",
            value: function (e) {
                return e <= 255 || e <= 65535 ? new Uint16Array(e) : new Uint32Array(e);
            }
        }, {
            key: "PopArray",
            value: function (e) {
                if (null != e && e.length > 0) {
                    var a = e[e.length - 1];
                    return e.length = e.length - 1, a;
                }
                return console.error("数组为空"), null;
            }
        }], [{
            key: "setObjLabel",
            value: function (a, t) {
                var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 1, i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : .1, r = a.getComponent(ie);
                if (null != r) {
                    var o = this.label3Ds[r.FontName];
                    null == o && (o = new e(), this.label3Ds[r.FontName] = o, o.InitData(r.FontJsonInfo));
                    var s = a.meshFilter.sharedMesh, l = t.length, u = 0;
                    if (l < 3 && (2 == l && (u = .5 * (n + i)), l = t.length), 0 != l) {
                        null != s && .25 * s.vertexCount == l || (o.RecoverMesh(s), s = o.GetMesh(l));
                        for (var h = o.vertexs[l - 1], d = 0, _ = l * n + (l - 1) * i, c = n * o.hw, E = .5 * _ - u, S = 0; S < l; ++S) d = o.AddVertices(h, t[S], d, n, E, c),
                            E -= n + i;
                        s.setVertices(h), a.meshFilter.sharedMesh = s;
                    }
                }
            }
        }]), e;
    }();
    re.label3Ds = {};
    var oe = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "viewportPointToWorld",
            value: function (e, a, t) {
                this.tempV2.setValue(a.x, a.y), e.viewportPointToRay(this.tempV2, this.ray), e._nearPlane;
                var n = Laya.Vector3.distance(a, this.ray.origin);
                Laya.Vector3.subtract(a, this.ray.origin, t), Laya.Vector3.normalize(t, t), Laya.Vector3.dot(t, this.ray.direction) < 0 && (n *= -1),
                    Laya.Vector3.scale(this.ray.direction, n, t), Laya.Vector3.add(this.ray.origin, t, t);
            }
        }, {
            key: "worldToScreen2",
            value: function (e, a, t) {
                t || (t = new Laya.Vector3()), e.worldToViewportPoint(a, this.temp_v4), t.setValue(this.temp_v4.x, this.temp_v4.y, this.temp_v4.z);
            }
        }, {
            key: "inverseTransformPoint",
            value: function (e, a) {
                var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
                t = null == t ? new Laya.Vector3() : t;
                var n = this._tempMatrix0;
                return e.worldMatrix.invert(n), Laya.Vector3.transformCoordinate(a, n, t), t;
            }
        }, {
            key: "transformPoint",
            value: function (e, a) {
                var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
                return null == t && (t = new Laya.Vector3()), Laya.Vector3.transformQuat(a, e.rotation, t),
                    Laya.Vector3.add(t, e.position, t), t;
            }
        }, {
            key: "setLayer",
            value: function (a, t) {
                a.layer = t;
                for (var n = 0; n < a.numChildren; n++) {
                    var i = a.getChildAt(n);
                    i.numChildren > 0 ? e.setLayer(i, t) : i.layer = t;
                }
            }
        }, {
            key: "toLayaV3",
            value: function (e, a) {
                a.setValue(-e.x, e.y, e.z);
            }
        }, {
            key: "clamp",
            value: function (e, a, t) {
                return TY.Utils.clamp(e, a, t);
            }
        }, {
            key: "eulerToQuaternion",
            value: function (e, a) {
                Laya.Quaternion.createFromYawPitchRoll(e.y * Math.PI / 180, e.x * Math.PI / 180, e.z * Math.PI / 180, a);
            }
        }, {
            key: "quaternionToEuler",
            value: function (e, a) {
                e.getYawPitchRoll(a), a.setValue(180 * a.y / Math.PI, 180 * a.x / Math.PI, 180 * a.z / Math.PI);
            }
        }, {
            key: "toLayaEuler",
            value: function (e, a) {
                this.eulerToQuaternion(e, this.temQut), this.temQut.w *= -1, this.temQut.x *= -1,
                    this.quaternionToEuler(this.temQut, a);
            }
        }, {
            key: "setParent",
            value: function (e, a) {
                var t = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2];
                if (t) {
                    a.transform.position.cloneTo(this.temp_V3), a.transform.rotation.cloneTo(this.temQut);
                    var n = a.transform.getWorldLossyScale();
                    n.cloneTo(this.temp_V3_2), e.addChild(a);
                    var i = a.transform.position;
                    this.temp_V3.cloneTo(i), a.transform.position = i;
                    var r = a.transform.rotation;
                    this.temQut.cloneTo(r), a.transform.rotation = r, this.temp_V3_2.cloneTo(n), a.transform.setWorldLossyScale(n);
                } else e.addChild(a);
            }
        }, {
            key: "bezier3",
            value: function (e, a, t, n, i, r) {
                Laya.Vector3.subtract(a, e, this.TEMP_AA), Laya.Vector3.scale(this.TEMP_AA, i, this.TEMP_AA),
                    Laya.Vector3.add(this.TEMP_AA, e, this.TEMP_AA), Laya.Vector3.subtract(t, a, this.TEMP_BB),
                    Laya.Vector3.scale(this.TEMP_BB, i, this.TEMP_BB), Laya.Vector3.add(this.TEMP_BB, a, this.TEMP_BB),
                    Laya.Vector3.subtract(n, t, this.TEMP_CC), Laya.Vector3.scale(this.TEMP_CC, i, this.TEMP_CC),
                    Laya.Vector3.add(this.TEMP_CC, t, this.TEMP_CC), Laya.Vector3.subtract(this.TEMP_BB, this.TEMP_AA, this.TEMP_AAA),
                    Laya.Vector3.scale(this.TEMP_AAA, i, this.TEMP_AAA), Laya.Vector3.add(this.TEMP_AAA, this.TEMP_AA, this.TEMP_AAA),
                    Laya.Vector3.subtract(this.TEMP_CC, this.TEMP_BB, this.TEMP_BBB), Laya.Vector3.scale(this.TEMP_BBB, i, this.TEMP_BBB),
                    Laya.Vector3.add(this.TEMP_BBB, this.TEMP_BB, this.TEMP_BBB), Laya.Vector3.subtract(this.TEMP_BBB, this.TEMP_AAA, r),
                    Laya.Vector3.scale(r, i, r), Laya.Vector3.add(r, this.TEMP_AAA, r);
            }
        }, {
            key: "getChildByPath",
            value: function (e, a) {
                if (!a || "" == a) return null;
                for (var t = a.split("/"), n = e, i = 0; i < t.length; i++) {
                    if (!n) return null;
                    if (".." == t[i]) {
                        if (null == n.parent) return null;
                        n = n.parent;
                    } else "" != t[i] && (n = n.getChildByName(t[i]));
                }
                return n;
            }
        }, {
            key: "v2Dis",
            value: function (e, a) {
                var t = e.x - a.x, n = e.y - a.y;
                return Math.sqrt(t * t + n * n);
            }
        }, {
            key: "v2sub",
            value: function (e, a, t) {
                t.x = e.x - a.x, t.y = e.y - a.y;
            }
        }, {
            key: "v2add",
            value: function (e, a, t) {
                t.x = e.x + a.x, t.y = e.y + a.y;
            }
        }, {
            key: "v2Magnitude",
            value: function (e) {
                return Math.sqrt(e.x * e.x + e.y * e.y);
            }
        }, {
            key: "rgbToHexStr",
            value: function (e, a, t) {
                var n = new Laya.Color(255 * e, 255 * a, 255 * t, 1);
                return this.colorToHexStr(n);
            }
        }, {
            key: "colorToHexStr",
            value: function (e) {
                var a = "", t = Math.floor(e.r).toString(16);
                return t.length < 2 && (t = "0" + t), a += t, (t = Math.floor(e.g).toString(16)).length < 2 && (t = "0" + t),
                    a += t, (t = Math.floor(e.b).toString(16)).length < 2 && (t = "0" + t), a + t;
            }
        }, {
            key: "projectOnVector",
            value: function (e, a) {
                var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
                t || (t = new Laya.Vector3());
                var n = Laya.Vector3.dot(a, a);
                return n < Number.EPSILON ? t.setValue(0, 0, 0) : (Laya.Vector3.scale(a, Laya.Vector3.dot(e, a), t),
                    t.x /= n, t.y /= n, t.z /= n), t;
            }
        }, {
            key: "projectOnPlane",
            value: function (e, a) {
                var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
                return t || (t = new Laya.Vector3()), Laya.Vector3.subtract(e, this.projectOnVector(e, a, t), t),
                    t;
            }
        }, {
            key: "slerpV3",
            value: function (e, a, t) {
                var n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null;
                if (n || (n = new Laya.Vector3()), t <= 0) return e.cloneTo(n), n;
                if (t >= 1) return a.cloneTo(n), n;
                var i, r, o, s, l, u = e.x, h = e.y, d = e.z, _ = a.x, c = a.y, E = a.z;
                return (r = u * _ + h * c + d * E) < 0 && (r = -r, _ = -_, c = -c, E = -E), 1 - r > 1e-6 ? (i = Math.acos(r),
                    o = Math.sin(i), s = Math.sin((1 - t) * i) / o, l = Math.sin(t * i) / o) : (s = 1 - t,
                        l = t), n.x = s * u + l * _, n.y = s * h + l * c, n.z = s * d + l * E, n;
            }
        }, {
            key: "tryToMoveToPosWithSpeed",
            value: function (e, a, t, n, i) {
                var r;
                return Laya.Vector3.subtract(e, a, this.temp_V3), t * n < this.normalizeRetDis(this.temp_V3, this.temp_V3) ? (Laya.Vector3.scale(this.temp_V3, t * n, this.temp_V3),
                    Laya.Vector3.add(a, this.temp_V3, i), r = !1) : (e.cloneTo(i), r = !0), r;
            }
        }, {
            key: "offsetToMoveToPosWithSpeed",
            value: function (e, a, t, n, i) {
                var r = !1;
                return Laya.Vector3.subtract(e, a, this.temp_V3), t * n < this.normalizeRetDis(this.temp_V3, this.temp_V3) ? (Laya.Vector3.scale(this.temp_V3, t * n, i),
                    r = !1) : (this.temp_V3.cloneTo(i), r = !0), r;
            }
        }, {
            key: "normalizeRetDis",
            value: function (e, a) {
                var t = Math.sqrt(e.x * e.x + e.y * e.y + e.z * e.z);
                if (e.cloneTo(a), t > 0) {
                    var n = 1 / t;
                    a.x = a.x * n, a.y = a.y * n, a.z = a.z * n;
                }
                return t;
            }
        }, {
            key: "sqrtFast",
            value: function (e) {
                var a = this.sqrData, t = .5 * e;
                a.setFloat32(0, e);
                var n = a.getInt32(0);
                n = 1597463174 - (n >> 1), a.setInt32(0, n);
                var i = a.getFloat32(0);
                return i * (1.5 - t * i * i);
            }
        }, {
            key: "normalize",
            value: function (e, a) {
                var t = e.x, n = e.y, i = e.z, r = t * t + n * n + i * i;
                r > 0 && (r = this.sqrtFast(r), a.x = t * r, a.y = n * r, a.z = i * r);
            }
        }, {
            key: "approximately",
            value: function (e, a) {
                return Math.abs(a - e) < Math.max(1e-6 * Math.max(Math.abs(e), Math.abs(a)), 8 * Number.EPSILON);
            }
        }]), e;
    }();
    oe.temp_V3 = new Laya.Vector3(), oe.temp_V3_2 = new Laya.Vector3(), oe.temp_v4 = new Laya.Vector4(),
        oe.temQut = new Laya.Quaternion(), oe.UP = new Laya.Vector3(0, 1, 0), oe.Zero = new Laya.Vector3(),
        oe.Once = new Laya.Vector3(1, 1, 1), oe.ray = new Laya.Ray(new Laya.Vector3(), new Laya.Vector3()),
        oe.tempV2 = new Laya.Vector2(), oe._tempMatrix0 = new Laya.Matrix4x4(), oe.TEMP_AA = new Laya.Vector3(),
        oe.TEMP_BB = new Laya.Vector3(), oe.TEMP_CC = new Laya.Vector3(), oe.TEMP_AAA = new Laya.Vector3(),
        oe.TEMP_BBB = new Laya.Vector3(), oe.sqrbuff = new ArrayBuffer(4), oe.sqrData = new DataView(oe.sqrbuff, 0);
    var se = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "initShader",
            value: function () {
                var e = {
                    a_PositionTexcoord: Laya.VertexMesh.MESH_POSITION0
                }, a = {
                    u_Color: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MainTex: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MainTex_TexelSize: Laya.Shader3D.PERIOD_MATERIAL
                };
                this.shader = Laya.Shader3D.add("ReplaceTexShader");
                var t = new Laya.SubShader(e, a);
                this.shader.addSubShader(t);
                var n = t.addShaderPass('\n    #include "Lighting.glsl";\n    attribute vec4 a_PositionTexcoord;\n\n    uniform vec4 u_MainTex_TexelSize;\n    uniform vec4 u_TargetTex_TexelSize;\n\n    uniform vec4 u_OffsetScale;\n    varying vec2 v_Texcoord0;\n    varying vec2 v_texRatio;\n    void main() {\n        \n        gl_Position = vec4(a_PositionTexcoord.x, a_PositionTexcoord.y, 0.0, 1.0);\n        v_Texcoord0 = a_PositionTexcoord.zw;\n        gl_Position = remapGLPositionZ(gl_Position);\n        v_texRatio = u_TargetTex_TexelSize.zw / u_MainTex_TexelSize.zw;\n    }\n\n', "#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D u_MainTex;\n\n#ifdef BASETEXTURE\nuniform sampler2D u_BaseTex;\n#endif\n\n#ifdef COLOR\nuniform vec4 u_Color;\n#endif\n\nvarying vec2 v_Texcoord0;\n\nvoid main() {  \n    vec2 uv = v_Texcoord0;\n    vec4 newCol = texture2D(u_MainTex, uv);\n    #ifdef COLOR\n        newCol.rgb *= u_Color.rgb;\n    #endif\n    gl_FragColor = newCol;\n}\n").renderState;
                n.depthTest = Laya.RenderState.DEPTHTEST_OFF, n.depthWrite = !1, n.cull = Laya.RenderState.CULL_NONE,
                    n.blend = Laya.RenderState.BLEND_DISABLE;
            }
        }]), e;
    }(), le = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "initShader",
            value: function () {
                var e = {
                    a_PositionTexcoord: Laya.VertexMesh.MESH_POSITION0
                }, a = {
                    u_TargetTex: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TargetTex_TexelSize: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MaskTex: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MainTex: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MainTex_TexelSize: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Main_Scale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_offset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Color: Laya.Shader3D.PERIOD_MATERIAL,
                    u_time_1: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OffsetScale: Laya.Shader3D.PERIOD_MATERIAL
                };
                this.shader = Laya.Shader3D.add("AddTexShader");
                var t = new Laya.SubShader(e, a);
                this.shader.addSubShader(t);
                var n = t.addShaderPass('\n    #include "Lighting.glsl";\n    attribute vec4 a_PositionTexcoord;\n\n    uniform vec4 u_MainTex_TexelSize;\n    uniform vec4 u_TargetTex_TexelSize;\n\n    // uniform vec4 u_OffsetScale;\n    varying vec2 v_Texcoord0;\n    varying vec2 v_texRatio;\n    void main() {\n        gl_Position = vec4(a_PositionTexcoord.x, a_PositionTexcoord.y, 0.0, 1.0);\n        v_Texcoord0 = a_PositionTexcoord.zw;\n        gl_Position = remapGLPositionZ(gl_Position);\n        v_texRatio = u_TargetTex_TexelSize.zw / u_MainTex_TexelSize.zw;\n    }\n\n', "#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D u_MainTex;\n\nuniform float u_Main_Scale;\n\nuniform sampler2D u_TargetTex;\n\nuniform vec2 u_offset;\n\n#ifdef COLOR\nuniform vec4 u_Color;\n#endif\n\n#ifdef MASKTEXTURE\nuniform sampler2D u_MaskTex;\n#endif\nuniform float u_time_1;\nvarying vec2 v_Texcoord0;\nvarying vec2 v_texRatio;\n\nvoid main() {\n    vec2 uv0 = v_Texcoord0;\n    vec4 oldColor =texture2D(u_TargetTex, uv0);\n    vec2 uv = (uv0 - u_offset) * v_texRatio + vec2(0.5, 0.5);//v_Texcoord0;//\n    vec4 newCol = texture2D(u_MainTex, uv);\n    if(uv.x < 0. || uv.y < 0. || uv.x > 1. || uv.y >1.){\n        newCol.a = 0.;\n    }\n    #ifdef COLOR\n        newCol.rgb *= u_Color.rgb;\n    #endif\n    \n    newCol.a *= u_time_1;\n    #ifdef MASKTEXTURE\n        vec4 maskCol = texture2D(u_MaskTex, v_Texcoord0);\n        #if defined(MASK_A)\n            newCol.a *= maskCol.a;\n        #else\n            newCol.a = maskCol.r;\n        #endif\n    #endif\n    newCol.a = min(newCol.a,1.0);\n    newCol.a = max(newCol.a,0.0);\n \n    float retA = newCol.a+oldColor.a*(1.0-newCol.a);\n    newCol.rgb = (newCol.rgb * newCol.a + oldColor.rgb * oldColor.a * (1.0 - newCol.a)) / retA;\n    newCol.a = retA;\n\n    gl_FragColor = newCol;\n}\n\n").renderState;
                n.depthTest = Laya.RenderState.DEPTHTEST_OFF, n.depthWrite = !1, n.cull = Laya.RenderState.CULL_NONE,
                    n.blend = Laya.RenderState.BLEND_DISABLE;
            }
        }]), e;
    }(), ue = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "initShader",
            value: function () {
                var e = {
                    a_PositionTexcoord: Laya.VertexMesh.MESH_POSITION0
                }, a = {
                    u_TargetTex: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TargetTex_TexelSize: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ReplaceTex: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MainTex: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MainTex_TexelSize: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Main_Scale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_offset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Color: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OffsetScale: Laya.Shader3D.PERIOD_MATERIAL
                };
                this.shader = Laya.Shader3D.add("ClearTexShader");
                var t = new Laya.SubShader(e, a);
                this.shader.addSubShader(t);
                var n = t.addShaderPass('\n    #include "Lighting.glsl";\n    attribute vec4 a_PositionTexcoord;\n\n    uniform vec4 u_MainTex_TexelSize;\n    uniform vec4 u_TargetTex_TexelSize;\n\n    // uniform vec4 u_OffsetScale;\n    varying vec2 v_Texcoord0;\n    varying vec2 v_texRatio;\n    void main() {\n        gl_Position = vec4(a_PositionTexcoord.x, a_PositionTexcoord.y, 0.0, 1.0);\n        v_Texcoord0 = a_PositionTexcoord.zw;\n        gl_Position = remapGLPositionZ(gl_Position);\n        v_texRatio = u_TargetTex_TexelSize.zw / u_MainTex_TexelSize.zw;\n    }\n\n', "#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D u_MainTex;//笔刷\n\nuniform float u_Main_Scale;\n\nuniform sampler2D u_TargetTex;//最终的贴图\n\nuniform vec2 u_offset;\n\n#ifdef COLOR\nuniform vec4 u_Color;\n#endif\n\n#ifdef REPLACETEXTURE\nuniform sampler2D u_ReplaceTex;\n#endif\nvarying vec2 v_Texcoord0;\nvarying vec2 v_texRatio;\n\nvoid main() {\n    vec2 uv0 = v_Texcoord0;\n\n    vec4 oldColor =texture2D(u_TargetTex, uv0);\n    vec2 uv = (uv0 - u_offset) * v_texRatio + vec2(0.5, 0.5);//v_Texcoord0;//\n    vec4 newCol = texture2D(u_MainTex, uv);\n    newCol.a = newCol.r;\n    if(uv.x < 0. || uv.y < 0. || uv.x > 1. || uv.y >1.){\n        newCol.a = 0.0;\n    }\n    oldColor.a -= newCol.a;\n    vec4 retColor = oldColor;\n\n\n    #ifdef COLOR\n    newCol.rgb *= u_Color.rgb;\n    //newCol.rgb = oldColor.rgb * oldColor.a + newCol.rgb *newCol.a;\n    #endif\n    #ifdef REPLACETEXTURE\n    vec4 replaceColor =texture2D(u_ReplaceTex, uv0);\n    newCol.rgb *= replaceColor.rgb;\n    newCol.a *= replaceColor.a;\n    oldColor.a *= (1.0-newCol.a);\n    float retA = newCol.a+oldColor.a*(1.0-newCol.a);\n    retColor.rgb = (newCol.rgb * newCol.a + oldColor.rgb * oldColor.a * (1.0 - newCol.a)) / retA;\n    retColor.a = retA;\n    #endif\n    retColor.a = max(0.0,retColor.a);\n    retColor.a = min(1.0,retColor.a);\n    gl_FragColor = retColor;\n}\n").renderState;
                n.depthTest = Laya.RenderState.DEPTHTEST_OFF, n.depthWrite = !1, n.cull = Laya.RenderState.CULL_NONE,
                    n.blend = Laya.RenderState.BLEND_DISABLE;
            }
        }]), e;
    }();
    var he = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "initShader",
            value: function () {
                var e = {
                    a_PositionTexcoord: Laya.VertexMesh.MESH_POSITION0
                }, a = {
                    u_Color: Laya.Shader3D.PERIOD_MATERIAL
                };
                this.shader = Laya.Shader3D.add("ColorAllTexShader");
                var t = new Laya.SubShader(e, a);
                this.shader.addSubShader(t);
                var n = t.addShaderPass('\n    #include "Lighting.glsl";\n    attribute vec4 a_PositionTexcoord;\n\n    uniform vec4 u_MainTex_TexelSize;\n    uniform vec4 u_TargetTex_TexelSize;\n\n    // uniform vec4 u_OffsetScale;\n    varying vec2 v_Texcoord0;\n    // varying vec2 v_texRatio;\n    void main() {\n        \n        gl_Position = vec4(a_PositionTexcoord.x, a_PositionTexcoord.y, 0.0, 1.0);\n        v_Texcoord0 = a_PositionTexcoord.zw;\n        gl_Position = remapGLPositionZ(gl_Position);\n        // v_texRatio = u_TargetTex_TexelSize.zw / u_MainTex_TexelSize.zw;\n    }\n\n', "#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D u_MainTex;\n\nuniform vec4 u_Color;\n\nvarying vec2 v_Texcoord0;\n\nvoid main() {  \n    vec2 uv = v_Texcoord0;\n    // vec4 newCol = texture2D(u_MainTex, uv);\n    // newCol.rgba = u_Color.rgba;\n    gl_FragColor = u_Color;\n}\n").renderState;
                n.depthTest = Laya.RenderState.DEPTHTEST_OFF, n.depthWrite = !1, n.cull = Laya.RenderState.CULL_NONE,
                    n.blend = Laya.RenderState.BLEND_DISABLE;
            }
        }]), e;
    }();
    var de = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "initShader",
            value: function () {
                var e = {
                    a_PositionTexcoord: Laya.VertexMesh.MESH_POSITION0
                }, a = {
                    u_target_a: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MainTex: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MainTex_TexelSize: Laya.Shader3D.PERIOD_MATERIAL
                };
                this.shader = Laya.Shader3D.add("SetTexAShader");
                var t = new Laya.SubShader(e, a);
                this.shader.addSubShader(t);
                var n = t.addShaderPass('\n    #include "Lighting.glsl";\n    attribute vec4 a_PositionTexcoord;\n\n    uniform vec4 u_MainTex_TexelSize;\n    uniform vec4 u_TargetTex_TexelSize;\n\n    uniform vec4 u_OffsetScale;\n    varying vec2 v_Texcoord0;\n    varying vec2 v_texRatio;\n    void main() {\n        \n        gl_Position = vec4(a_PositionTexcoord.x, a_PositionTexcoord.y, 0.0, 1.0);\n        v_Texcoord0 = a_PositionTexcoord.zw;\n        gl_Position = remapGLPositionZ(gl_Position);\n        v_texRatio = u_TargetTex_TexelSize.zw / u_MainTex_TexelSize.zw;\n    }\n\n', "#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform sampler2D u_MainTex;\n\nuniform float u_target_a;\n\nvarying vec2 v_Texcoord0;\n\nvoid main() {  \n    vec2 uv = v_Texcoord0;\n    vec4 newCol = texture2D(u_MainTex, uv);\n    newCol.a = min(newCol.a,u_target_a);\n    // newCol.a *= u_target_a;\n    gl_FragColor = newCol;\n}\n").renderState;
                n.depthTest = Laya.RenderState.DEPTHTEST_OFF, n.depthWrite = !1, n.cull = Laya.RenderState.CULL_NONE,
                    n.blend = Laya.RenderState.BLEND_DISABLE;
            }
        }]), e;
    }(), _e = Laya.Shader3D, ce = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "init",
            value: function () {
                le.initShader(), se.initShader(), ue.initShader(), he.initShader(), de.initShader(),
                    this.SHADER_DEF_REPLACE = _e.getDefineByName("REPLACETEXTURE"), this.SHADER_DEF_BASE = _e.getDefineByName("BASETEXTURE"),
                    this.SHADER_DEF_COLOR = _e.getDefineByName("COLOR"), this.SHADER_DEF_MASK = _e.getDefineByName("MASKTEXTURE"),
                    this.SHADER_DEF_CLEAR_ALL = _e.getDefineByName("SHADER_DEF_CLEAR_ALL"), this.SHADER_DEF_MASK_A = _e.getDefineByName("MASK_A"),
                    this.replaceShaderData = new Laya.ShaderData(), this.addShaderData = new Laya.ShaderData(),
                    this.clearTexShaderData = new Laya.ShaderData(), this.clearColorData = new Laya.ShaderData(),
                    this.setTexAData = new Laya.ShaderData();
            }
        }, {
            key: "runBlitFrameBufferCMD",
            value: function (e, a, t, n, i) {
                this.viewport.x = 0, this.viewport.y = Laya.RenderContext3D.clientHeight - a.height,
                    this.viewport.width = a.width, this.viewport.height = a.height, this.sourceTexelSize.setValue(1 / e.width, 1 / e.height, e.width, e.height),
                    i.setVector(this.MAINEXTURE_TEXELSIZE_ID, this.sourceTexelSize);
                var r = Laya.BlitFrameBufferCMD.create(e, a, this.viewport, t, n, i);
                r.run(), r.recover();
            }
        }, {
            key: "replaceRt",
            value: function (e, a) {
                var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
                null != t ? (this.replaceShaderData.setVector(this.COLOR_ID, t), this.replaceShaderData.addDefine(this.SHADER_DEF_COLOR)) : this.replaceShaderData.removeDefine(this.SHADER_DEF_COLOR),
                    this.runBlitFrameBufferCMD(e, a, this.DEf_Offset, se.shader, this.replaceShaderData);
            }
        }, {
            key: "addTexToRt",
            value: function (e, a) {
                var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : .5, i = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : .5, r = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 1, o = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : 1, s = arguments.length > 7 && void 0 !== arguments[7] ? arguments[7] : null, l = arguments.length > 8 && void 0 !== arguments[8] ? arguments[8] : null, u = !(arguments.length > 9 && void 0 !== arguments[9]) || arguments[9];
                o < 0 && (o = 0), o > 1 && (o = 1);
                var h = this.addShaderData;
                null != l ? (h.addDefine(this.SHADER_DEF_MASK), h.setTexture(this.MASK_TEXTURE_ID, l)) : h.removeDefine(this.SHADER_DEF_MASK),
                    this._UV.setValue(n, i), null != t ? (h.setVector(this.COLOR_ID, t), h.addDefine(this.SHADER_DEF_COLOR)) : h.removeDefine(this.SHADER_DEF_COLOR),
                    u ? h.removeDefine(this.SHADER_DEF_MASK_A) : h.addDefine(this.SHADER_DEF_MASK_A),
                    h.setNumber(this.time_ID, o);
                var d = Laya.RenderTexture.createFromPool(a.width, a.height, a.format);
                s = s || a, this.replaceRt(s, d), h.setTexture(this.TARGET_TEXTURE_ID, d), this.targetTexelSize.setValue(1 / e.width, 1 / e.height, a.width / r, a.height / r),
                    h.setVector(this.TARGETEXTURE_TEXELSIZE_ID, this.targetTexelSize), h.setVector2(this.OFFSET_ID, this._UV),
                    this.runBlitFrameBufferCMD(e, a, this.DEf_Offset, le.shader, h), Laya.RenderTexture.recoverToPool(d);
            }
        }, {
            key: "clearTex",
            value: function (e, a) {
                var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : .5, n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : .5, i = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 1, r = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : null, o = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : null, s = this.clearTexShaderData;
                null != r ? (s.addDefine(this.SHADER_DEF_REPLACE), s.setTexture(this.REPLACE_TEXTURE_ID, r)) : s.removeDefine(this.SHADER_DEF_REPLACE),
                    this._UV.setValue(t, n), null != o ? (s.setVector(this.COLOR_ID, o), s.addDefine(this.SHADER_DEF_COLOR)) : s.removeDefine(this.SHADER_DEF_COLOR);
                var l = Laya.RenderTexture.createFromPool(a.width, a.height, a.format);
                this.replaceRt(a, l), s.setTexture(this.TARGET_TEXTURE_ID, l), this.targetTexelSize.setValue(1 / e.width, 1 / e.height, a.width / i, a.height / i),
                    s.setVector(this.TARGETEXTURE_TEXELSIZE_ID, this.targetTexelSize), s.setVector2(this.OFFSET_ID, this._UV),
                    this.runBlitFrameBufferCMD(e, a, this.DEf_Offset, ue.shader, s), Laya.RenderTexture.recoverToPool(l);
            }
        }, {
            key: "clearColor",
            value: function (e, a) {
                var t = this.clearColorData;
                t.setVector(this.COLOR_ID, e);
                var n = Laya.RenderTexture.createFromPool(a.width, a.height, a.format);
                this.replaceRt(a, n), this.runBlitFrameBufferCMD(n, a, this.DEf_Offset, he.shader, t),
                    Laya.RenderTexture.recoverToPool(n);
            }
        }, {
            key: "setRtA",
            value: function (e, a) {
                this.setTexAData.setNumber(this.Target_A_ID, a);
                var t = Laya.RenderTexture.createFromPool(e.width, e.height, e.format);
                this.replaceRt(e, t), this.runBlitFrameBufferCMD(t, e, this.DEf_Offset, de.shader, this.setTexAData),
                    Laya.RenderTexture.recoverToPool(t);
            }
        }]), e;
    }();
    ce.DEf_Offset = new Laya.Vector4(0, 0, 1, 1), ce.COLOR_ID = _e.propertyNameToID("u_Color"),
        ce.TARGET_TEXTURE_ID = _e.propertyNameToID("u_TargetTex"), ce.BASE_TEXTURE_ID = _e.propertyNameToID("u_BaseTex"),
        ce.MASK_TEXTURE_ID = _e.propertyNameToID("u_MaskTex"), ce.REPLACE_TEXTURE_ID = _e.propertyNameToID("u_ReplaceTex"),
        ce.time_ID = _e.propertyNameToID("u_time_1"), ce.OFFSET_ID = _e.propertyNameToID("u_offset"),
        ce.TARGETEXTURE_TEXELSIZE_ID = _e.propertyNameToID("u_TargetTex_TexelSize"), ce.MAINEXTURE_TEXELSIZE_ID = _e.propertyNameToID("u_MainTex_TexelSize"),
        ce.Target_A_ID = _e.propertyNameToID("u_target_a"), ce._UV = new Laya.Vector2(),
        ce.targetTexelSize = new Laya.Vector4(), ce.viewport = new Laya.Viewport(0, 0, 0, 0),
        ce.sourceTexelSize = new Laya.Vector4();
    var Ee = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.apply(this, arguments)).events = new Map(), e;
        }
        return s(t, [{
            key: "onAwake",
            value: function () {
                this.onInit();
            }
        }, {
            key: "onInit",
            value: function () {
                this.ani = this.owner.getComponent(Laya.Animator);
            }
        }, {
            key: "currentAni",
            get: function () {
                return this.ani.getControllerLayer().getCurrentPlayState().animatorState.clip.name;
            }
        }, {
            key: "onSerialization",
            value: function (e) { }
        }, {
            key: "registered",
            value: function (e, a) {
                var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
                this.events.has(e) ? this.events.get(e).add(a, t) : this.events.set(e, TY.Listener.create(a, t));
            }
        }, {
            key: "unRegister",
            value: function (e, a) {
                var t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
                this.events.has(e) && this.events.get(e).remove(a, t);
            }
        }, {
            key: "GraphEvent",
            value: function (e, a, t) {
                var n = this;
                Laya.timer.frameOnce(1, this, function (e) {
                    n.events.has(e) && n.events.get(e).run();
                }, [t], !1);
            }
        }], [{
            key: "listener",
            value: function (e) {
                var a = e.addComponent(t);
                return a || (a = e.addComponent(t)), a;
            }
        }]), t;
    }(Laya.Script3D), Se = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.apply(this, arguments)).triggerEnter = new TY.Listener(),
                e.triggerExit = new TY.Listener(), e.triggerStay = new TY.Listener(), e.collisionEnter = new TY.Listener(),
                e.collisionExit = new TY.Listener(), e.collisionStay = new TY.Listener(), e;
        }
        return s(t, [{
            key: "onAwake",
            value: function () { }
        }, {
            key: "onTriggerEnter",
            value: function (e) {
                this.triggerEnter.run(e);
            }
        }, {
            key: "onTriggerExit",
            value: function (e) {
                this.triggerExit.run(e);
            }
        }, {
            key: "onTriggerStay",
            value: function (e) {
                this.triggerStay.run(e);
            }
        }, {
            key: "onCollisionEnter",
            value: function (e) {
                this.collisionEnter.run(e);
            }
        }, {
            key: "onCollisionExit",
            value: function (e) {
                this.collisionExit.run(e);
            }
        }, {
            key: "onCollisionStay",
            value: function (e) {
                this.collisionStay.run(e);
            }
        }, {
            key: "onDestroy",
            value: function () {
                this.triggerEnter.removeAll(), this.triggerExit.removeAll(), this.triggerStay.removeAll(),
                    this.collisionEnter.removeAll(), this.collisionExit.removeAll(), this.collisionStay.removeAll(),
                    this.triggerEnter = null, this.triggerExit = null, this.triggerStay = null, this.collisionEnter = null,
                    this.collisionExit = null, this.collisionStay = null;
            }
        }], [{
            key: "listener",
            value: function (e) {
                var a = e.getComponent(t);
                return a || (a = e.addComponent(t)), a;
            }
        }]), t;
    }(Laya.Script3D), fe = Laya.PerformancePlugin, Le = Laya.PhysicsSimulation, De = Laya.Physics3D, Te = Laya.PhysicsComponent, ye = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this)).mPhysicsScale = 1, TY.P2Utils && TY.P2Utils.P2PhysicsSettings.enable && (e._p2PhysicsSimulation = new TY.P2Utils.P2PhysicsSimulation()),
                e;
        }
        return s(t, [{
            key: "cannonWorld",
            get: function () {
                return this.cannonPhysicsSimulation._btDiscreteDynamicsWorld;
            }
        }, {
            key: "PhysicsScale",
            get: function () {
                return this.mPhysicsScale;
            },
            set: function (e) {
                this.mPhysicsScale = e;
            }
        }, {
            key: "_update",
            value: function () {
                var e = .001 * n(i(t.prototype), "timer", this).delta;
                if (this._time += e, this._shaderValues.setNumber(Laya.Scene3D.TIME, this._time),
                    De._enablePhysics && !Le.disableSimulation && !Config3D._config.isUseCannonPhysicsEngine) {
                    var a = this._physicsSimulation;
                    a._updatePhysicsTransformFromRender(), Te._addUpdateList = !1, fe.begainSample(fe.PERFORMANCE_LAYA_3D_PHYSICS_SIMULATE),
                        a._simulate(e), fe.endSample(fe.PERFORMANCE_LAYA_3D_PHYSICS_SIMULATE), fe.begainSample(fe.PERFORMANCE_LAYA_3D_PHYSICS_CHARACTORCOLLISION),
                        a._updateCharacters(), Te._addUpdateList = !0, a._updateCollisions(), fe.endSample(fe.PERFORMANCE_LAYA_3D_PHYSICS_CHARACTORCOLLISION),
                        fe.begainSample(fe.PERFORMANCE_LAYA_3D_PHYSICS_EVENTSCRIPTS), a._eventScripts(),
                        fe.endSample(fe.PERFORMANCE_LAYA_3D_PHYSICS_EVENTSCRIPTS);
                }
                if (TY.P2Utils && TY.P2Utils.P2PhysicsSettings.enable) {
                    var r = this._p2PhysicsSimulation;
                    r._updatePhysicsTransformFromRender(), TY.P2Utils.P2PhysicsComponent._addUpdateList = !1,
                        r._simulate(e), TY.P2Utils.P2PhysicsComponent._addUpdateList = !0, r._updateCollisions(),
                        r._eventScripts();
                }
                if (Laya.Physics3D._cannon && Config3D._config.isUseCannonPhysicsEngine) {
                    var o = this._cannonPhysicsSimulation;
                    o._updatePhysicsTransformFromRender(), Laya.CannonPhysicsComponent._addUpdateList = !1,
                        o._simulate(e), Laya.CannonPhysicsComponent._addUpdateList = !0, o._updateCollisions(),
                        o._eventScripts();
                }
                fe.endSample(fe.PERFORMANCE_LAYA_3D_PHYSICS), fe.begainSample(fe.PERFORMANCE_LAYA_3D_UPDATESCRIPT),
                    this._input._update(), this._clearScript(), this._updateScript(), Laya.Animator._update(this),
                    Laya.VideoTexture && Laya.VideoTexture._update(), this._reflectionProbeManager._needUpdateAllRender ? this._reflectionProbeManager.updateAllRenderObjects(this._renders) : this._reflectionProbeManager.update(),
                    this._lateUpdateScript(), fe.endSample(fe.PERFORMANCE_LAYA_3D_UPDATESCRIPT), fe.endSample(fe.PERFORMANCE_LAYA_3D);
            }
        }]), t;
    }(Laya.Scene3D), Re = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "init",
            value: function () { }
        }, {
            key: "spriteRenderResGetUrls",
            value: function (e, a, t, n, i, r, o, s) {
                var l = e.props;
                l.material && (l.material = me.addHierarchyInnerUrls(t, r, o, s, l.material, Laya3D.MATERIAL)),
                    console.log(l.material);
            }
        }]), e;
    }(),
        me = function () {
            function e() {
                l(this, e);
            }
            return s(e, null, [{
                key: "regSprite3DType",
                value: function (e, a) {
                    this.createTypes.set(e, a);
                }
            }, {
                key: "regHierarchyComResGet",
                value: function (e, a) {
                    this.setComResMap.set(e, a);
                }
            }, {
                key: "regHierarchyResGet",
                value: function (e, a) {
                    this.setHierarchyResMap.set(e, a);
                }
            }, {
                key: "init",
                value: function () {
                    console.log("mememeemmeme")
                    this.addHierarchyInnerUrls = Laya3D._addHierarchyInnerUrls.bind(Laya3D),
                        Laya.Scene3DUtils._createSprite3DInstance = this._createSprite3DInstance.bind(this),
                        Laya3D._getSprite3DHierarchyInnerUrls = this._getSprite3DHierarchyInnerUrls.bind(this);
                    var e = Object.getOwnPropertyDescriptor(Laya.BlinnPhongMaterial.prototype, "transmissionRate");
                    Object.defineProperty(Laya.BlinnPhongMaterial.prototype, "transmissionRate", {
                        get: function () {
                            return e.get.call(this);
                        },
                        set: function (e) {
                            this.transmissionRata = e;
                        }
                    }),
                        Re.init();
                }
            }, {
                key: "_createSprite3DInstance",
                value: function (a, t, n) {
                    var i;
                    if (this.createTypes.has(a.type)) i = e.createTypes.get(a.type)(a, t, n); else switch (a.type) {
                        case "Scene3D":
                            i = new ye();
                            break;

                        case "Sprite3D":
                            i = new Laya.Sprite3D();
                            break;

                        case "MeshSprite3D":
                            i = new Laya.MeshSprite3D(), n && a.props.isStatic && n.push(i);
                            break;

                        case "SkinnedMeshSprite3D":
                            i = new Laya.SkinnedMeshSprite3D();
                            break;

                        case "SimpleSkinnedMeshSprite3D":
                            i = new Laya.SimpleSkinnedMeshSprite3D();
                            break;

                        case "ShuriKenParticle3D":
                            i = new Laya.ShuriKenParticle3D();
                            break;

                        case "Camera":
                            i = new Laya.Camera();
                            break;

                        case "DirectionLight":
                            i = new Laya.DirectionLight();
                            break;

                        case "PointLight":
                            i = new Laya.PointLight();
                            break;

                        case "SpotLight":
                            i = new Laya.SpotLight();
                            break;

                        case "TrailSprite3D":
                            i = new Laya.TrailSprite3D();
                            break;

                        case "ReflectionProbe":
                            i = new Laya.ReflectionProbe();
                            break;

                        default:
                            if (!e.createTypes.has(a.type)) throw new Error("Utils3D:unidentified class type in (.lh) file. type:" + a.type);
                            i = e.createTypes.get(a.type)(a, t, n);
                    }
                    var r = a.child;
                    if (r) for (var o = 0, s = r.length; o < s; o++) {
                        var l = this._createSprite3DInstance(r[o], t, n);
                        i.addChild(l);
                    }
                    return t[a.instanceID] = i, i;
                }
            }, {
                key: "_getSprite3DHierarchyInnerUrls",
                value: function (a, t, n, i, r, o, s, l) {
                    var u, h, d = a.props;
                    if (e.setHierarchyResMap.has(a.type)) {
                        var _ = e.setHierarchyResMap.get(a.type);
                        null != _ && _(a, t, n, i, r, o, s, l);
                    }
                    switch (a.type) {
                        case "Scene3D":
                            var c = d.lightmaps;
                            for (u = 0, h = c.length; u < h; u++) {
                                var E = c[u];
                                if (E.path) E.path = this.addHierarchyInnerUrls(r, o, s, l, E.path, Laya3D.TEXTURE2D, E.constructParams, E.propertyParams); else {
                                    var S = E.color;
                                    S.path = this.addHierarchyInnerUrls(r, o, s, l, S.path, Laya3D.TEXTURE2D, S.constructParams, S.propertyParams);
                                    var f = E.direction;
                                    f && (f.path = this.addHierarchyInnerUrls(r, o, s, l, f.path, Laya3D.TEXTURE2D, f.constructParams, f.propertyParams));
                                }
                            }
                            var L = d.reflectionTexture;
                            L && (d.reflection = this.addHierarchyInnerUrls(i, o, s, l, L, Laya3D.TEXTURECUBE));
                            var D = d.reflection;
                            if (D && (d.reflection = this.addHierarchyInnerUrls(r, o, s, l, D, Laya3D.TEXTURECUBEBIN)),
                                d.sky) {
                                var T = d.sky.material;
                                T && (T.path = this.addHierarchyInnerUrls(n, o, s, l, T.path, Laya3D.MATERIAL));
                            }
                            break;

                        case "Camera":
                            var y = d.skyboxMaterial;
                            y && (y.path = this.addHierarchyInnerUrls(n, o, s, l, y.path, Laya3D.MATERIAL));
                            break;

                        case "TrailSprite3D":
                        case "MeshSprite3D":
                        case "SkinnedMeshSprite3D":
                        case "SimpleSkinnedMeshSprite3D":
                            var R = d.meshPath;
                            R && (d.meshPath = this.addHierarchyInnerUrls(t, o, s, l, R, Laya3D.MESH));
                            var m = d.materials;
                            if (m) for (u = 0, h = m.length; u < h; u++) m[u].path = this.addHierarchyInnerUrls(n, o, s, l, m[u].path, Laya3D.MATERIAL);
                            "SimpleSkinnedMeshSprite3D" == a.type && d.animatorTexture && (d.animatorTexture = this.addHierarchyInnerUrls(r, o, s, l, d.animatorTexture, Laya3D.SIMPLEANIMATORBIN));
                            break;

                        case "ShuriKenParticle3D":
                            if (d.main) {
                                var g = d.renderer.resources, p = g.mesh, I = g.material;
                                p && (g.mesh = this.addHierarchyInnerUrls(t, o, s, l, p, Laya3D.MESH)), I && (g.material = this.addHierarchyInnerUrls(n, o, s, l, I, Laya3D.MATERIAL));
                            } else {
                                var P = d.meshPath;
                                P && (d.meshPath = this.addHierarchyInnerUrls(t, o, s, l, P, Laya3D.MESH)), d.material.path = this.addHierarchyInnerUrls(n, o, s, l, d.material.path, Laya3D.MATERIAL);
                            }
                            break;

                        case "Terrain":
                            this.addHierarchyInnerUrls(r, o, s, l, d.dataPath, Laya3D.TERRAINRES);
                            break;

                        case "ReflectionProbe":
                            var v = d.reflection;
                            v && (d.reflection = this.addHierarchyInnerUrls(t, o, s, l, v, Laya3D.TEXTURECUBEBIN));
                    }
                    var A = a.components;
                    if (A) for (var C = 0, O = A.length; C < O; C++) {
                        var M = A[C], N = e.setComResMap.has(M.type) ? e.setComResMap.get(M.type) : null;
                        switch (N && N(M, t, n, i, r, o, s, l), M.type) {
                            case "Animator":
                                M.avatarPath;
                                var x = M.avatar;
                                x && (x.path = this.addHierarchyInnerUrls(r, o, s, l, x.path, Laya3D.AVATAR));
                                var w = M.clipPaths;
                                if (w) for (u = 0, h = w.length; u < h; u++) w[u] = this.addHierarchyInnerUrls(r, o, s, l, w[u], Laya3D.ANIMATIONCLIP); else {
                                    var V = M.layers;
                                    for (u = 0; u < V.length; u++) for (var B = V[u].states, k = 0, b = B.length; k < b; k++) {
                                        var H = B[k].clipPath;
                                        H && (B[k].clipPath = this.addHierarchyInnerUrls(r, o, s, l, H, Laya3D.ANIMATIONCLIP));
                                    }
                                }
                                break;

                            case "PhysicsCollider":
                            case "Rigidbody3D":
                            case "CharacterController":
                                var U = M.shapes;
                                for (u = 0; u < U.length; u++) {
                                    var F = U[u];
                                    if ("MeshColliderShape" === F.type) {
                                        var G = F.mesh;
                                        G && (F.mesh = this.addHierarchyInnerUrls(t, o, s, l, G, Laya3D.MESH));
                                    }
                                }
                        }
                    }
                    var W = a.child;
                    for (u = 0, h = W.length; u < h; u++) e._getSprite3DHierarchyInnerUrls(W[u], t, n, i, r, o, s, l);
                }
            }]), e;
        }();
    me.createTypes = new Map(), me.setHierarchyResMap = new Map(), me.setComResMap = new Map();
    var ge = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "init",
            value: function () {
                Laya.Quaternion.inverse = function (e, a) {
                    a.x = -e.x, a.y = -e.y, a.z = -e.z, a.w = e.w;
                }, Laya.Quaternion.rotateVectorByQuat = function (e, a, t) {
                    var n = 2 * e.x, i = 2 * e.y, r = 2 * e.z, o = e.x * n, s = e.y * i, l = e.z * r, u = e.x * i, h = e.x * r, d = e.y * r, _ = e.w * n, c = e.w * i, E = e.w * r;
                    t.x = (1 - (s + l)) * a.x + (u - E) * a.y + (h + c) * a.z, t.y = (u + E) * a.x + (1 - (o + l)) * a.y + (d - _) * a.z,
                        t.z = (h - c) * a.x + (d + _) * a.y + (1 - (o + s)) * a.z;
                };
            }
        }, {
            key: "lookAt",
            value: function (e, a, t, n) {
                var i = arguments.length > 4 && void 0 !== arguments[4] && arguments[4], r = this._m.elements, o = this.temp_v3_1, s = this.temp_v3_2, l = this.temp_v3_3;
                i ? Laya.Vector3.subtract(e, a, o) : Laya.Vector3.subtract(a, e, o), 0 === Laya.Vector3.scalarLengthSquared(o) && (o.z = 1),
                    Laya.Vector3.normalize(o, o), Laya.Vector3.cross(t, o, s), 1 === Laya.Vector3.scalarLengthSquared(t.z) ? o.x += 1e-4 : o.z += .001,
                    Laya.Vector3.normalize(o, o), Laya.Vector3.cross(t, o, s), Laya.Vector3.normalize(s, s),
                    Laya.Vector3.cross(o, s, l), r[0] = s.x, r[4] = l.x, r[8] = o.x, r[1] = s.y, r[5] = l.y,
                    r[9] = o.y, r[2] = s.z, r[6] = l.z, r[10] = o.z;
                var u = r[0], h = r[4], d = r[8], _ = r[1], c = r[5], E = r[9], S = r[2], f = r[6], L = r[10], D = u + c + L;
                if (D > 0) {
                    var T = .5 / Math.sqrt(D + 1);
                    n.w = .25 / T, n.x = (f - E) * T, n.y = (d - S) * T, n.z = (_ - h) * T;
                } else if (u > c && u > L) {
                    var y = 2 * Math.sqrt(1 + u - c - L);
                    n.w = (f - E) / y, n.x = .25 * y, n.y = (h + _) / y, n.z = (d + S) / y;
                } else if (c > L) {
                    var R = 2 * Math.sqrt(1 + c - u - L);
                    n.w = (d - S) / R, n.x = (h + _) / R, n.y = .25 * R, n.z = (E + f) / R;
                } else {
                    var m = 2 * Math.sqrt(1 + L - u - c);
                    n.w = (_ - h) / m, n.x = (d + S) / m, n.y = (E + f) / m, n.z = .25 * m;
                }
            }
        }, {
            key: "multiplyPos",
            value: function (e, a, t) {
                Laya.Vector3.transformQuat(a, e, t);
            }
        }, {
            key: "rotationFromTo",
            value: function (e, a, t) {
                var n = this.temp_v3_1;
                Laya.Vector3.normalize(e, n);
                var i = this.temp_v3_2;
                Laya.Vector3.normalize(a, i);
                var r = Laya.Vector3.dot(n, i);
                if (r >= 1) t.identity(); else {
                    if (r < -1 + Number.EPSILON) {
                        var o = this.temp_v3_2;
                        return this.temp_v3_3.setValue(1, 0, 0), Laya.Vector3.cross(this.temp_v3_3, n, o),
                            0 === Laya.Vector3.scalarLengthSquared(o) && (this.temp_v3_3.setValue(0, 1, 0),
                                Laya.Vector3.cross(this.temp_v3_3, n, o)), Laya.Vector3.normalize(o, o), void Laya.Quaternion.createFromAxisAngle(o, Math.PI, t);
                    }
                    Laya.Vector3.cross(n, i, this.temp_v3_1), t.x = this.temp_v3_1.x, t.y = this.temp_v3_1.y,
                        t.z = this.temp_v3_1.z, t.w = 1 + r, t.normalize(t);
                }
            }
        }]), e;
    }();
    ge._m = new Laya.Matrix4x4(), ge.epsilon = 1e-5, ge.temp_v3_1 = new Laya.Vector3(),
        ge.temp_v3_2 = new Laya.Vector3(), ge.temp_v3_3 = new Laya.Vector3();
    var pe = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "init",
            value: function () {
                Laya.Transform3D.prototype.inverseTransformDirection = function (a, t) {
                    var n = e.tempQ;
                    Laya.Quaternion.invert(this.rotation, n), Laya.Vector3.transformQuat(a, n, t);
                }, Laya.Transform3D.prototype.transformDirection = function (e, a) {
                    Laya.Vector3.transformQuat(e, this.rotation, a);
                }, Laya.Transform3D.prototype.rotateAroundSafe = function (a, t) {
                    var n = e.temp_V3;
                    if (this.inverseTransformDirection(a, n), Laya.Vector3.scalarLengthSquared(n) > Number.EPSILON) {
                        Laya.Vector3.normalize(n, n);
                        var i = e.tempQ;
                        Laya.Quaternion.createFromAxisAngle(n, t, i);
                        var r = this.localRotation;
                        Laya.Quaternion.multiply(r, i, r), r.normalize(r), this.localRotation = r;
                    }
                }, Laya.Transform3D.prototype.rotateAxis = function (a, t) {
                    var n = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], i = e.temp_V3;
                    n ? this.inverseTransformDirection(a, i) : a.cloneTo(i), this.rotateAroundSafe(i, t * Math.Deg2Rad);
                }, Laya.Transform3D.prototype.rotateAroundPoint = function (a, t, n) {
                    var i = e.tempQ, r = e.temp_V3;
                    Laya.Vector3.subtract(this.position, a, r), Laya.Quaternion.createFromAxisAngle(t, n * Math.Deg2Rad, i),
                        Laya.Vector3.transformQuat(r, i, r);
                    var o = this.position;
                    Laya.Vector3.add(this.position, r, o), this.position = o, this.rotateAroundSafe(t, n * Math.Deg2Rad);
                };
            }
        }]), e;
    }();
    pe.tempQ = new Laya.Quaternion(), pe.temp_V3 = new Laya.Vector3();
    var Ie = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "getRotMatrixNormVec",
            value: function (e, a, t) {
                var n, i, r, o, s, l, u, h, d, _, c, E, S, f;
                n = Math.sin(t), i = Math.cos(t), r = a.x;
                var L = function (a, t, n) {
                    e.elements[3 * a + t] = n;
                };
                return l = (o = a.y) * o, u = (s = a.z) * s, h = r * o, d = o * s, _ = s * r, c = r * n,
                    E = o * n, S = s * n, L(0, 0, (f = 1 - i) * (r * r) + i), L(1, 0, f * h - S), L(2, 0, f * _ + E),
                    L(0, 1, f * h + S), L(1, 1, f * l + i), L(2, 1, f * d - c), L(0, 2, f * _ - E),
                    L(1, 2, f * d + c), L(2, 2, f * u + i), e;
            }
        }, {
            key: "setAxisAngle",
            value: function (e, a, t) {
                return this.getRotMatrixNormVec(t, e, a), t;
            }
        }, {
            key: "multiplyVector3",
            value: function (e, a, t) {
                t.x = e.elements[0] * a.x + e.elements[3] * a.y + e.elements[6] * a.z, t.y = e.elements[1] * a.x + e.elements[4] * a.y + e.elements[7] * a.z,
                    t.z = e.elements[2] * a.x + e.elements[5] * a.y + e.elements[8] * a.z;
            }
        }]), e;
    }(), Pe = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "init",
            value: function () {
                Laya.Vector3.project = function (e, a, t) {
                    var n = Laya.Vector3.dot(a, a);
                    return n < Number.EPSILON ? t.setValue(0, 0, 0) : (Laya.Vector3.scale(a, Laya.Vector3.dot(e, a), t),
                        Laya.Vector3.scale(t, 1 / n, t)), t;
                }, Laya.Vector3.projectOnPlane = function (e, a, t) {
                    return Laya.Vector3.project(e, a, t), Laya.Vector3.subtract(e, t, t), t;
                };
            }
        }, {
            key: "orthoNormalVectorFast",
            value: function (e, a) {
                var t = e.x, n = e.y, i = e.z;
                if (Math.abs(i) > this.k1OverSqrt2) {
                    var r = n * n + i * i, o = 1 / Math.sqrt(r);
                    a.x = 0, a.y = -i * o, a.z = n * o;
                } else {
                    var s = t * t + n * n, l = 1 / Math.sqrt(s);
                    a.x = -n * l, a.y = t * l, a.z = 0;
                }
                return a;
            }
        }, {
            key: "slerp",
            value: function (e, a, t, n) {
                var i = Laya.Vector3.scalarLength(e), r = Laya.Vector3.scalarLength(a);
                if (i < this.epsilon || r < this.epsilon) return Laya.Vector3.lerp(e, a, t, n),
                    n;
                var o = Math.lerp(i, r, t), s = Laya.Vector3.dot(e, a) / (i * r);
                if (s > 1 - this.epsilon) return Laya.Vector3.lerp(e, a, t, n), n;
                if (s < -1 + this.epsilon) {
                    this.temp_v3.setValue(e.x / i, e.y / i, e.z / i);
                    var l = this.temp_v3_2;
                    this.orthoNormalVectorFast(this.temp_v3, l);
                    var u = new Laya.Matrix3x3();
                    return Ie.setAxisAngle(l, this.kPI * t, u), Ie.multiplyVector3(u, this.temp_v3, n),
                        Laya.Vector3.scale(n, o, n), n;
                }
                var h = this.temp_v3_2;
                Laya.Vector3.cross(e, a, h), Laya.Vector3.normalize(h, h);
                var d = Math.acos(s) * t;
                this.temp_v3.setValue(e.x / i, e.y / i, e.z / i);
                var _ = new Laya.Matrix3x3();
                return Ie.setAxisAngle(h, d, _), Ie.multiplyVector3(_, this.temp_v3, n), Laya.Vector3.scale(n, o, n),
                    n;
            }
        }]), e;
    }();
    Pe.epsilon = 1e-5, Pe.k1OverSqrt2 = .7071067811865476, Pe.kPI = Math.PI, Pe.temp_v3 = new Laya.Vector3(),
        Pe.temp_v3_2 = new Laya.Vector3(), Math.Deg2Rad = .01745329, Math.Rad2Deg = 57.29578,
        Math.clamp = function (e, a, t) {
            return e > t ? t : e < a ? a : e;
        }, Math.clamp01 = function (e) {
            return e < 0 ? 0 : e > 1 ? 1 : e;
        }, Math.inverseLerp = function (e, a, t) {
            return e != a ? Math.clamp01((t - e) / (a - e)) : 0;
        }, Math.lerp = function (e, a, t) {
            return e + (a - e) * Math.clamp01(t);
        };
    var ve = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "init",
            value: function () {
                this.setExtFunc(), me.init(), ge.init(), pe.init(), Pe.init();
            }
        }, {
            key: "setExtFunc",
            value: function () {
                Laya.Sprite3D.prototype.sendMessage = function (e) {
                    if (this._scripts) {
                        for (var a = arguments.length, t = new Array(a > 1 ? a - 1 : 0), n = 1; n < a; n++) t[n - 1] = arguments[n];
                        for (var i = 0; i < this._scripts.length; i++) {
                            var r = this._scripts[i], o = r[e];
                            null != o && o.apply(r, t);
                        }
                    }
                };
            }
        }]), e;
    }();
    function Ae() {
        ve.init(),
            me.init(),
            ce.init();
    }
    var Ce, Oe, Me = Object.freeze({
        __proto__: null,
        engineInit: Ae,
        ByteBuffer: function (e) {
            r(t, e);
            var a = o(t);
            function t() {
                var e, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
                return l(this, t), (e = a.call(this, n)).endian = Laya.Byte.LITTLE_ENDIAN, e;
            }
            return s(t, [{
                key: "readBytes",
                value: function () {
                    var e = this.readUint16();
                    return this.readArrayBuffer(e);
                }
            }, {
                key: "readColor",
                value: function () {
                    var e = this.readUint8(), a = this.readUint8(), t = this.readUint8(), n = this.readUint8();
                    return new Laya.Color(e, a, t, n);
                }
            }, {
                key: "writeColor",
                value: function (e) {
                    this.writeUint8(e.r), this.writeUint8(e.g), this.writeUint8(e.b), this.writeUint8(e.a);
                }
            }, {
                key: "readVec2",
                value: function () {
                    var e = this.readFloat32(), a = this.readFloat32();
                    return new Laya.Vector2(e, a);
                }
            }, {
                key: "writeVec2",
                value: function (e) {
                    this.writeFloat32(e.x), this.writeFloat32(e.y);
                }
            }, {
                key: "readVec3",
                value: function () {
                    var e = this.readFloat32(), a = this.readFloat32(), t = this.readFloat32();
                    return new Laya.Vector3(e, a, t);
                }
            }, {
                key: "writeVec3",
                value: function (e) {
                    this.writeFloat32(e.x), this.writeFloat32(e.y), this.writeFloat32(e.z);
                }
            }, {
                key: "readVec4",
                value: function () {
                    var e = this.readFloat32(), a = this.readFloat32(), t = this.readFloat32(), n = this.readFloat32();
                    return new Laya.Vector4(e, a, t, n);
                }
            }, {
                key: "writeVec4",
                value: function (e) {
                    this.writeFloat32(e.x), this.writeFloat32(e.y), this.writeFloat32(e.z), this.writeFloat32(e.w);
                }
            }, {
                key: "readBool",
                value: function () {
                    return 1 == this.readUint8();
                }
            }, {
                key: "waitBool",
                value: function (e) {
                    this.writeUint8(e ? 1 : 0);
                }
            }]), t;
        }(Laya.Byte),
        EngineExtension: me,
        LayaExtension: ve,
        Matrix3x3Utils: Ie,
        QuaternionExtension: ge,
        Sprite3dHierarchyExtension: Re,
        TransformExtension: pe,
        TYScene3D: ye,
        Vector3Extension: Pe
    }), Ne = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.apply(this, arguments)).mVelocity = new Laya.Vector3(),
                e.gravity = 9.8, e.useGravity = !1, e.mass = 1, e;
        }
        return s(t, [{
            key: "velocity",
            get: function () {
                return this.mVelocity;
            },
            set: function (e) {
                this.mVelocity.setValue(e.x, e.y, e.z);
            }
        }, {
            key: "tran",
            get: function () {
                return this.owner.transform;
            }
        }, {
            key: "onAwake",
            value: function () {
                n(i(t.prototype), "onAwake", this).call(this), this.initPos = this.tran.position.clone(),
                    this.initRot = this.tran.rotation.clone();
            }
        }, {
            key: "onUpdate",
            value: function () {
                var e = .001 * Laya.timer.delta;
                if (!(e > 1)) {
                    this.useGravity && (this.mVelocity.y -= this.gravity * e);
                    var a = this.owner, r = a.transform.position;
                    r.x += this.mVelocity.x * e, r.y += this.mVelocity.y * e, r.z += this.mVelocity.z * e,
                        a.transform.position = r, n(i(t.prototype), "onUpdate", this).call(this);
                }
            }
        }, {
            key: "addExplosionForce",
            value: function (e, a) {
                var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : -1;
                Laya.Vector3.subtract(this.tran.position, e, t.temp_v3);
                var i = Laya.Vector3.scalarLength(t.temp_v3), r = 1 / i, o = n <= 0 ? 1 : TY.Utils.clamp01(1 - i / n);
                this.mVelocity.x = t.temp_v3.x * r * a / this.mass * o, this.mVelocity.y = t.temp_v3.y * r * a / this.mass * o,
                    this.mVelocity.z = t.temp_v3.z * r * a / this.mass * o, this.useGravity = !0;
            }
        }, {
            key: "rest",
            value: function () {
                var e = this.tran.position, a = this.tran.rotation;
                this.initPos && this.initPos.cloneTo(e), this.initRot && this.initRot.cloneTo(a),
                    this.tran.position = e, this.tran.rotation = a, this.mVelocity.setValue(0, 0, 0),
                    this.useGravity = !1;
            }
        }, {
            key: "_cloneTo",
            value: function (e) {
                n(i(t.prototype), "_cloneTo", this).call(this, e), this.velocity.cloneTo(e.velocity),
                    e.useGravity = !1, e.mass = this.mass, e.gravity = this.gravity;
            }
        }]), t;
    }(Laya.Script3D);
    Ne.temp_v3 = new Laya.Vector3(), function (e) {
        e[e.xyz = 0] = "xyz", e[e.xy = 1] = "xy", e[e.xz = 2] = "xz";
    }(Ce || (Ce = {}));
    var xe = function () {
        function e(a) {
            var t = this;
            l(this, e), this.space = Ce.xyz, this.isClosed = !1, this.points = [], a.forEach(function (e) {
                t.points.push(e);
            });
        }
        return s(e, [{
            key: "getPoint",
            value: function (e) {
                return this.points[e];
            }
        }, {
            key: "loopIndex",
            value: function (e) {
                return (e + this.points.length) % this.points.length;
            }
        }, {
            key: "numAnchorPoints",
            get: function () {
                var e = this.isClosed ? this.points.length / 3 : (this.points.length + 2) / 3;
                return Math.floor(e);
            }
        }, {
            key: "numSegments",
            get: function () {
                return Math.floor(this.points.length / 3);
            }
        }, {
            key: "getPointsInSegment",
            value: function (e) {
                return e = TY.Utils.clamp(e, 0, this.numSegments - 1), [this.getPoint(3 * e), this.getPoint(3 * e + 1), this.getPoint(3 * e + 2), this.getPoint(this.loopIndex(3 * e + 3))];
            }
        }]), e;
    }(), we = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "minAngle",
            value: function (e, a, t) {
                return Laya.Vector3.subtract(e, a, this.temp_v3_1), Laya.Vector3.subtract(t, a, this.temp_v3_2),
                    this.angle(this.temp_v3_1, this.temp_v3_2);
            }
        }, {
            key: "angle",
            value: function (e, a) {
                var t = Math.sqrt(Laya.Vector3.scalarLengthSquared(e) * Laya.Vector3.scalarLengthSquared(a));
                return t < 1.00000000362749e-15 ? 0 : 57.29578 * Math.acos(TY.Utils.clamp(Laya.Vector3.dot(e, a) / t, -1, 1));
            }
        }, {
            key: "closestPointOnLineSegment",
            value: function (e, a, t, n) {
                Laya.Vector3.subtract(t, a, this.temp_v3_1), Laya.Vector3.subtract(e, a, this.temp_v3_2);
                var i = Laya.Vector3.scalarLengthSquared(this.temp_v3_1);
                if (0 == i) a.cloneTo(n); else {
                    var r = TY.Utils.clamp01(Laya.Vector3.dot(this.temp_v3_1, this.temp_v3_2) / i);
                    Laya.Vector3.scale(this.temp_v3_1, r, this.temp_v3_1), Laya.Vector3.add(a, this.temp_v3_1, n);
                }
            }
        }]), e;
    }();
    we.temp_v3_1 = new Laya.Vector3(), we.temp_v3_2 = new Laya.Vector3(), we.forward = new Laya.Vector3(0, 0, 1),
        we.temp_q = new Laya.Quaternion(), we.up = new Laya.Vector3(0, 1, 0), we.one = new Laya.Vector3(1, 1, 1);
    var Ve = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "evaluateCurve",
            value: function () {
                for (var e, a, t, n, i, r = 0, o = arguments.length, s = new Array(o), l = 0; l < o; l++) s[l] = arguments[l];
                s[0] instanceof Array ? (e = s[0][0], a = s[0][1], n = s[0][2], t = s[0][3], r = s[1],
                    i = s[2]) : (e = s[0], a = s[1], n = s[2], t = s[3], r = s[4], i = s[5]);
                var u = 1 - (r = TY.Utils.clamp01(r));
                u *= u * u, e.cloneTo(this.temp_V3_1), Laya.Vector3.scale(this.temp_V3_1, u, this.temp_V3_1),
                    u = 3 * (u = 1 - r) * u * r, a.cloneTo(this.temp_V3_2), Laya.Vector3.scale(this.temp_V3_2, u, this.temp_V3_2),
                    Laya.Vector3.add(this.temp_V3_1, this.temp_V3_2, this.temp_V3_1), u = 3 * (1 - r) * r * r,
                    n.cloneTo(this.temp_V3_2), Laya.Vector3.scale(this.temp_V3_2, u, this.temp_V3_2),
                    Laya.Vector3.add(this.temp_V3_1, this.temp_V3_2, this.temp_V3_1), u = r * r * r,
                    t.cloneTo(this.temp_V3_2), Laya.Vector3.scale(this.temp_V3_2, u, this.temp_V3_2),
                    Laya.Vector3.add(this.temp_V3_1, this.temp_V3_2, this.temp_V3_1), this.temp_V3_1.cloneTo(i);
            }
        }, {
            key: "evaluateCurveDerivative",
            value: function () {
                for (var e, a, t, n, i, r = 0, o = arguments.length, s = new Array(o), l = 0; l < o; l++) s[l] = arguments[l];
                s[0] instanceof Array ? (e = s[0][0], a = s[0][1], n = s[0][2], t = s[0][3], r = s[1],
                    i = s[2]) : (e = s[0], a = s[1], n = s[2], t = s[3], r = s[4], i = s[5]), r = TY.Utils.clamp01(r),
                    Laya.Vector3.subtract(a, e, this.temp_V3_1), Laya.Vector3.scale(this.temp_V3_1, 3 * (1 - r) * (1 - r), this.temp_V3_1),
                    Laya.Vector3.subtract(n, a, this.temp_V3_2), Laya.Vector3.scale(this.temp_V3_2, 6 * (1 - r) * r, this.temp_V3_2),
                    Laya.Vector3.add(this.temp_V3_2, this.temp_V3_1, this.temp_V3_1), Laya.Vector3.subtract(t, n, this.temp_V3_2),
                    Laya.Vector3.scale(this.temp_V3_2, 3 * r * r, this.temp_V3_2), Laya.Vector3.add(this.temp_V3_2, this.temp_V3_1, this.temp_V3_1),
                    this.temp_V3_1.cloneTo(i);
            }
        }, {
            key: "evaluateCurveSecondDerivative",
            value: function () {
                for (var e, a, t, n, i, r = 0, o = arguments.length, s = new Array(o), l = 0; l < o; l++) s[l] = arguments[l];
                s[0] instanceof Array ? (e = s[0][0], a = s[0][1], n = s[0][2], t = s[0][3], r = s[1],
                    i = s[2]) : (e = s[0], a = s[1], n = s[2], t = s[3], r = s[4], i = s[5]);
                var u = 6 * (1 - (r = TY.Utils.clamp01(r)));
                Laya.Vector3.scale(a, 2, this.temp_V3_1), Laya.Vector3.subtract(n, this.temp_V3_1, this.temp_V3_1),
                    Laya.Vector3.add(this.temp_V3_1, e, this.temp_V3_1), Laya.Vector3.scale(this.temp_V3_1, u, this.temp_V3_1),
                    Laya.Vector3.scale(n, 2, this.temp_V3_2), Laya.Vector3.subtract(t, this.temp_V3_2, this.temp_V3_2),
                    Laya.Vector3.add(this.temp_V3_2, a, this.temp_V3_2), Laya.Vector3.scale(this.temp_V3_2, 6 * r, this.temp_V3_2),
                    Laya.Vector3.add(this.temp_V3_2, this.temp_V3_1, this.temp_V3_1), this.temp_V3_1.cloneTo(i);
            }
        }, {
            key: "normal",
            value: function () {
                for (var e, a, t, n, i, r = 0, o = arguments.length, s = new Array(o), l = 0; l < o; l++) s[l] = arguments[l];
                s[0] instanceof Array ? (e = s[0][0], a = s[0][1], n = s[0][2], t = s[0][3], r = s[1],
                    i = s[2]) : (e = s[0], a = s[1], n = s[2], t = s[3], r = s[4], i = s[5]), r = TY.Utils.clamp01(r),
                    this.evaluateCurveDerivative(e, a, n, t, r, this.temp_V3_1), this.evaluateCurveSecondDerivative(e, a, n, t, r, this.temp_V3_2),
                    Laya.Vector3.cross(this.temp_V3_2, this.temp_V3_1, i), Laya.Vector3.cross(i, this.temp_V3_1, i),
                    Laya.Vector3.normalize(i, i);
            }
        }, {
            key: "estimateCurveLength",
            value: function (e, a, t, n) {
                var i = Laya.Vector3.distance(e, a) + Laya.Vector3.distance(a, t) + Laya.Vector3.distance(t, n);
                return Laya.Vector3.distance(e, n) + i / 2;
            }
        }]), e;
    }();
    Ve.temp_V3_1 = new Laya.Vector3(), Ve.temp_V3_2 = new Laya.Vector3();
    var Be = function () {
        function e() {
            l(this, e), this.Min = new Laya.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE),
                this.Max = new Laya.Vector3(Number.MIN_VALUE, Number.MIN_VALUE, Number.MIN_VALUE);
        }
        return s(e, [{
            key: "AddValue",
            value: function (e) {
                this.Min.setValue(Math.min(this.Min.x, e.x), Math.min(this.Min.y, e.y), Math.min(this.Min.z, e.z)),
                    this.Max.setValue(Math.max(this.Max.x, e.x), Math.max(this.Max.y, e.y), Math.max(this.Max.z, e.z));
            }
        }]), e;
    }(), ke = s(function e() {
        l(this, e), this.vertices = [], this.tangents = [], this.cumulativeLength = [],
            this.anchorVertexMap = [], this.minMax = new Be();
    }), be = function () {
        function e() {
            l(this, e);
        }
        return s(e, null, [{
            key: "splitBezierPathByAngleError",
            value: function (e, a, t, n) {
                var i = new ke();
                i.vertices.push(e.getPoint(0).clone());
                var r = new Laya.Vector3();
                Ve.evaluateCurveDerivative(e.getPointsInSegment(0), 0, r), i.tangents.push(r), i.cumulativeLength.push(0),
                    i.anchorVertexMap.push(0), i.minMax.AddValue(e.getPoint(0));
                for (var o = e.getPoint(0), s = e.getPoint(0), l = 0, u = 0, h = 0; h < e.numSegments; h++) {
                    for (var d = e.getPointsInSegment(h), _ = Ve.estimateCurveLength(d[0], d[1], d[2], d[3]), c = 1 / Math.ceil(_ * n), E = c; E <= 1; E += c) {
                        var S = E + c > 1 && h == e.numSegments - 1;
                        S && (E = 1);
                        var f = new Laya.Vector3(), L = new Laya.Vector3();
                        Ve.evaluateCurve(d, E, f), Ve.evaluateCurve(d, E + c, L);
                        var D = 180 - we.minAngle(o, f, L), T = 180 - we.minAngle(s, f, L);
                        if (Math.max(D, T) > a && u >= t || S) {
                            l += Laya.Vector3.distance(s, f), i.cumulativeLength.push(l), i.vertices.push(f);
                            var y = new Laya.Vector3();
                            Ve.evaluateCurveDerivative(d, E, y), Laya.Vector3.normalize(y, y), i.tangents.push(y),
                                i.minMax.AddValue(f), u = 0, s = f;
                        } else u += Laya.Vector3.distance(f, o);
                        o = f;
                    }
                    i.anchorVertexMap.push(i.vertices.length - 1);
                }
                return i;
            }
        }, {
            key: "splitBezierPathEvenly",
            value: function (a, t, n) {
                var i = new ke();
                i.vertices.push(a.getPoint(0).clone());
                var r = new Laya.Vector3();
                Ve.evaluateCurveDerivative(a.getPointsInSegment(0), 0, r), Laya.Vector3.normalize(r, r),
                    i.tangents.push(r), i.cumulativeLength.push(0), i.anchorVertexMap.push(0), i.minMax.AddValue(a.getPoint(0));
                for (var o = a.getPoint(0), s = a.getPoint(0), l = 0, u = 0, h = 0; h < a.numSegments; h++) {
                    for (var d = a.getPointsInSegment(h), _ = Ve.estimateCurveLength(d[0], d[1], d[2], d[3]), c = 1 / Math.ceil(_ * n), E = c; E <= 1; E += c) {
                        var S = E + c > 1 && h == a.numSegments - 1;
                        S && (E = 1);
                        var f = new Laya.Vector3();
                        if (Ve.evaluateCurve(d, E, f), (u += Laya.Vector3.distance(f, o)) > t) {
                            var L = u - t;
                            Laya.Vector3.subtract(o, f, e.temp_v3_1), Laya.Vector3.normalize(e.temp_v3_1, e.temp_v3_1),
                                Laya.Vector3.scale(e.temp_v3_1, L, e.temp_v3_1), Laya.Vector3.add(f, e.temp_v3_1, f),
                                E -= c;
                        }
                        if (u >= t || S) {
                            l += Laya.Vector3.distance(s, f), i.cumulativeLength.push(l), i.vertices.push(f);
                            var D = new Laya.Vector3();
                            Ve.evaluateCurveDerivative(d, E, D), Laya.Vector3.normalize(D, D), i.tangents.push(D),
                                i.minMax.AddValue(f), u = 0, s = f;
                        }
                        o = f;
                    }
                    i.anchorVertexMap.push(i.vertices.length - 1);
                }
                return i;
            }
        }]), e;
    }();
    be.temp_v3_1 = new Laya.Vector3();
    var He = s(function e(a, t, n) {
        l(this, e), this.previousIndex = Math.floor(a), this.nextIndex = Math.floor(t),
            this.percentBetweenIndices = n;
    });
    !function (e) {
        e[e.Loop = 0] = "Loop", e[e.Reverse = 1] = "Reverse", e[e.Stop = 2] = "Stop";
    }(Oe || (Oe = {}));
    var Ue = function () {
        function e(a, t, n) {
            l(this, e), this.isClosedLoop = !1, this.tran = n, this.space = a.space, this.isClosedLoop = a.isClosed;
            var i = t.vertices.length, r = t.cumulativeLength[i - 1];
            this.localPoints = new Array(i), this.localNormals = new Array(i), this.localTangents = new Array(i),
                this.cumulativeLengthAtEachVertex = new Array(i), this.times = new Array(i), this.bounds = new Laya.Bounds(t.minMax.Min, t.minMax.Max),
                this.up = this.bounds.getExtent().z > this.bounds.getExtent().y ? new Laya.Vector3(0, 1, 0) : new Laya.Vector3(0, 0, -1);
            var o = this.up.clone();
            this.pathSplitData = t;
            for (var s = 0; s < this.localPoints.length; s++) if (this.localPoints[s] = t.vertices[s],
                this.localTangents[s] = t.tangents[s], this.cumulativeLengthAtEachVertex[s] = t.cumulativeLength[s],
                this.times[s] = this.cumulativeLengthAtEachVertex[s] / r, this.space == Ce.xyz) if (0 == s) {
                    var u = new Laya.Vector3();
                    Laya.Vector3.cross(o, t.tangents[0], u), Laya.Vector3.normalize(u, u), this.localNormals[0] = u;
                } else {
                    var h = new Laya.Vector3();
                    Laya.Vector3.subtract(this.localPoints[s], this.localPoints[s - 1], h);
                    var d = Laya.Vector3.scalarLengthSquared(h), _ = new Laya.Vector3();
                    Laya.Vector3.scale(h, 2, _), Laya.Vector3.scale(_, 1 / d, _), Laya.Vector3.scale(_, Laya.Vector3.dot(h, o), _),
                        Laya.Vector3.subtract(o, _, _);
                    var c = new Laya.Vector3();
                    Laya.Vector3.scale(h, 2, c), Laya.Vector3.scale(c, 1 / d, c), Laya.Vector3.scale(c, Laya.Vector3.dot(h, this.localTangents[s - 1]), c),
                        Laya.Vector3.subtract(this.localTangents[s - 1], c, c);
                    var E = new Laya.Vector3();
                    Laya.Vector3.subtract(this.localTangents[s], c, E);
                    var S = Laya.Vector3.dot(E, E), f = new Laya.Vector3();
                    Laya.Vector3.scale(E, 2, f), Laya.Vector3.scale(f, 1 / S, f), Laya.Vector3.scale(f, Laya.Vector3.dot(E, _), f),
                        Laya.Vector3.subtract(_, f, f);
                    var L = new Laya.Vector3();
                    Laya.Vector3.cross(f, this.localTangents[s], L), Laya.Vector3.normalize(L, L), this.localNormals[s] = L,
                        o = f;
                } else {
                var D = new Laya.Vector3();
                this.localNormals[s] = D, Laya.Vector3.cross(this.localTangents[s], this.up, D);
            }
        }
        return s(e, [{
            key: "numPoints",
            get: function () {
                return this.localPoints.length;
            }
        }, {
            key: "calculatePercentOnPathData",
            value: function (e, a) {
                switch (a) {
                    case Oe.Loop:
                        e < 0 && (e += Math.ceil(Math.abs(e))), e %= 1;
                        break;

                    case Oe.Reverse:
                        e = TY.Utils.pingPong(e, 1);
                        break;

                    case Oe.Stop:
                        e = TY.Utils.clamp01(e);
                }
                for (var t = 0, n = this.numPoints - 1, i = Math.floor(Math.round(e * (this.numPoints - 1))); e <= this.times[i] ? n = i : t = i,
                    i = Math.floor((n + t) / 2), !(n - t <= 1););
                var r = TY.Utils.inverseLerp(this.times[t], this.times[n], e);
                return new He(t, n, r);
            }
        }, {
            key: "calculateClosestPointOnPathData",
            value: function (e) {
                for (var a = Number.MAX_VALUE, t = new Laya.Vector3(1, 1, 1), n = 0, i = 0, r = 0; r < this.localPoints.length; r++) {
                    var o = r + 1;
                    if (o >= this.localPoints.length) {
                        if (!this.isClosedLoop) break;
                        o %= this.localPoints.length;
                    }
                    var s = new Laya.Vector3();
                    we.closestPointOnLineSegment(e, e[r], this.localPoints[o], s);
                    var l = Laya.Vector3.distanceSquared(e, s);
                    l < a && (a = l, t = s, n = r, i = o);
                }
                var u = Laya.Vector3.distance(this.localPoints[n], this.localPoints[i]), h = Laya.Vector3.distance(t, this.localPoints[n]) / u;
                return new He(n, i, h);
            }
        }, {
            key: "getNormalAtTime",
            value: function (e) {
                var a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : Oe.Loop, t = arguments.length > 2 ? arguments[2] : void 0, n = this.calculatePercentOnPathData(e, a);
                Laya.Vector3.lerp(this.localNormals[n.previousIndex], this.localNormals[n.nextIndex], n.percentBetweenIndices, t);
            }
        }, {
            key: "getNormalAtDistance",
            value: function (e) {
                var a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : Oe.Loop, t = arguments.length > 2 ? arguments[2] : void 0, n = e / length;
                this.getNormalAtTime(n, a, t);
            }
        }, {
            key: "getNormal",
            value: function (e, a) {
                this.localNormals[e].cloneTo(a);
            }
        }, {
            key: "getPoint",
            value: function (e, a) {
                this.localPoints[e].cloneTo(a);
            }
        }, {
            key: "getPointAtTime",
            value: function (a) {
                var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : Oe.Loop, n = arguments.length > 2 ? arguments[2] : void 0, i = this.calculatePercentOnPathData(a, t);
                this.getPoint(i.previousIndex, e.temp_v3_1), this.getPoint(i.nextIndex, e.temp_v3_2),
                    Laya.Vector3.lerp(e.temp_v3_1, e.temp_v3_2, i.percentBetweenIndices, n);
            }
        }, {
            key: "getPointAtDistance",
            value: function (e) {
                var a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : Oe.Loop, t = arguments.length > 2 ? arguments[2] : void 0, n = e / length;
                this.getPointAtTime(n, a, t);
            }
        }], [{
            key: "create",
            value: function (a, t) {
                var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : .3, i = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0;
                return new e(a, be.splitBezierPathByAngleError(a, n, i, e.accuracy), t);
            }
        }, {
            key: "createByVertexSpacing",
            value: function (a, t, n) {
                return new e(a, be.splitBezierPathEvenly(a, Math.max(n, this.minVertexSpacing), e.accuracy), t);
            }
        }]), e;
    }();
    Ue.temp_v3_1 = new Laya.Vector3(), Ue.temp_v3_2 = new Laya.Vector3(), Ue.accuracy = 10,
        Ue.minVertexSpacing = .01;
    var Fe = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.apply(this, arguments)).vertexPathMaxAngleError = .3,
                e.vertexPathMinVertexSpacing = .01, e.isClosed = !0, e;
        }
        return s(t, [{
            key: "_parse",
            value: function (e, a) {
                n(i(t.prototype), "_parse", this).call(this, e, a);
                var r = [];
                if (e.points) for (var o = 0; o < e.points.length; o += 3) {
                    var s = e.points[o] / 1e3, l = e.points[o + 1] / 1e3, u = e.points[o + 2] / 1e3;
                    r.push(new Laya.Vector3(s, l, u));
                }
                if (this.bezierPath) {
                    this.bezierPath.points.length = 0;
                    for (var h = 0; h < r.length; h++) {
                        var d = r[h];
                        this.bezierPath.points.push(d);
                    }
                } else this.bezierPath = new xe(r);
                e.vertexPathMaxAngleError && (this.vertexPathMaxAngleError = e.vertexPathMaxAngleError),
                    e.vertexPathMinVertexSpacing && (this.vertexPathMinVertexSpacing = e.vertexPathMinVertexSpacing),
                    this.isClosed = e.isClosed, e.space && (this.bezierPath.space = e.space), this.init();
            }
        }, {
            key: "onAwake",
            value: function () {
                n(i(t.prototype), "onAwake", this).call(this);
            }
        }, {
            key: "init",
            value: function () {
                this.path = Ue.create(this.bezierPath, this.owner.transform, this.vertexPathMaxAngleError, this.vertexPathMinVertexSpacing),
                    this.path.isClosedLoop = this.isClosed;
            }
        }, {
            key: "_cloneTo",
            value: function (e) {
                e.bezierPath = new xe(this.bezierPath.points), e.vertexPathMinVertexSpacing = this.vertexPathMinVertexSpacing,
                    e.vertexPathMaxAngleError = this.vertexPathMaxAngleError, e.isClosed = this.isClosed,
                    e.bezierPath.space = this.bezierPath.space, n(i(t.prototype), "_cloneTo", this).call(this, e),
                    e.init();
            }
        }]), t;
    }(Laya.Script3D), Ge = Object.freeze({
        __proto__: null,
        BezierCurvesComponent: Fe,
        TimeOnPathData: He,
        get EndOfPathInstruction() {
            return Oe;
        },
        VertexPath: Ue,
        get PathSpace() {
            return Ce;
        },
        BezierPath: xe,
        CubicBezierUtility: Ve,
        MathUtility: we,
        MinMax3D: Be,
        PathSplitData: ke,
        VertexPathUtility: be
    }), We = s(function e() {
        l(this, e);
    });
    We.DepthNormalsVS = '\n#if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n    precision highp int;\n#else\n    precision mediump float;\n    precision mediump int;\n#endif\n#include "DepthNormalUtil.glsl";\n\nvarying vec4 depthNormals;\n\nvoid main()\n{ \n    gl_FragColor=depthNormalsFragment(depthNormals);\n}\n',
        We.DepthNormalsPS = '\n#if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n    precision highp int;\n#else\n    precision mediump float;\n    precision mediump int;\n#endif\n\n#include "Lighting.glsl";\n\nattribute vec4 a_Position;\nattribute vec3 a_Normal;\n\n#ifdef BONE\n    const int c_MaxBoneCount = 24;\n    attribute vec4 a_BoneIndices;\n    attribute vec4 a_BoneWeights;\n    uniform mat4 u_Bones[c_MaxBoneCount];\n#endif\n\n#ifdef GPU_INSTANCE\n    attribute mat4 a_WorldMat;\n#else\n    uniform mat4 u_WorldMat;\n#endif\n\nuniform mat4 u_ViewProjection;\nuniform vec4 u_ProjectionParams;\n\n//传入法线\nvarying vec4 depthNormals;\n\n\nvec4 depthNormalsVertex()\n{ \n    mat4 worldMat;\n    #ifdef GPU_INSTANCE\n        worldMat = a_WorldMat;\n    #else\n        worldMat = u_WorldMat;\n    #endif\n    \n    #ifdef BONE\n        mat4 skinTransform;\n        #ifdef SIMPLEBONE\n            float currentPixelPos;\n            #ifdef GPU_INSTANCE\n                currentPixelPos = a_SimpleTextureParams.x+a_SimpleTextureParams.y;\n            #else\n                currentPixelPos = u_SimpleAnimatorParams.x+u_SimpleAnimatorParams.y;\n            #endif\n            float offset = 1.0/u_SimpleAnimatorTextureSize;\n            skinTransform =  loadMatFromTexture(currentPixelPos, int(a_BoneIndices.x), offset) * a_BoneWeights.x;\n            skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.y), offset) * a_BoneWeights.y;\n            skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.z), offset) * a_BoneWeights.z;\n            skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.w), offset) * a_BoneWeights.w;\n        #else\n            skinTransform =  u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n            skinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n            skinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n            skinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n        #endif\n        worldMat = worldMat * skinTransform;\n    #endif\n    vec4 positionWS = worldMat * a_Position;\n    \n    mat3 worldInvMat;\n    #ifdef BONE\n            worldInvMat=INVERSE_MAT(mat3(worldMat*skinTransform));\n    #else\n            worldInvMat=INVERSE_MAT(mat3(worldMat));\n    #endif\n    vec3 normalWS = normalize(a_Normal*worldInvMat);//if no normalize will cause precision problem\n    \n    depthNormals.xyz = normalWS;\n    vec4 positionCS = u_ViewProjection * positionWS;\n    depthNormals.w = (positionCS.z * 2.0 - positionCS.w)*u_ProjectionParams.w;\n    \n    return positionCS;\n}\n\nvoid main()\n{ \n    vec4 positionCS =  depthNormalsVertex();\n    gl_Position=remapGLPositionZ(positionCS);\n}\n';
    var ze = s(function e() {
        l(this, e);
    });
    ze.BlinnPhongEmissionPs = '\n#if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n    precision highp int;\n#else\n    precision mediump float;\n    precision mediump int;\n#endif\n\n#include "Lighting.glsl";\n#include "Shadow.glsl"\n\nuniform vec4 u_DiffuseColor;\nuniform float u_AlbedoIntensity;\n\n#if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n    varying vec4 v_Color;\n#endif\n\n#ifdef ALPHATEST\n    uniform float u_AlphaTestValue;\n#endif\n\n#ifdef DIFFUSEMAP\n    uniform sampler2D u_DiffuseTexture;\n#endif\n\n\n\n\n#if defined(DIFFUSEMAP)||defined(EMISSIONTEXTURE)||((defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT))&&(defined(SPECULARMAP)||defined(NORMALMAP)))\n    varying vec2 v_Texcoord0;\n#endif\n\n#ifdef LIGHTMAP\n    varying vec2 v_LightMapUV;\n    uniform sampler2D u_LightMap;\n    #ifdef LIGHTMAP_DIRECTIONAL\n        uniform sampler2D u_LightMapDirection;\n    #endif\n#endif\n\n\n\nvarying vec3 v_Normal;\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n    varying vec3 v_ViewDir;\n    \n    uniform vec3 u_MaterialSpecular;\n    uniform float u_Shininess;\n\n    #ifdef LEGACYSINGLELIGHTING\n        #ifdef DIRECTIONLIGHT\n            uniform DirectionLight u_DirectionLight;\n        #endif\n        #ifdef POINTLIGHT\n            uniform PointLight u_PointLight;\n        #endif\n        #ifdef SPOTLIGHT\n            uniform SpotLight u_SpotLight;\n        #endif\n    #else\n        uniform mat4 u_View;\n        uniform vec4 u_ProjectionParams;\n        uniform vec4 u_Viewport;\n        uniform int u_DirationLightCount;\n        uniform sampler2D u_LightBuffer;\n        uniform sampler2D u_LightClusterBuffer;\n    #endif\n\n    #ifdef SPECULARMAP\n        uniform sampler2D u_SpecularTexture;\n    #endif\n#endif\n\n#ifdef NORMALMAP\n    uniform sampler2D u_NormalTexture;\n    varying vec3 v_Tangent;\n    varying vec3 v_Binormal;\n#endif\n    \n\n#ifdef FOG\n    uniform float u_FogStart;\n    uniform float u_FogRange;\n    uniform vec3 u_FogColor;\n#endif\n\n#if defined(POINTLIGHT)||defined(SPOTLIGHT)||(defined(CALCULATE_SHADOWS)&&defined(SHADOW_CASCADE))||defined(CALCULATE_SPOTSHADOWS)\n    varying vec3 v_PositionWorld;\n#endif\n\n\n#include "GlobalIllumination.glsl";//"GlobalIllumination.glsl use uniform should at front of this\n\n#if defined(CALCULATE_SHADOWS)&&!defined(SHADOW_CASCADE)\n    varying vec4 v_ShadowCoord;\n#endif\n\n#if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n    varying vec4 v_SpotShadowCoord;\n#endif\n\n\n#ifdef EMISSION\n    #ifdef EMISSIONTEXTURE\n        uniform sampler2D u_EmissionTexture;\n    #endif\n    uniform vec4 u_EmissionColor;\n#endif\n    \n#ifdef EMISSION\nvec3 emission(vec2 uv)\n{ \n    #ifdef EMISSIONTEXTURE\n        return texture2D(u_EmissionTexture, uv).rgb * u_EmissionColor.rgb;\n    #else\n        return u_EmissionColor.rgb;\n    #endif\n}\n#endif\n\nvoid main()\n{\n    vec3 normal;//light and SH maybe use normal\n    #if defined(NORMALMAP)\n        vec3 normalMapSample = texture2D(u_NormalTexture, v_Texcoord0).rgb;\n        normal = normalize(NormalSampleToWorldSpace(normalMapSample, v_Normal, v_Tangent, v_Binormal));\n    #else\n        normal = normalize(v_Normal);\n    #endif\n\n    #if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n        vec3 viewDir= normalize(v_ViewDir);\n    #endif\n\n    LayaGIInput giInput;\n    #ifdef LIGHTMAP\n        giInput.lightmapUV=v_LightMapUV;\n    #endif\n        vec3 globalDiffuse=layaGIBase(giInput, 1.0, normal);\n\n        vec4 mainColor = u_DiffuseColor * u_AlbedoIntensity;\n    #ifdef DIFFUSEMAP\n        vec4 difTexColor=texture2D(u_DiffuseTexture, v_Texcoord0);\n        mainColor=mainColor*difTexColor;\n    #endif\n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n        mainColor=mainColor*v_Color;\n    #endif\n\n    #ifdef ALPHATEST\n        if (mainColor.a<u_AlphaTestValue)\n        discard;\n    #endif\n\n\n    vec3 diffuse = vec3(0.0);\n    vec3 specular= vec3(0.0);\n    vec3 transmissionDiffuse = vec3(0.0);\n    #if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n        vec3 dif, spe, transmis;\n        float transmissionFactor;\n        #ifdef SPECULARMAP\n            vec3 gloss=texture2D(u_SpecularTexture, v_Texcoord0).rgb;\n        #else\n            #ifdef DIFFUSEMAP\n                vec3 gloss=vec3(difTexColor.a);\n            #else\n                vec3 gloss=vec3(1.0);\n            #endif\n        #endif\n        #ifdef THICKNESSMAP\n                transmissionFactor = texture2D(u_ThinknessTexture, v_Texcoord0).r;\n        #endif\n    #endif\n\n\n\n#ifdef LEGACYSINGLELIGHTING\n        #ifdef DIRECTIONLIGHT\n            LayaAirBlinnPhongDiectionLight(u_MaterialSpecular, u_Shininess, normal, gloss, viewDir, u_DirectionLight, transmissionFactor, dif, spe, transmis);\n            #if defined(CALCULATE_SHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                #ifdef SHADOW_CASCADE\n                    vec4 shadowCoord = getShadowCoord(vec4(v_PositionWorld, 1.0));\n                #else\n                    vec4 shadowCoord = v_ShadowCoord;\n                #endif\n                float shadowAttenuation=sampleShadowmap(shadowCoord);\n                dif *= shadowAttenuation;\n                spe *= shadowAttenuation;\n                transmis *=shadowAttenuation;\n            #endif\n            diffuse+=dif;\n            specular+=spe;\n            transmissionDiffuse+=transmis;\n        #endif\n    \n        #ifdef POINTLIGHT\n            LayaAirBlinnPhongPointLight(v_PositionWorld, u_MaterialSpecular, u_Shininess, normal, gloss, viewDir, u_PointLight, transmissionFactor, dif, spe, transmis);\n            diffuse+=dif;\n            specular+=spe;\n            transmissionDiffuse+=transmis;\n        #endif\n\n        #ifdef SPOTLIGHT\n            LayaAirBlinnPhongSpotLight(v_PositionWorld, u_MaterialSpecular, u_Shininess, normal, gloss, viewDir, u_SpotLight, transmissionFactor, dif, spe, transmis);\n            #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                vec4 spotShadowcoord = v_SpotShadowCoord;\n                float spotShadowAttenuation = sampleSpotShadowmap(spotShadowcoord);\n                dif *= spotShadowAttenuation;\n                spe *= spotShadowAttenuation;\n                transmis *=spotShadowAttenuation;\n            #endif\n            diffuse+=dif;\n            specular+=spe;\n            transmissionDiffuse+=transmis;\n        #endif\n    #else\n        #ifdef DIRECTIONLIGHT\n            for (int i = 0; i < MAX_LIGHT_COUNT; i++) \n            { \n                if (i >= u_DirationLightCount)\n                    break;\n                DirectionLight directionLight = getDirectionLight(u_LightBuffer, i);\n                #if defined(CALCULATE_SHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                    if (i == 0)\n                    { \n                        #ifdef SHADOW_CASCADE\n                            vec4 shadowCoord = getShadowCoord(vec4(v_PositionWorld, 1.0));\n                        #else\n                            vec4 shadowCoord = v_ShadowCoord;\n                        #endif\n                            directionLight.color *= sampleShadowmap(shadowCoord);\n                     }\n                #endif\n                LayaAirBlinnPhongDiectionLight(u_MaterialSpecular, u_Shininess, normal, gloss, viewDir, directionLight, transmissionFactor, dif, spe, transmis);\n                diffuse+=dif;\n                specular+=spe;\n                transmissionDiffuse+=transmis;\n             }\n        #endif\n        #if defined(POINTLIGHT)||defined(SPOTLIGHT)\n            ivec4 clusterInfo =getClusterInfo(u_LightClusterBuffer, u_View, u_Viewport, v_PositionWorld, gl_FragCoord, u_ProjectionParams);\n            #ifdef POINTLIGHT\n                for (int i = 0; i < MAX_LIGHT_COUNT; i++) \n                { \n                    if (i >= clusterInfo.x)//PointLightCount\n                        break;\n                    PointLight pointLight = getPointLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, i);\n                    LayaAirBlinnPhongPointLight(v_PositionWorld, u_MaterialSpecular, u_Shininess, normal, gloss, viewDir, pointLight, transmissionFactor, dif, spe, transmis);\n                    diffuse+=dif;\n                    specular+=spe;\n                    transmissionDiffuse+=transmis;\n                 }\n            #endif\n            #ifdef SPOTLIGHT\n                for (int i = 0; i < MAX_LIGHT_COUNT; i++) \n                { \n                    if (i >= clusterInfo.y)//SpotLightCount\n                        break;\n                    SpotLight spotLight = getSpotLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, i);\n                    #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                        if (i == 0)\n                        { \n                            vec4 spotShadowcoord = v_SpotShadowCoord;\n                            spotLight.color *= sampleSpotShadowmap(spotShadowcoord);\n                         }\n                    #endif\n                    LayaAirBlinnPhongSpotLight(v_PositionWorld, u_MaterialSpecular, u_Shininess, normal, gloss, viewDir, spotLight, transmissionFactor, dif, spe, transmis);\n                    diffuse+=dif;\n                    specular+=spe;\n                    transmissionDiffuse+=transmis;\n                 }\n            #endif\n                #endif\n            #endif\n\n    gl_FragColor =vec4(mainColor.rgb*(diffuse),mainColor.a);\n\n    #if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n        gl_FragColor.rgb+=specular;\n    #endif\n    vec2 uv;\n    #if defined(DIFFUSEMAP)||defined(EMISSIONTEXTURE)||((defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT))&&(defined(SPECULARMAP)||defined(NORMALMAP)))\n        uv = v_Texcoord0;\n    #endif\n    #ifdef ENABLETRANSMISSION\n        gl_FragColor.rgb += transmissionDiffuse;\n    #endif\n\n    #ifdef EMISSION\n        gl_FragColor.rgb += emission(uv);\n    #endif\n    #ifdef FOG\n        float lerpFact=clamp((1.0/gl_FragCoord.w-u_FogStart)/u_FogRange, 0.0, 1.0);\n        gl_FragColor.rgb=mix(gl_FragColor.rgb, u_FogColor, lerpFact);\n    #endif\n//    gl_FragColor.rgb = mainColor.rgb;\n//     gl_FragColor.rgb = vec3(mainColor);\n//    gl_FragColor.a = 1.0;\n    }\n',
        ze.BlinnPhongEmissionVs = '#if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n    precision highp int;\n#else\n    precision mediump float;\n    precision mediump int;\n#endif\n#include "Lighting.glsl";\n#include "LayaUtile.glsl"\n#include "Shadow.glsl";\n\n\nattribute vec4 a_Position;\n\n#ifdef GPU_INSTANCE\n    uniform mat4 u_ViewProjection;\n#else\n    uniform mat4 u_MvpMatrix;\n#endif\n\n#if defined(DIFFUSEMAP)||defined(EMISSIONTEXTURE)||defined(THICKNESSMAP)||((defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT))&&(defined(SPECULARMAP)||defined(NORMALMAP)))||(defined(LIGHTMAP)&&defined(UV))\n    attribute vec2 a_Texcoord0;\n    varying vec2 v_Texcoord0;\n#endif\n\n#if defined(LIGHTMAP)&&defined(UV1)\n    attribute vec2 a_Texcoord1;\n#endif\n\n#ifdef LIGHTMAP\n    uniform vec4 u_LightmapScaleOffset;\n    varying vec2 v_LightMapUV;\n#endif\n\n#ifdef COLOR\n    attribute vec4 a_Color;\n    varying vec4 v_Color;\n#endif\n\n#ifdef BONE\n    const int c_MaxBoneCount = 24;\n    attribute vec4 a_BoneIndices;\n    attribute vec4 a_BoneWeights;\n    uniform mat4 u_Bones[c_MaxBoneCount];\n#endif\n\nattribute vec3 a_Normal;\nvarying vec3 v_Normal;\n\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n    uniform vec3 u_CameraPos;\n    varying vec3 v_ViewDir;\n#endif\n\n#if defined(NORMALMAP)\n    attribute vec4 a_Tangent0;\n    varying vec3 v_Tangent;\n    varying vec3 v_Binormal;\n#endif\n\n#ifdef GPU_INSTANCE\n    attribute mat4 a_WorldMat;\n#else\n    uniform mat4 u_WorldMat;\n#endif\n\n#if defined(POINTLIGHT)||defined(SPOTLIGHT)||(defined(CALCULATE_SHADOWS)&&defined(SHADOW_CASCADE))||defined(CALCULATE_SPOTSHADOWS)\n    varying vec3 v_PositionWorld;\n#endif\n\n#if defined(CALCULATE_SHADOWS)&&!defined(SHADOW_CASCADE)\n    varying vec4 v_ShadowCoord;\n#endif\n\n#if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n    varying vec4 v_SpotShadowCoord;\n#endif\n\nuniform vec4 u_TilingOffset;\n\nvoid main()\n{ \n    vec4 position;\n    #ifdef BONE\n                mat4 skinTransform;\n         #ifdef SIMPLEBONE\n                    float currentPixelPos;\n            #ifdef GPU_INSTANCE\n                        currentPixelPos = a_SimpleTextureParams.x+a_SimpleTextureParams.y;\n            #else\n                        currentPixelPos = u_SimpleAnimatorParams.x+u_SimpleAnimatorParams.y;\n            #endif\n                    float offset = 1.0/u_SimpleAnimatorTextureSize;\n            skinTransform =  loadMatFromTexture(currentPixelPos, int(a_BoneIndices.x), offset) * a_BoneWeights.x;\n            skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.y), offset) * a_BoneWeights.y;\n            skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.z), offset) * a_BoneWeights.z;\n            skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.w), offset) * a_BoneWeights.w;\n        #else\n                    skinTransform =  u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n            skinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n            skinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n            skinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n        #endif\n                position=skinTransform*a_Position;\n     #else\n                position=a_Position;\n    #endif\n        \n        \n            \n            mat4 worldMat;\n    #ifdef GPU_INSTANCE\n                worldMat = a_WorldMat;\n    #else\n                worldMat = u_WorldMat;\n    #endif\n\n    #ifdef GPU_INSTANCE\n                gl_Position = u_ViewProjection * worldMat * position;\n    #else\n                gl_Position = u_MvpMatrix * position;\n    #endif\n        \n            mat3 worldInvMat;\n    #ifdef BONE\n                worldInvMat=INVERSE_MAT(mat3(worldMat*skinTransform));\n    #else\n                worldInvMat=INVERSE_MAT(mat3(worldMat));\n    #endif\n            v_Normal=normalize(a_Normal*worldInvMat);\n    #if defined(NORMALMAP)\n                v_Tangent=normalize(a_Tangent0.xyz*worldInvMat);\n        v_Binormal=cross(v_Normal, v_Tangent)*a_Tangent0.w;\n    #endif\n\n    #if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)||(defined(CALCULATE_SHADOWS)&&defined(SHADOW_CASCADE))||defined(CALCULATE_SPOTSHADOWS)\n                vec3 positionWS=(worldMat*position).xyz;\n        #if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n                    v_ViewDir = u_CameraPos-positionWS;\n        #endif\n        #if defined(POINTLIGHT)||defined(SPOTLIGHT)||(defined(CALCULATE_SHADOWS)&&defined(SHADOW_CASCADE))||defined(CALCULATE_SPOTSHADOWS)\n                    v_PositionWorld = positionWS;\n        #endif\n    #endif\n\n    #if defined(DIFFUSEMAP)||defined(THICKNESSMAP)||((defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT))&&(defined(SPECULARMAP)||defined(NORMALMAP)))\n                v_Texcoord0=TransformUV(a_Texcoord0, u_TilingOffset);\n    #endif\n\n    #ifdef LIGHTMAP\n        #ifdef UV1\n                    v_LightMapUV=vec2(a_Texcoord1.x, 1.0-a_Texcoord1.y)*u_LightmapScaleOffset.xy+u_LightmapScaleOffset.zw;\n        #else\n                    v_LightMapUV=vec2(a_Texcoord0.x, 1.0-a_Texcoord0.y)*u_LightmapScaleOffset.xy+u_LightmapScaleOffset.zw;\n        #endif\n                v_LightMapUV.y=1.0-v_LightMapUV.y;\n    #endif\n\n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n                v_Color=a_Color;\n    #endif\n\n    #if defined(CALCULATE_SHADOWS)&&!defined(SHADOW_CASCADE)\n                v_ShadowCoord =getShadowCoord(vec4(positionWS, 1.0));\n    #endif\n\n    #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                v_SpotShadowCoord = u_SpotViewProjectMatrix*vec4(positionWS, 1.0);\n    #endif\n        \n            gl_Position=remapGLPositionZ(gl_Position);\n}',
        ze.BlinnPhongShadowCasterVs = '\n    #include "ShadowCasterVS.glsl"\n    \n    void main()\n    {\n        vec4 positionCS =  shadowCasterVertex();\n        gl_Position=remapGLPositionZ(positionCS);\n    }\n',
        ze.BlinnPhongShadowCasterFs = '\n#if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n    precision highp int;\n#else\n    precision mediump float;\n    precision mediump int;\n#endif\n\n#include "ShadowCasterFS.glsl"\n\nvoid main()\n{\n    gl_FragColor=shadowCasterFragment();\n}\n';
    var Xe = function (e) {
        r(u, e);
        var t = o(u);
        function u() {
            var e;
            return l(this, u), (e = t.call(this))._enableEmission = !1, e.setShaderName("BlinnPhongEmission"),
                e;
        }
        return s(u, [{
            key: "enableEmission",
            get: function () {
                return this._enableEmission;
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(u.SHADERDEFINE_EMISSION) : this._shaderValues.removeDefine(u.SHADERDEFINE_EMISSION),
                    this._enableEmission = e;
            }
        }, {
            key: "emissionTexture",
            get: function () {
                return this._shaderValues.getTexture(u.EMISSION_TEXTURE);
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(u.SHADERDEFINE_EMISSIONTEXTURE) : this._shaderValues.removeDefine(u.SHADERDEFINE_EMISSIONTEXTURE),
                    this._shaderValues.setTexture(u.EMISSION_TEXTURE, e);
            }
        }, {
            key: "emissionColor",
            get: function () {
                return this._shaderValues.getVector(u.EMISSION_COLOR);
            },
            set: function (e) {
                this._shaderValues.setVector(u.EMISSION_COLOR, e);
            }
        }, {
            key: "cloneTo",
            value: function (e) {
                n(i(u.prototype), "cloneTo", this).call(this, e);
                var a = e;
                a.albedoIntensity = this.albedoIntensity, a.enableVertexColor = this.enableVertexColor,
                    a.enableEmission = this.enableEmission, this.albedoColor.cloneTo(a.albedoColor);
            }
        }, {
            key: "clone",
            value: function () {
                var e = new u();
                return this.cloneTo(e), e;
            }
        }, {
            key: "transmissionRate",
            set: function (e) {
                a(i(u.prototype), "transmissionRata", e, this, !0);
            }
        }], [{
            key: "__initDefine__",
            value: function () {
                n(i(u), "__initDefine__", this).call(this), Laya.Shader3D.getDefineByName("EMISSIONTEXTURE");
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Color: Laya.VertexMesh.MESH_COLOR0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_DiffuseTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SpecularTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_DiffuseColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoIntensity: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MaterialSpecular: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Shininess: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TransmissionRate: Laya.Shader3D.PERIOD_MATERIAL,
                    u_BackDiffuse: Laya.Shader3D.PERIOD_MATERIAL,
                    u_BackScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ThinknessTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TransmissionColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMap: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMapDirection: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_CameraPos: Laya.Shader3D.PERIOD_CAMERA,
                    u_Viewport: Laya.Shader3D.PERIOD_CAMERA,
                    u_ProjectionParams: Laya.Shader3D.PERIOD_CAMERA,
                    u_View: Laya.Shader3D.PERIOD_CAMERA,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_ReflectTexture: Laya.Shader3D.PERIOD_SCENE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE,
                    u_DirationLightCount: Laya.Shader3D.PERIOD_SCENE,
                    u_LightBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_LightClusterBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientColor: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowBias: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightDirection: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowParams: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMatrices: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMapSize: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightPosition: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHC: Laya.Shader3D.PERIOD_SCENE,
                    u_EmissionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionColor: Laya.Shader3D.PERIOD_MATERIAL,
                    "u_DirectionLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.spot": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.color": Laya.Shader3D.PERIOD_SCENE
                }, t = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, r = Laya.Shader3D.add("BlinnPhongEmission", null, null, !0), o = new Laya.SubShader(e, a);
                r.addSubShader(o), o.addShaderPass(ze.BlinnPhongEmissionVs, ze.BlinnPhongEmissionPs, t, "Forward"),
                    o.addShaderPass(ze.BlinnPhongShadowCasterVs, ze.BlinnPhongShadowCasterFs, t, "ShadowCaster"),
                    o.addShaderPass(We.DepthNormalsVS, We.DepthNormalsPS, t, "DepthNormal"), Laya.ClassUtils.regClass("TY.BlinnPhongEmissionMaterial", u);
            }
        }]), u;
    }(Laya.BlinnPhongMaterial);
    Xe.SHADERDEFINE_EMISSION = Laya.Shader3D.getDefineByName("EMISSION"), Xe.SHADERDEFINE_EMISSIONTEXTURE = Laya.Shader3D.getDefineByName("EMISSIONTEXTURE"),
        Xe.EMISSION_COLOR = Laya.Shader3D.propertyNameToID("u_EmissionColor"), Xe.EMISSION_TEXTURE = Laya.Shader3D.propertyNameToID("u_EmissionTexture"),
        Xe.AlbedoIntensity = Laya.Shader3D.propertyNameToID("u_AlbedoIntensity");
    var Ye = s(function e() {
        l(this, e);
    });
    Ye.VS = '#if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n#else\n    precision mediump float;\n#endif\n#include "Lighting.glsl";\n#include "LayaUtile.glsl"\n#include "Shadow.glsl";\n\nattribute vec4 a_Position;\n\nattribute vec2 a_Texcoord0;\n\n#ifdef GPU_INSTANCE\nuniform mat4 u_ViewProjection;\n#else\nuniform mat4 u_MvpMatrix;\n#endif\n\n#if defined(LIGHTMAP)&&defined(UV1)\nattribute vec2 a_Texcoord1;\n#endif\n\nattribute vec4 a_Color;\n\nvarying vec4 v_Color;\nvarying vec2 v_Texcoord0;\n\nuniform vec4 u_TilingOffset;\n\n\n\n#ifdef BONE\nconst int c_MaxBoneCount = 24;\nattribute vec4 a_BoneIndices;\nattribute vec4 a_BoneWeights;\nuniform mat4 u_Bones[c_MaxBoneCount];\n#endif\n\nattribute vec3 a_Normal;\nvarying vec3 v_Normal;\n\nuniform vec3 u_CameraPos;\nvarying vec3 v_ViewDir;\n\n#if defined(NORMALMAP)\n    attribute vec4 a_Tangent0;\n    varying vec3 v_Tangent;\n    varying vec3 v_Binormal;\n#endif\n\n#ifdef GPU_INSTANCE\n    attribute mat4 a_WorldMat;\n#else\n    uniform mat4 u_WorldMat;\n#endif\n#ifdef FOG\n    uniform float u_FogStart;\n    uniform float u_FogRange;\n    uniform vec3 u_FogColor;\n#endif\n#ifdef LIGHTMAP\n    uniform vec4 u_LightmapScaleOffset;\n    varying vec2 v_LightMapUV;\n#endif\n\n\n#if defined(CALCULATE_SHADOWS)&&!defined(SHADOW_CASCADE)\n    varying vec4 v_ShadowCoord;\n#endif\n\n#if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n    varying vec4 v_SpotShadowCoord;\n#endif\n\nvarying vec3 v_PositionWorld;\n\nvoid main() {\n    vec4 position;\n    #ifdef BONE\n        mat4 skinTransform;\n        #ifdef SIMPLEBONE\n            float currentPixelPos;\n            #ifdef GPU_INSTANCE\n                currentPixelPos = a_SimpleTextureParams.x+a_SimpleTextureParams.y;\n            #else\n                currentPixelPos = u_SimpleAnimatorParams.x+u_SimpleAnimatorParams.y;\n            #endif\n                float offset = 1.0/u_SimpleAnimatorTextureSize;\n                skinTransform =  loadMatFromTexture(currentPixelPos, int(a_BoneIndices.x), offset) * a_BoneWeights.x;\n                skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.y), offset) * a_BoneWeights.y;\n                skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.z), offset) * a_BoneWeights.z;\n                skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.w), offset) * a_BoneWeights.w;\n            #else\n            skinTransform =  u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n            skinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n            skinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n            skinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n        #endif\n        position=skinTransform*a_Position;\n    #else\n        position=a_Position;\n    #endif\n    mat4 worldMat;\n    #ifdef GPU_INSTANCE\n        worldMat = a_WorldMat;\n    #else\n        worldMat = u_WorldMat;\n    #endif\n\n    #ifdef GPU_INSTANCE\n        gl_Position = u_ViewProjection * worldMat * position;\n    #else\n        gl_Position = u_MvpMatrix * position;\n    #endif\n     mat3 worldInvMat;\n    #ifdef BONE\n    worldInvMat=INVERSE_MAT(mat3(worldMat*skinTransform));\n    #else\n    worldInvMat=INVERSE_MAT(mat3(worldMat));\n    #endif\n    v_PositionWorld =(worldMat*position).xyz;\n    v_Normal=normalize(a_Normal*worldInvMat);\n    v_ViewDir = u_CameraPos-v_PositionWorld;\n    #if defined(NORMALMAP)\n    v_Tangent=normalize(a_Tangent0.xyz*worldInvMat);\n    v_Binormal=cross(v_Normal, v_Tangent)*a_Tangent0.w;\n    #endif\n    \n    v_Texcoord0=a_Texcoord0;\n\n    #ifdef LIGHTMAP\n        #ifdef UV1\n            v_LightMapUV=vec2(a_Texcoord1.x, 1.0-a_Texcoord1.y)*u_LightmapScaleOffset.xy+u_LightmapScaleOffset.zw;\n        #else\n            v_LightMapUV=vec2(a_Texcoord0.x, 1.0-a_Texcoord0.y)*u_LightmapScaleOffset.xy+u_LightmapScaleOffset.zw;\n        #endif\n        v_LightMapUV.y=1.0-v_LightMapUV.y;\n    #endif\n    #if defined(CALCULATE_SHADOWS)&&!defined(SHADOW_CASCADE)\n        v_ShadowCoord =getShadowCoord(vec4(v_PositionWorld, 1.0));\n    #endif\n        \n    #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n        v_SpotShadowCoord = u_SpotViewProjectMatrix*vec4(v_PositionWorld, 1.0);\n    #endif\n\n    \n    \n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n    v_Color = a_Color;\n    #endif\n    gl_Position=remapGLPositionZ(gl_Position);\n}',
        Ye.PS = '#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "Lighting.glsl";\n//#include "Shadow.glsl";\n\n#if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\nvarying vec4 v_Color;\n#endif\n\n#ifdef ALBEDOTEXTURE\nuniform sampler2D u_AlbedoTexture;\nuniform vec4 u_AlbedoTextureTilingOffset;\n#endif\nvarying vec2 v_Texcoord0;\nuniform vec4 u_AlbedoColor;\n\n#ifdef ALPHATEST\nuniform float u_AlphaTestValue;\n#endif\n\n#ifdef FOG\nuniform float u_FogStart;\nuniform float u_FogRange;\n#ifdef ADDTIVEFOG\n#else\nuniform vec3 u_FogColor;\n#endif\n#endif\nvarying vec3 v_Normal;\nvarying vec3 v_ViewDir;\n\nuniform float u_GlitterySpeed;\nuniform float u_GlitteryMaskDotsScale;\nuniform float u_GlitterPower;\nuniform float u_GlitterContrast;\n\nuniform float u_SpecularPower;\nuniform float u_SpecularContrast;\n\nuniform float u_Time;\nuniform float u_Smoothness;\nuniform float u_MaskAdjust;\nuniform float u_FakeLight;\n\n#if defined(REFCTIONCUBEMAP)\nuniform samplerCube u_ReflectionCubemap;\nuniform float u_CubemapPower;\nuniform float u_CubemapBlur;\n#endif\n\n#if defined(NORMALMAP)\nuniform sampler2D u_Normalmap;\nuniform vec4 u_NormalmapTilingOffset;\nvarying vec3 v_Tangent;\nvarying vec3 v_Binormal;\n#endif\n\nuniform vec4 u_GlitterColor;\n#if defined(GLITTERMAP)\nuniform sampler2D u_GlitterMap;\nuniform vec4 u_GlitterMapTilingOffset;\n#endif\n#if defined(MASKTEX)\n    uniform sampler2D u_MaskTex;\n    uniform vec4 u_MaskTexTilingOffset;\n#endif\n\n#if defined(SPECULARGLITTER)\n    uniform sampler2D u_SpecularGlitter;\n    uniform vec4 u_SpecularGlitterTilingOffset;\n#endif\n\n#include "GlobalIllumination.glsl";\n#if defined(CALCULATE_SHADOWS)&&!defined(SHADOW_CASCADE)\n    varying vec4 v_ShadowCoord;\n#endif\n//\n#if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n    varying vec4 v_SpotShadowCoord;\n#endif\n\n\n#if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n    #ifdef LEGACYSINGLELIGHTING\n        #ifdef DIRECTIONLIGHT\n            uniform DirectionLight u_DirectionLight;\n        #endif\n        #ifdef POINTLIGHT\n            uniform PointLight u_PointLight;\n        #endif\n        #ifdef SPOTLIGHT\n            uniform SpotLight u_SpotLight;\n        #endif\n    #else\n        uniform mat4 u_View;\n        uniform vec4 u_ProjectionParams;\n        uniform vec4 u_Viewport;\n        uniform int u_DirationLightCount;\n        uniform sampler2D u_LightBuffer;\n        uniform sampler2D u_LightClusterBuffer;\n    #endif\n#endif\n\n#ifdef LIGHTMAP\n   varying vec2 v_LightMapUV;\n   uniform sampler2D u_LightMap;\n   #ifdef LIGHTMAP_DIRECTIONAL\n       uniform sampler2D u_LightMapDirection;\n   #endif\n#endif\nvarying vec3 v_PositionWorld;\n\n#ifdef EMISSION\n    #ifdef EMISSIONTEXTURE\n        uniform sampler2D u_EmissionTexture;\n    #endif\n    uniform vec4 u_EmissionColor;\n#endif\n    \n#ifdef EMISSION\nvec3 emission(vec2 uv)\n{ \n    #ifdef EMISSIONTEXTURE\n        return texture2D(u_EmissionTexture, uv).rgb * u_EmissionColor.rgb;\n    #else\n        return u_EmissionColor.rgb;\n    #endif\n}\n#endif\n\nvoid main()\n{\n    vec3 viewDirection= normalize(v_ViewDir);\n    vec3 normalDirection;\n    normalDirection = normalize(v_Normal);\n    #if defined(NORMALMAP)\n        vec3 normalMapSample = texture2D(u_Normalmap,  TransformUV(v_Texcoord0,u_NormalmapTilingOffset)).rgb;\n        normalDirection = normalize(NormalSampleToWorldSpace(normalMapSample, v_Normal, v_Tangent, v_Binormal));\n    #else\n        normalDirection = normalize(v_Normal);\n    #endif\n    vec3 viewReflectDirection = reflect(-viewDirection, normalDirection);\n    vec3 lightVec;\n    vec3 lightColor;\n    #ifdef LEGACYSINGLELIGHTING\n        #ifdef DIRECTIONLIGHT\n            LayaLight dirLight = layaDirectionLightToLight(u_DirectionLight,1.0);\n            lightVec = dirLight.dir;\n            lightColor = dirLight.color;\n//            #if defined(CALCULATE_SHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n//                #ifdef SHADOW_CASCADE\n//                    vec4 shadowCoord = getShadowCoord(vec4(v_PositionWorld, 1.0));\n//                #else\n//                    vec4 shadowCoord = v_ShadowCoord;\n//                #endif\n//                lightColor *= sampleShadowmap(shadowCoord);\n//            #endif\n        #endif\n    \n        #ifdef POINTLIGHT\n            LayaLight poiLight = layaPointLightToLight(v_PositionWorld,normalDirection,u_PointLight,1.0);\n            lightVec = poiLight.dir;\n            lightColor = poiLight.color;\n        #endif\n    \n        #ifdef SPOTLIGHT\n            LayaLight spoLight = layaSpotLightToLight(v_PositionWorld,normalDirection,u_SpotLight,1.0);\n            lightVec =  spoLight.dir;\n            lightColor = spoLight.color;\n//            #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n//                vec4 spotShadowcoord = v_SpotShadowCoord;\n//                float spotShadowAttenuation = sampleSpotShadowmap(spotShadowcoord);\n//                lightColor *= spotShadowAttenuation;\n//            #endif\n        #endif\n    #else\n        #ifdef DIRECTIONLIGHT\n            DirectionLight directionLight = getDirectionLight(u_LightBuffer, 0);\n            LayaLight dirLight = layaDirectionLightToLight(directionLight,1.0);\n            lightVec = dirLight.dir;\n            lightColor = dirLight.color;\n            \n//            #if defined(CALCULATE_SHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n//                 #ifdef SHADOW_CASCADE\n//                    vec4 shadowCoord = getShadowCoord(vec4(v_PositionWorld, 1.0));\n//                #else\n//                    vec4 shadowCoord = v_ShadowCoord;\n//                #endif\n//                    lightColor *= sampleShadowmap(shadowCoord);\n//            #endif\n        #endif\n        #ifdef POINTLIGHT\n    \n            PointLight pointLight = getPointLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, 0);\n            LayaLight poiLight = layaPointLightToLight(v_PositionWorld,normalDirection,\n            pointLight,1.0);\n    \n            lightVec = poiLight.dir;\n            lightColor = poiLight.color;\n//            #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n//                vec4 spotShadowcoord = v_SpotShadowCoord;\n//                lightColor *= sampleSpotShadowmap(spotShadowcoord);\n//            #endif\n        #endif\n        #ifdef SPOTLIGHT\n            SpotLight spotLight = getSpotLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, 0);\n//            lightColor = spotLight.color;\n           \n            LayaLight spoLight = layaSpotLightToLight(v_PositionWorld,normalDirection,\n            spotLight,1.0);\n            lightVec = spoLight.dir;\n            lightColor = spoLight.color;\n//            #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n//                vec4 spotShadowcoord = v_SpotShadowCoord;\n//                lightColor *= sampleSpotShadowmap(spotShadowcoord);\n//            #endif\n        #endif\n    #endif\n    lightVec = normalize(lightVec);\n    vec3 halfDirection = normalize(viewDirection + lightVec);\n     float NdotL = max(0.0, dot (-lightVec, normalDirection));\n    vec2 offsetUv = vec2(1.0)*(0.01 * u_GlitterySpeed) * u_Time;\n    vec2 glitteryUv = (offsetUv + v_Texcoord0).xy * u_GlitteryMaskDotsScale;\n\n    float PI = 3.141592654;\n\n    float rot_cos = cos(PI);\n    float rot_sin = sin(PI);\n    vec2 rot_piv = vec2(0.5, 0.5);\n    mat2 rotMatrix = mat2(rot_cos, -rot_sin,\n    rot_sin, rot_cos);\n    vec2 rot_UV = -offsetUv + v_Texcoord0 - rot_piv;\n\n    rot_UV *= rotMatrix;\n    rot_UV += rot_piv;\n\n    rot_UV = (rot_UV * u_GlitteryMaskDotsScale * (1.0 - (u_GlitterySpeed / PI)) * u_MaskAdjust);\n    \n    vec4 glitterColor1 = u_GlitterColor;\n    vec4 glitterColor2 = vec4(1.0);\n    #if defined(GLITTERMAP)\n        //TransformUV(glitteryUv,u_GlitterMapTilingOffset)\n        glitterColor1 *= texture2D(u_GlitterMap, TransformUV(glitteryUv,u_GlitterMapTilingOffset));\n        glitterColor2 = texture2D(u_GlitterMap, TransformUV(rot_UV,u_GlitterMapTilingOffset));\n    #endif\n    \n    vec4 maskTex_var = vec4(0.,0.,0.,0.);\n    \n     #if defined(MASKTEX)\n         maskTex_var = texture2D(u_MaskTex, TransformUV(v_Texcoord0,u_MaskTexTilingOffset));\n     #endif\n    \n    vec4 specularGlitter_var = vec4(1.,1.,1.,1.);\n\n     #if defined(SPECULARGLITTER)\n         specularGlitter_var = texture2D(u_SpecularGlitter, TransformUV(v_Texcoord0,\n                                         u_SpecularGlitterTilingOffset));\n     #endif\n    \n    vec3 tempZero = vec3(0.,0.,0.);\n    float t = max(1.0 - glitterColor2.r,maskTex_var.r);\n//    pow(glitterPower * glitterColor.rgb * glitterColor1.rgb,\n//    float3(glitterContrast,glitterContrast,glitterContrast));\n    vec3 targetColor = pow(u_GlitterPower * glitterColor1.rgb,vec3(u_SpecularContrast));\n    vec3 specularColor = mix(targetColor,tempZero,t)\n    +mix(pow(specularGlitter_var.rgb * u_SpecularPower,vec3(u_SpecularContrast))\n    ,tempZero,maskTex_var.r);\n//    vec3 specularTempColor = pow((specularGlitter_var.rgb * u_SpecularPower), vec3(u_SpecularContrast));\n//    specularColor += mix(specularTempColor,tempZero,maskTex_var.r);\n\n//    float specPow = exp2(u_Smoothness * 10.0 + 1.0);\n//    vec3 directSpecular = lightColor * pow(max(0., dot(halfDirection, normalDirection)), specPow) *\n//    specularColor;\n//\n//    vec3 directDiffuse = max(0.0, NdotL) * lightColor;\n\n//    vec3 testDiffuseColor;\n//    vec3 testSpecularColor;\n\n    mediump vec3 h = normalize(viewDirection-lightVec);\n    lowp float ln = max (0.0, dot (-lightVec, normalDirection));\n    float nh = max (0.0, dot (h, normalDirection));\n    vec3 directDiffuse=lightColor * ln;\n    float specPow = exp2(u_Smoothness * 10.0 + 1.0);\n    vec3 directSpecular=lightColor *specularColor*pow (nh,specPow);//u_Smoothness*128.0);\n    \n//    MySelfBlinnPhongLight(specularColor,u_Smoothness,normalDirection,\n//    1.0,viewDirection,lightColor,lightVec,testDiffuseColor,testSpecularColor);\n//    LayaAirBlinnPhongLight(specularColor,u_Smoothness,normalDirection,1.0,\n//    viewDirection,lightColor,directDiffuse,directSpecular);\n    \n//    LayaGIInput giInput;\n//    #ifdef LIGHTMAP    \n//        giInput.lightmapUV=v_LightMapUV;\n//    #endif\n//    \n    vec3 indirectDiffuse = u_AmbientColor;//=layaGIBase(giInput,1.0,normalDirection);\n    \n    vec4 diffuseColor =  u_AlbedoColor;\n    #ifdef ALBEDOTEXTURE\n        diffuseColor *= texture2D(u_AlbedoTexture, TransformUV(v_Texcoord0,u_AlbedoTextureTilingOffset));\n    #endif\n//    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n//    _MainTex_var *= v_Color;\n//    #endif\n//    mediump float mip = perceptualRoughness * LAYA_SPECCUBE_LOD_STEPS;\n//mediump vec3 uvw = glossIn.rgb;\n//uvw.x=-uvw.x;//Note:reflectCube is left-hand,so x need inverse\n//mediump vec4 rgbm=textureCubeLodEXT(u_ReflectTexture, uvw, mip);\n    vec3 diffuse = (directDiffuse + indirectDiffuse) * diffuseColor.rgb;\n    vec3 cubeMapColor = vec3(0.0);\n    #if defined(REFCTIONCUBEMAP)\n    vec3 uvw = viewReflectDirection;\n    //vec4(viewReflectDirection, u_CubemapBlur);\n//    float mipLod = u_CubemapBlur * LAYA_SPECCUBE_LOD_STEPS;\n//    uvw.x = -uvw.x;\n//    mediump float perceptualRoughness = 1.0;\n//    perceptualRoughness = perceptualRoughness * (1.7 - 0.7*perceptualRoughness);//just a approximation,but fast.\n// \n//    mediump float mip = perceptualRoughness * LAYA_SPECCUBE_LOD_STEPS;\n\n    mediump vec4 rgbm=textureCubeLodEXT(u_ReflectionCubemap, uvw, u_CubemapBlur);\n    cubeMapColor = decodeHDR(rgbm, 1.0);\n    cubeMapColor*=u_CubemapPower;\n    #endif\n    vec3 emissive = (specularColor * u_FakeLight) + cubeMapColor;\n   \n    #ifdef ALPHATEST\n    if (color.a < u_AlphaTestValue)\n    discard;\n    #endif\n    vec3 finalColor = diffuse + directSpecular +emissive;\n    gl_FragColor = vec4(finalColor.rgb,1.0);\n\n    #ifdef EMISSION\n        gl_FragColor.rgb += emission(v_Texcoord0);\n    #endif\n\n    #ifdef FOG\n        float lerpFact = clamp((1.0 / gl_FragCoord.w - u_FogStart) / u_FogRange, 0.0, 1.0);\n        #ifdef ADDTIVEFOG\n            gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.0), lerpFact);\n        #else\n            gl_FragColor.rgb = mix(gl_FragColor.rgb, u_FogColor, lerpFact);\n        #endif\n    #endif\n}';
    var je = Laya.VertexMesh, Qe = Laya.Shader3D, Ke = Laya.SubShader, qe = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this))._enableEmission = !1, e.setShaderName("TYGlitterShader"),
                e;
        }
        return s(t, [{
            key: "albedoColor",
            get: function () {
                return this.shaderData.getVector(t.ALBEDOCOLOR);
            },
            set: function (e) {
                this.shaderData.setVector(t.ALBEDOCOLOR, e);
            }
        }, {
            key: "albedoTexture",
            get: function () {
                return this._shaderValues.getTexture(t.ALBEDOTEXTURE);
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADERDEFINE_ALBEDOTEXTURE) : this._shaderValues.removeDefine(t.SHADERDEFINE_ALBEDOTEXTURE),
                    this._shaderValues.setTexture(t.ALBEDOTEXTURE, e);
            }
        }, {
            key: "reflectionCubemap",
            get: function () {
                return this._shaderValues.getTexture(t.REFCTIONCUBEMAP);
            },
            set: function (e) {
                e.generateMipmap(), console.log("设置天空球", e), e ? this._shaderValues.addDefine(t.SHADERDEFINE_REFCTIONCUBEMAP) : this._shaderValues.removeDefine(t.SHADERDEFINE_REFCTIONCUBEMAP),
                    this._shaderValues.setTexture(t.REFCTIONCUBEMAP, e);
            }
        }, {
            key: "normalmap",
            get: function () {
                return this._shaderValues.getTexture(t.NORMALMAP);
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADERDEFINE_NORMALMAP) : this._shaderValues.removeDefine(t.SHADERDEFINE_NORMALMAP),
                    this._shaderValues.setTexture(t.NORMALMAP, e);
            }
        }, {
            key: "specularGlitter",
            get: function () {
                return this._shaderValues.getTexture(t.SPECULARGLITTER);
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADERDEFINE_SPECULARGLITTER) : this._shaderValues.removeDefine(t.SHADERDEFINE_SPECULARGLITTER),
                    this._shaderValues.setTexture(t.SPECULARGLITTER, e);
            }
        }, {
            key: "glitterMap",
            get: function () {
                return this._shaderValues.getTexture(t.GLITTERMAP);
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADERDEFINE_GLITTERMAP) : this._shaderValues.removeDefine(t.SHADERDEFINE_GLITTERMAP),
                    this._shaderValues.setTexture(t.GLITTERMAP, e);
            }
        }, {
            key: "maskTex",
            get: function () {
                return this._shaderValues.getTexture(t.MASKTEX);
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADERDEFINE_MASKTEX) : this._shaderValues.removeDefine(t.SHADERDEFINE_MASKTEX),
                    this._shaderValues.setTexture(t.MASKTEX, e);
            }
        }, {
            key: "glitterColor",
            get: function () {
                return this.shaderData.getVector(t.GLITTER_COLOR);
            },
            set: function (e) {
                this.shaderData.setVector(t.GLITTER_COLOR, e);
            }
        }, {
            key: "albedoTextureTilingOffset",
            get: function () {
                return this.shaderData.getVector(t.ALBEDO_TEXTURE_TilingOffset);
            },
            set: function (e) {
                this.shaderData.setVector(t.ALBEDO_TEXTURE_TilingOffset, e);
            }
        }, {
            key: "normalmapTilingOffset",
            get: function () {
                return this.shaderData.getVector(t.NOMALMAP_TilingOffset);
            },
            set: function (e) {
                this.shaderData.setVector(t.NOMALMAP_TilingOffset, e);
            }
        }, {
            key: "specularGlitterTilingOffset",
            get: function () {
                return this.shaderData.getVector(t.SpecularGlitter_TilingOffset);
            },
            set: function (e) {
                this.shaderData.setVector(t.SpecularGlitter_TilingOffset, e);
            }
        }, {
            key: "glitterMapTilingOffset",
            get: function () {
                return this.shaderData.getVector(t.GlitterMap_TilingOffset);
            },
            set: function (e) {
                this.shaderData.setVector(t.GlitterMap_TilingOffset, e);
            }
        }, {
            key: "maskTexTilingOffset",
            get: function () {
                return this.shaderData.getVector(t.MaskTex_TilingOffset);
            },
            set: function (e) {
                this.shaderData.setVector(t.MaskTex_TilingOffset, e);
            }
        }, {
            key: "smoothness",
            get: function () {
                return this.shaderData.getNumber(t.SmoothnessUID);
            },
            set: function (e) {
                this.shaderData.setNumber(t.SmoothnessUID, e);
            }
        }, {
            key: "cubemapPower",
            get: function () {
                return this.shaderData.getNumber(t.CubemapPowerUID);
            },
            set: function (e) {
                this.shaderData.setNumber(t.CubemapPowerUID, e);
            }
        }, {
            key: "cubemapBlur",
            get: function () {
                return this.shaderData.getNumber(t.CubemapBlurUID);
            },
            set: function (e) {
                this.shaderData.setNumber(t.CubemapBlurUID, e);
            }
        }, {
            key: "fakeLight",
            get: function () {
                return this.shaderData.getNumber(t.FakeLightUID);
            },
            set: function (e) {
                this.shaderData.setNumber(t.FakeLightUID, e);
            }
        }, {
            key: "specularPower",
            get: function () {
                return this.shaderData.getNumber(t.SpecularPowerUID);
            },
            set: function (e) {
                this.shaderData.setNumber(t.SpecularPowerUID, e);
            }
        }, {
            key: "specularContrast",
            get: function () {
                return this.shaderData.getNumber(t.SpecularContrastUID);
            },
            set: function (e) {
                this.shaderData.setNumber(t.SpecularContrastUID, e);
            }
        }, {
            key: "glitterPower",
            get: function () {
                return this.shaderData.getNumber(t.GlitterPowerUID);
            },
            set: function (e) {
                this.shaderData.setNumber(t.GlitterPowerUID, e);
            }
        }, {
            key: "glitterContrast",
            get: function () {
                return this.shaderData.getNumber(t.GlitterContrastUID);
            },
            set: function (e) {
                this.shaderData.setNumber(t.GlitterContrastUID, e);
            }
        }, {
            key: "glitterySpeed",
            get: function () {
                return this.shaderData.getNumber(t.GlitterySpeedUID);
            },
            set: function (e) {
                this.shaderData.setNumber(t.GlitterySpeedUID, e);
            }
        }, {
            key: "glitteryMaskDotsScale",
            get: function () {
                return this.shaderData.getNumber(t.GlitteryMaskDotsScaleUID);
            },
            set: function (e) {
                this.shaderData.setNumber(t.GlitteryMaskDotsScaleUID, e);
            }
        }, {
            key: "maskAdjust",
            get: function () {
                return this.shaderData.getNumber(t.MaskAdjustUID);
            },
            set: function (e) {
                this.shaderData.setNumber(t.MaskAdjustUID, e);
            }
        }, {
            key: "enableEmission",
            get: function () {
                return this._enableEmission;
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADERDEFINE_EMISSION) : this._shaderValues.removeDefine(t.SHADERDEFINE_EMISSION),
                    this._enableEmission = e;
            }
        }, {
            key: "emissionTexture",
            get: function () {
                return this._shaderValues.getTexture(t.EMISSION_TEXTURE);
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADERDEFINE_EMISSIONTEXTURE) : this._shaderValues.removeDefine(t.SHADERDEFINE_EMISSIONTEXTURE),
                    this._shaderValues.setTexture(t.EMISSION_TEXTURE, e);
            }
        }, {
            key: "emissionColor",
            get: function () {
                return this._shaderValues.getVector(t.EMISSION_COLOR);
            },
            set: function (e) {
                this._shaderValues.setVector(t.EMISSION_COLOR, e);
            }
        }, {
            key: "cloneTo",
            value: function (e) {
                n(i(t.prototype), "cloneTo", this).call(this, e), e.enableEmission = this.enableEmission;
            }
        }, {
            key: "clone",
            value: function () {
                var e = new t();
                return this.cloneTo(e), e;
            }
        }], [{
            key: "__initDefine__",
            value: function () {
                this.SHADERDEFINE_ALBEDOTEXTURE = Qe.getDefineByName("ALBEDOTEXTURE"), this.SHADERDEFINE_NORMALMAP = Qe.getDefineByName("NORMALMAP"),
                    this.SHADERDEFINE_REFCTIONCUBEMAP = Qe.getDefineByName("REFCTIONCUBEMAP"), this.SHADERDEFINE_SPECULARGLITTER = Qe.getDefineByName("SPECULARGLITTER"),
                    this.SHADERDEFINE_GLITTERMAP = Qe.getDefineByName("GLITTERMAP"), this.SHADERDEFINE_MASKTEX = Qe.getDefineByName("MASKTEX");
                var e = {
                    a_Position: je.MESH_POSITION0,
                    a_Color: je.MESH_COLOR0,
                    a_Normal: je.MESH_NORMAL0,
                    a_Texcoord0: je.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: je.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: je.MESH_BLENDWEIGHT0,
                    a_BoneIndices: je.MESH_BLENDINDICES0,
                    a_Tangent0: je.MESH_TANGENT0,
                    a_WorldMat: je.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: je.MESH_SIMPLEANIMATOR
                }, a = {
                    u_Bones: Qe.PERIOD_CUSTOM,
                    u_AlbedoTexture: Qe.PERIOD_MATERIAL,
                    u_AlbedoTextureTilingOffset: Qe.PERIOD_MATERIAL,
                    u_AlbedoColor: Qe.PERIOD_MATERIAL,
                    u_TilingOffset: Qe.PERIOD_MATERIAL,
                    u_AlphaTestValue: Qe.PERIOD_MATERIAL,
                    u_ReflectionCubemap: Qe.PERIOD_MATERIAL,
                    u_Normalmap: Qe.PERIOD_MATERIAL,
                    u_NormalmapTilingOffset: Qe.PERIOD_MATERIAL,
                    u_SpecularGlitterTilingOffset: Qe.PERIOD_MATERIAL,
                    u_SpecularGlitter: Qe.PERIOD_MATERIAL,
                    u_GlitterMap: Qe.PERIOD_MATERIAL,
                    u_GlitterMapTilingOffset: Qe.PERIOD_MATERIAL,
                    u_MaskTex: Qe.PERIOD_MATERIAL,
                    u_MaskTexTilingOffset: Qe.PERIOD_MATERIAL,
                    u_GlitterColor: Qe.PERIOD_MATERIAL,
                    u_Smoothness: Qe.PERIOD_MATERIAL,
                    u_FakeLight: Qe.PERIOD_MATERIAL,
                    u_CubemapPower: Qe.PERIOD_MATERIAL,
                    u_CubemapBlur: Qe.PERIOD_MATERIAL,
                    u_SpecularPower: Qe.PERIOD_MATERIAL,
                    u_SpecularContrast: Qe.PERIOD_MATERIAL,
                    u_GlitterPower: Qe.PERIOD_MATERIAL,
                    u_GlitterContrast: Qe.PERIOD_MATERIAL,
                    u_GlitterySpeed: Qe.PERIOD_MATERIAL,
                    u_GlitteryMaskDotsScale: Qe.PERIOD_MATERIAL,
                    u_MaskAdjust: Qe.PERIOD_MATERIAL,
                    u_EmissionTexture: Qe.PERIOD_MATERIAL,
                    u_EmissionColor: Qe.PERIOD_MATERIAL,
                    u_Time: Qe.PERIOD_SCENE,
                    u_WorldMat: Qe.PERIOD_SPRITE,
                    u_MvpMatrix: Qe.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Qe.PERIOD_SPRITE,
                    u_LightMap: Qe.PERIOD_SPRITE,
                    u_LightMapDirection: Qe.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Qe.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Qe.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Qe.PERIOD_SPRITE,
                    u_CameraPos: Qe.PERIOD_CAMERA,
                    u_Viewport: Qe.PERIOD_CAMERA,
                    u_ProjectionParams: Qe.PERIOD_CAMERA,
                    u_View: Qe.PERIOD_CAMERA,
                    u_ViewProjection: Qe.PERIOD_CAMERA,
                    u_ReflectTexture: Qe.PERIOD_SCENE,
                    u_FogStart: Qe.PERIOD_SCENE,
                    u_FogRange: Qe.PERIOD_SCENE,
                    u_FogColor: Qe.PERIOD_SCENE,
                    u_DirationLightCount: Qe.PERIOD_SCENE,
                    u_LightBuffer: Qe.PERIOD_SCENE,
                    u_LightClusterBuffer: Qe.PERIOD_SCENE,
                    u_AmbientColor: Qe.PERIOD_SCENE,
                    u_ShadowBias: Qe.PERIOD_SCENE,
                    u_ShadowLightDirection: Qe.PERIOD_SCENE,
                    u_ShadowMap: Qe.PERIOD_SCENE,
                    u_ShadowParams: Qe.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Qe.PERIOD_SCENE,
                    u_ShadowMatrices: Qe.PERIOD_SCENE,
                    u_ShadowMapSize: Qe.PERIOD_SCENE,
                    u_SpotShadowMap: Qe.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Qe.PERIOD_SCENE,
                    u_ShadowLightPosition: Qe.PERIOD_SCENE,
                    u_AmbientSHAr: Qe.PERIOD_SCENE,
                    u_AmbientSHAg: Qe.PERIOD_SCENE,
                    u_AmbientSHAb: Qe.PERIOD_SCENE,
                    u_AmbientSHBr: Qe.PERIOD_SCENE,
                    u_AmbientSHBg: Qe.PERIOD_SCENE,
                    u_AmbientSHBb: Qe.PERIOD_SCENE,
                    u_AmbientSHC: Qe.PERIOD_SCENE,
                    "u_DirectionLight.color": Qe.PERIOD_SCENE,
                    "u_DirectionLight.direction": Qe.PERIOD_SCENE,
                    "u_PointLight.position": Qe.PERIOD_SCENE,
                    "u_PointLight.range": Qe.PERIOD_SCENE,
                    "u_PointLight.color": Qe.PERIOD_SCENE,
                    "u_SpotLight.position": Qe.PERIOD_SCENE,
                    "u_SpotLight.direction": Qe.PERIOD_SCENE,
                    "u_SpotLight.range": Qe.PERIOD_SCENE,
                    "u_SpotLight.spot": Qe.PERIOD_SCENE,
                    "u_SpotLight.color": Qe.PERIOD_SCENE
                }, n = {
                    s_Cull: Qe.RENDER_STATE_CULL,
                    s_Blend: Qe.RENDER_STATE_BLEND,
                    s_BlendSrc: Qe.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Qe.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Qe.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Qe.RENDER_STATE_DEPTH_WRITE
                }, i = Qe.add("TYGlitterShader", null, null, !0), r = new Ke(e, a);
                i.addSubShader(r), r.addShaderPass(Ye.VS, Ye.PS, n), Laya.ClassUtils.regClass("TY.GlitterMaterial", t);
            }
        }]), t;
    }(Laya.Material);
    qe.ALBEDOTEXTURE = Qe.propertyNameToID("u_AlbedoTexture"), qe.NORMALMAP = Qe.propertyNameToID("u_Normalmap"),
        qe.REFCTIONCUBEMAP = Qe.propertyNameToID("u_ReflectionCubemap"), qe.SPECULARGLITTER = Qe.propertyNameToID("u_SpecularGlitter"),
        qe.GLITTERMAP = Qe.propertyNameToID("u_GlitterMap"), qe.MASKTEX = Qe.propertyNameToID("u_MaskTex"),
        qe.ALBEDOCOLOR = Qe.propertyNameToID("u_AlbedoColor"), qe.GLITTER_COLOR = Qe.propertyNameToID("u_GlitterColor"),
        qe.ALBEDO_TEXTURE_TilingOffset = Qe.propertyNameToID("u_AlbedoTextureTilingOffset"),
        qe.NOMALMAP_TilingOffset = Qe.propertyNameToID("u_NormalmapTilingOffset"), qe.SpecularGlitter_TilingOffset = Qe.propertyNameToID("u_SpecularGlitterTilingOffset"),
        qe.GlitterMap_TilingOffset = Qe.propertyNameToID("u_GlitterMapTilingOffset"), qe.MaskTex_TilingOffset = Qe.propertyNameToID("u_MaskTexTilingOffset"),
        qe.SmoothnessUID = Qe.propertyNameToID("u_Smoothness"), qe.FakeLightUID = Qe.propertyNameToID("u_FakeLight"),
        qe.CubemapPowerUID = Qe.propertyNameToID("u_CubemapPower"), qe.CubemapBlurUID = Qe.propertyNameToID("u_CubemapBlur"),
        qe.SpecularPowerUID = Qe.propertyNameToID("u_SpecularPower"), qe.SpecularContrastUID = Qe.propertyNameToID("u_SpecularContrast"),
        qe.GlitterPowerUID = Qe.propertyNameToID("u_GlitterPower"), qe.GlitterContrastUID = Qe.propertyNameToID("u_GlitterContrast"),
        qe.GlitterySpeedUID = Qe.propertyNameToID("u_GlitterySpeed"), qe.GlitteryMaskDotsScaleUID = Qe.propertyNameToID("u_GlitteryMaskDotsScale"),
        qe.MaskAdjustUID = Qe.propertyNameToID("u_MaskAdjust"), qe.SHADERDEFINE_EMISSION = Qe.getDefineByName("EMISSION"),
        qe.SHADERDEFINE_EMISSIONTEXTURE = Qe.getDefineByName("EMISSIONTEXTURE"), qe.EMISSION_TEXTURE = Qe.propertyNameToID("u_EmissionTexture"),
        qe.EMISSION_COLOR = Qe.propertyNameToID("u_EmissionColor");
    var Ze = s(function e() {
        l(this, e);
    });
    Ze.PBRVS = '\n    #if defined(GL_FRAGMENT_PRECISION_HIGH)\n    precision highp float;\n    precision highp int;\n    #else\n    precision mediump float;\n    precision mediump int;\n    #endif\n    #include "Lighting.glsl";\n    #include "LayaUtile.glsl"\n    #include "Shadow.glsl"\n    #include "PBRVSInput.glsl";\n    #include "PBRVertex.glsl";\n    uniform mat4 u_View;\n    varying float v_EyeDepth;\n    varying vec4 v_screenPos;\n    #if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n    #ifdef LEGACYSINGLELIGHTING\n    uniform mat4 u_View;\n    #endif\n    #else\n    uniform mat4 u_View;\n    #endif\n    uniform vec4 u_ProjectionParams;\n\n    vec4 computeScreenPos (vec4 pos)\n    {\n        vec4 o = pos * 0.5;\n        o.xy = vec2(o.x, o.y*u_ProjectionParams.z ) + o.w;\n        o.zw = pos.zw;\n\n        return o;\n    }\n    void main()\n    {\n        vertexForward();\n        v_EyeDepth = length(v_EyeVec.xyz);\n        gl_Position=remapGLPositionZ(gl_Position);\n        v_screenPos = computeScreenPos(gl_Position);\n\n    }\n',
        Ze.PBRPS = '\n    #if defined(GL_FRAGMENT_PRECISION_HIGH)\n    precision highp float;\n    precision highp int;\n    #else\n    precision mediump float;\n    precision mediump int;\n    #endif\n\n    #include "Lighting.glsl";\n    #include "Shadow.glsl"\n    #include "PBRFSInput.glsl";\n    #include "LayaPBRBRDF.glsl";\n    #include "GlobalIllumination.glsl";\n    #include "PBRCore.glsl";\n\n    #if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n    #ifdef LEGACYSINGLELIGHTING\n    uniform mat4 u_View;\n    uniform vec4 u_ProjectionParams;\n    #endif\n    #else\n    uniform mat4 u_View;\n    uniform vec4 u_ProjectionParams;\n    #endif\n    uniform float u_EndDitheringFade;\n    uniform float u_MaskClip;\n    varying vec4 v_screenPos;\n    varying float v_EyeDepth;\n\n    mediump vec4 tyBRDFHighLight(mediump vec3 diffColor, mediump vec3 specColor,\n    mediump float oneMinusReflectivity, float perceptualRoughness,\n    float roughness, mediump float nv, vec3 normal, vec3 viewDir, LayaLight light)\n    {\n        vec3 halfDir = safeNormalize(viewDir-light.dir);\n\n        float nl = clamp(dot(normal, -light.dir), 0.0, 1.0);\n        float nh = clamp(dot(normal, halfDir), 0.0, 1.0);\n        mediump float lv = clamp(dot(light.dir, viewDir), 0.0, 1.0);\n        mediump float lh = clamp(dot(light.dir, -halfDir), 0.0, 1.0);\n\n        // Diffuse term\n        mediump float diffuseTerm = disneyDiffuse(nv, nl, lh, perceptualRoughness) * nl;\n\n        // Specular term\n        // HACK: theoretically we should divide diffuseTerm by Pi and not multiply specularTerm!\n        // BUT that will make shader look significantly darker than Legacy ones\n\n        // GGX with roughtness to 0 would mean no specular at all, using max(roughness, 0.002) here to match HDrenderloop roughtness remapping.\n        roughness = max(roughness, 0.002);\n        float V = smithJointGGXVisibilityTerm(nl, nv, roughness);\n        float D = ggxTerm(nh, roughness);\n\n        float specularTerm = V * D * PI;// Torrance-Sparrow model, Fresnel is applied later\n\n        //#ifdef LAYA_COLORSPACE_GAMMA\n        specularTerm = sqrt(max(1e-4, specularTerm));\n        //#endif\n        specularTerm = max(0.0, specularTerm * nl);\n\n        mediump vec3 color = diffColor * light.color * diffuseTerm + specularTerm * light.color * fresnelTerm(specColor, lh);\n        return vec4(color, 1.0);\n    }\n    int scmod(int x, int y)\n    {\n        float temp = floor(float(x) / 4.0);\n        return x - y * int(temp);\n    }\n    float dither4x4Bayer(int x, int y){\n        mat4 threshold = mat4(\n        1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0,\n        13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0,\n        4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0,\n        16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0\n        );\n        mat4  _RowAccess = mat4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);\n        vec4 tthreshold;\n        vec4 tRowAccess;\n        for (int i =0;i<4;i++){\n            if (i == x) tthreshold = threshold[i];\n            if (i == y) tRowAccess = _RowAccess[i];\n        }\n        vec4 t = tthreshold * tRowAccess;\n        return t.x+t.y+t.z+t.w;\n    }\n\n    float getEyeToA(float eyeDepth)\n    {\n        float dis = (eyeDepth -u_ProjectionParams.x);\n        return (dis - u_EndDitheringFade) / u_MaskClip;\n        // return (eyeDepth + -u_ProjectionParams.x) / (u_EndDitheringFade - u_ProjectionParams.x);\n    }\n\n    void myFragmentForward()\n{ \n    vec2 uv;\n    #if defined(ALBEDOTEXTURE)||defined(METALLICGLOSSTEXTURE)||defined(NORMALTEXTURE)||defined(EMISSIONTEXTURE)||defined(OCCLUSIONTEXTURE)||defined(PARALLAXTEXTURE)\n        #ifdef PARALLAXTEXTURE\n            uv = parallax(v_Texcoord0, normalize(v_ViewDirForParallax));\n        #else\n            uv = v_Texcoord0;\n        #endif\n    #endif\n        \n    mediump float alpha = getAlpha(uv);\n    #ifdef ALPHATEST\n        if (alpha<u_AlphaTestValue)\n            discard;\n    #endif\n        \n    FragmentCommonData o = SETUP_BRDF_INPUT(uv);\n    vec3 binormal;\n    vec3 tangent;\n    #ifdef NORMALTEXTURE\n        tangent = v_Tangent;\n        binormal = v_Binormal;\n    #endif\n    //o.diffColor = vec4(1.,0.,0.);\n    vec3 normal = v_Normal;\n    vec3 normalWorld = perPixelWorldNormal(uv, normal, binormal, tangent);//In FS if the normal use mediump before normalize will cause precision prolem in mobile device.\n    vec3 eyeVec = normalize(v_EyeVec);\n    vec3 posworld = v_PositionWorld;\n\n    #ifdef TRANSPARENTBLEND\n        o.diffColor=preMultiplyAlpha(o.diffColor, alpha, o.oneMinusReflectivity, /*out*/alpha);// shader relies on pre-multiply alpha-blend (srcBlend = One, dstBlend = OneMinusSrcAlpha)\n    #endif\n        \n    mediump float occlusion = getOcclusion(uv);\n    mediump vec2 lightMapUV;\n    #ifdef LIGHTMAP\n        lightMapUV=v_LightMapUV;\n    #endif\n    float perceptualRoughness = smoothnessToPerceptualRoughness(o.smoothness);\n    float roughness = perceptualRoughnessToRoughness(perceptualRoughness);\n    float nv = abs(dot(normalWorld, eyeVec));\n    LayaGI gi =fragmentGI(o.smoothness, eyeVec, occlusion, lightMapUV, normalWorld, posworld);\n    vec4 color = LAYA_BRDF_GI(o.diffColor, o.specColor, o.oneMinusReflectivity, o.smoothness, perceptualRoughness, roughness, nv, normalWorld, eyeVec, gi);\n    \n    float shadowAttenuation = 1.0;\n    \n    \n    #if !defined(OFF_REAL_TIME_LIGHT)\n//    #else\n    \n    \n    #ifdef LEGACYSINGLELIGHTING\n        #ifdef DIRECTIONLIGHT\n            #if defined(CALCULATE_SHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                #ifdef SHADOW_CASCADE\n                    vec4 shadowCoord = getShadowCoord(vec4(v_PositionWorld, 1.0));\n                #else\n                    vec4 shadowCoord = v_ShadowCoord;\n                #endif\n                shadowAttenuation=sampleShadowmap(shadowCoord);\n            #endif\n            LayaLight dirLight = layaDirectionLightToLight(u_DirectionLight, shadowAttenuation);\n            color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, dirLight);\n        #endif\n    \n        #ifdef POINTLIGHT\n            shadowAttenuation = 1.0;\n            LayaLight poiLight = layaPointLightToLight(posworld, normalWorld, u_PointLight, shadowAttenuation);\n            color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, poiLight);\n        #endif\n        \n        #ifdef SPOTLIGHT\n            shadowAttenuation = 1.0;\n            #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                vec4 spotShadowcoord = v_SpotShadowCoord;\n                shadowAttenuation = sampleSpotShadowmap(spotShadowcoord);\n            #endif\n            LayaLight spoLight = layaSpotLightToLight(posworld, normalWorld, u_SpotLight, shadowAttenuation);\n            color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, spoLight);\n        #endif\n    #else\n         #ifdef DIRECTIONLIGHT\n            for (int i = 0; i < MAX_LIGHT_COUNT; i++) \n            { \n                shadowAttenuation = 1.0;\n                if (i >= u_DirationLightCount)\n                    break;\n                #if defined(CALCULATE_SHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                    if (i == 0)\n                    { \n                        #ifdef SHADOW_CASCADE\n                            vec4 shadowCoord = getShadowCoord(vec4(v_PositionWorld, 1.0));\n                        #else\n                            vec4 shadowCoord = v_ShadowCoord;\n                        #endif\n                        shadowAttenuation *= sampleShadowmap(shadowCoord);\n                     }\n                #endif\n                DirectionLight directionLight = getDirectionLight(u_LightBuffer, i);\n                LayaLight dirLight = layaDirectionLightToLight(directionLight, shadowAttenuation);\n                 color+=tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, dirLight);\n             }\n        #endif\n        #if defined(POINTLIGHT)||defined(SPOTLIGHT)\n            ivec4 clusterInfo =getClusterInfo(u_LightClusterBuffer, u_View, u_Viewport, v_PositionWorld, gl_FragCoord, u_ProjectionParams);\n        #ifdef POINTLIGHT\n            for (int i = 0; i < MAX_LIGHT_COUNT; i++) \n            { \n                shadowAttenuation = 1.0;\n                if (i >= clusterInfo.x)//PointLightCount\n                    break;\n                PointLight pointLight = getPointLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, i);\n                LayaLight poiLight = layaPointLightToLight(posworld, normalWorld, pointLight, shadowAttenuation);\n                color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, poiLight);\n             }\n        #endif\n            #ifdef SPOTLIGHT\n                for (int i = 0; i < MAX_LIGHT_COUNT; i++) \n                { \n                    shadowAttenuation = 1.0;\n                    if (i >= clusterInfo.y)//SpotLightCount\n                        break;\n                    #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                        if (i == 0)\n                        { \n                            vec4 spotShadowcoord = v_SpotShadowCoord;\n                            shadowAttenuation= sampleSpotShadowmap(spotShadowcoord);\n                         }\n                    #endif\n                    SpotLight spotLight = getSpotLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, i);\n                    LayaLight spoLight = layaSpotLightToLight(posworld, normalWorld, spotLight, shadowAttenuation);\n                    color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, spoLight);\n                 }\n            #endif\n        #endif\n     #endif\n                    #endif\n    #ifdef EMISSION\n        vec3 eC = emission(uv);\n        color.rgb += eC;\n    #endif\n\n    #ifdef FOG\n        float lerpFact=clamp((1.0/gl_FragCoord.w-u_FogStart)/u_FogRange, 0.0, 1.0);\n        color.rgb=mix(color.rgb, u_FogColor, lerpFact);\n    #endif\n            \n    gl_FragColor=vec4(color.rgb, alpha);\n}\n\n    void main()\n    {\n        vec2 pos = v_screenPos.xy / v_screenPos.w;\n        pos *= u_Viewport.zw;\n        int x = scmod(int (pos.x), 4);\n        int y = scmod(int (pos.y), 4);\n        float value = dither4x4Bayer(x, y);\n\n        if (getEyeToA(v_EyeDepth) - value < 0.0)  discard;\n        myFragmentForward();\n    }';
    var Je = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this))._offRealTimeLight = !1, e.setShaderName("PBRStandardDitheringFade"),
                e;
        }
        return s(t, [{
            key: "clone",
            value: function () {
                var e = new t();
                return e.offRealTimeLight = this._offRealTimeLight, this.cloneTo(e), e;
            }
        }, {
            key: "offRealTimeLight",
            get: function () {
                return this._offRealTimeLight;
            },
            set: function (e) {
                this._offRealTimeLight = e, e ? this._shaderValues.addDefine(t.SHADER_DEFINE_OFF_REAL_TIME_LIGHT) : this._shaderValues.removeDefine(t.SHADER_DEFINE_OFF_REAL_TIME_LIGHT);
            }
        }, {
            key: "endDitheringFade",
            get: function () {
                return this.getShaderPropertyValue("u_EndDitheringFade");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_EndDitheringFade", e);
            }
        }, {
            key: "maskClip",
            get: function () {
                return this.getShaderPropertyValue("u_MaskClip");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_MaskClip", e);
            }
        }], [{
            key: "__init__",
            value: function () {
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMap: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMapDirection: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectCubeHDRParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeProbePosition: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMax: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMin: Laya.Shader3D.PERIOD_SPRITE,
                    u_CameraPos: Laya.Shader3D.PERIOD_CAMERA,
                    u_View: Laya.Shader3D.PERIOD_CAMERA,
                    u_ProjectionParams: Laya.Shader3D.PERIOD_CAMERA,
                    u_Viewport: Laya.Shader3D.PERIOD_CAMERA,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OcclusionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Smoothness: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SmoothnessScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_occlusionStrength: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MetallicGlossTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Metallic: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EndDitheringFade: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MaskClip: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AmbientColor: Laya.Shader3D.PERIOD_SCENE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE,
                    u_DirationLightCount: Laya.Shader3D.PERIOD_SCENE,
                    u_LightBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_LightClusterBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowBias: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightDirection: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowParams: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMatrices: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMapSize: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightPosition: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHC: Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.spot": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.color": Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("PBRStandardDitheringFade", e, a, !0, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r), r.addShaderPass(Ze.PBRVS, Ze.PBRPS, n, "Forward"), Laya.ClassUtils.regClass("TY.PBRStandardDitheringFadeMaterial", t);
            }
        }]), t;
    }(Laya.PBRStandardMaterial);
    Je.SHADER_DEFINE_OFF_REAL_TIME_LIGHT = Laya.Shader3D.getDefineByName("OFF_REAL_TIME_LIGHT");
    var $e = s(function e() {
        l(this, e);
    });
    $e.PBRVS = '\n#if defined(GL_FRAGMENT_PRECISION_HIGH)\nprecision highp float;\nprecision highp int;\n#else\nprecision mediump float;\nprecision mediump int;\n#endif\n#include "Lighting.glsl";\n#include "LayaUtile.glsl"\n#include "Shadow.glsl"\n#include "PBRVSInput.glsl";\n#include "PBRVertex.glsl";\n\nvoid main()\n{\n    vertexForward();\n    gl_Position=remapGLPositionZ(gl_Position);\n}\n',
        $e.PBRPS = '\n#if defined(GL_FRAGMENT_PRECISION_HIGH)\nprecision highp float;\nprecision highp int;\n#else\nprecision mediump float;\nprecision mediump int;\n#endif\n\n#include "Lighting.glsl";\n#include "Shadow.glsl"\n#include "PBRFSInput.glsl";\n#include "LayaPBRBRDF.glsl";\n#include "GlobalIllumination.glsl";\n#include "PBRCore.glsl";\n\nvoid main()\n{\n    fragmentForward();\n}';
    var ea = s(function e() {
        l(this, e);
    });
    ea.OutLineVs = '\n    #if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n    precision highp int;\n    #else\n    precision mediump float;\n    precision mediump int;\n    #endif\n\n    #include "Lighting.glsl";\n    #include "LayaUtile.glsl"\n\n    attribute vec4 a_Position;\n    attribute vec3 a_Normal;\n\n    #ifdef GPU_INSTANCE\n    attribute mat4 a_MvpMatrix;\n    attribute mat4 a_WorldMat;\n    #else\n    uniform mat4 u_MvpMatrix;\n    uniform mat4 u_WorldMat;\n    #endif\n\n    #ifdef BONE\n    const int c_MaxBoneCount = 24;\n    attribute vec4 a_BoneIndices;\n    attribute vec4 a_BoneWeights;\n    uniform mat4 u_Bones[c_MaxBoneCount];\n    #endif\n\n    uniform vec4 u_Viewport;\n    varying vec3 v_PositionWorld;\n    uniform float u_OutlineRange;\n    uniform mat4 u_ViewProjection;\n    void main()\n    {\n        vec4 position;\n        #ifdef BONE\n            mat4 skinTransform;\n                #ifdef SIMPLEBONE\n                    float currentPixelPos;\n                    #ifdef GPU_INSTANCE\n                        currentPixelPos = a_SimpleTextureParams.x+a_SimpleTextureParams.y;\n                    #else\n                        currentPixelPos = u_SimpleAnimatorParams.x+u_SimpleAnimatorParams.y;\n                    #endif\n                    float offset = 1.0/u_SimpleAnimatorTextureSize;\n                    skinTransform =  loadMatFromTexture(currentPixelPos, int(a_BoneIndices.x), offset) * a_BoneWeights.x;\n                    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.y), offset) * a_BoneWeights.y;\n                    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.z), offset) * a_BoneWeights.z;\n                    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.w), offset) * a_BoneWeights.w;\n                #else\n                    skinTransform =  u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n                    skinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n                    skinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n                    skinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n                #endif\n            position = skinTransform*a_Position;\n        #else\n            position = a_Position;\n        #endif\n\n\n        mat4 worldMat;\n        #ifdef GPU_INSTANCE\n            worldMat = a_WorldMat;\n        #else\n            worldMat = u_WorldMat;\n        #endif\n        \n        position += (vec4(a_Normal.xyz,0.0) * u_OutlineRange *0.01);\n        #ifdef GPU_INSTANCE\n            gl_Position = u_ViewProjection * worldMat * position;\n        #else\n            gl_Position = u_MvpMatrix * position;\n        #endif\n        gl_Position = remapGLPositionZ(gl_Position);\n    }\n',
        ea.OutLinePs = '\n    #if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n    precision highp int;\n    #else\n    precision mediump float;\n    precision mediump int;\n    #endif\n\n    #include "Lighting.glsl";\n    #include "LayaUtile.glsl"\n\n    uniform vec4 u_OutlineColor;\n\n    void main()\n    {\n        gl_FragColor = u_OutlineColor;\n    }\n';
    var aa = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this))._enableCustomLight = !1, e.setShaderName("PBRStandardOutLine"),
                e;
        }
        return s(t, [{
            key: "clone",
            value: function () {
                var e = new t();
                return this.cloneTo(e), e;
            }
        }, {
            key: "outlineColor",
            get: function () {
                return this._shaderValues.getVector(t.SHADOW_OUTLINE_COLOR);
            },
            set: function (e) {
                this._shaderValues.setVector(t.SHADOW_OUTLINE_COLOR, e);
            }
        }, {
            key: "outlineRange",
            get: function () {
                return this._shaderValues.getNumber(t.SHADOW_OUTLINE_RANGE);
            },
            set: function (e) {
                this._shaderValues.setNumber(t.SHADOW_OUTLINE_RANGE, e);
            }
        }], [{
            key: "__init__",
            value: function () {
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMap: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMapDirection: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectCubeHDRParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeProbePosition: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMax: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMin: Laya.Shader3D.PERIOD_SPRITE,
                    u_CameraPos: Laya.Shader3D.PERIOD_CAMERA,
                    u_View: Laya.Shader3D.PERIOD_CAMERA,
                    u_ProjectionParams: Laya.Shader3D.PERIOD_CAMERA,
                    u_Viewport: Laya.Shader3D.PERIOD_CAMERA,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OcclusionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Smoothness: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SmoothnessScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_occlusionStrength: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MetallicGlossTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Metallic: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OutlineRange: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OutlineColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AmbientColor: Laya.Shader3D.PERIOD_SCENE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE,
                    u_DirationLightCount: Laya.Shader3D.PERIOD_SCENE,
                    u_LightBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_LightClusterBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowBias: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightDirection: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowParams: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMatrices: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMapSize: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightPosition: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHC: Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.spot": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.color": Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("PBRStandardOutLine", e, a, !0, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r);
                var o = r.addShaderPass(ea.OutLineVs, ea.OutLinePs);
                o.renderState.cull = Laya.RenderState.CULL_FRONT, o.renderState.depthWrite = !1,
                    r.addShaderPass($e.PBRVS, $e.PBRPS, n, "Forward"), Laya.ClassUtils.regClass("TY.PBRStandardOutLineMaterial", t);
            }
        }]), t;
    }(Laya.PBRStandardMaterial);
    aa.SHADOW_OUTLINE_RANGE = Laya.Shader3D.propertyNameToID("u_OutlineRange"), aa.SHADOW_OUTLINE_COLOR = Laya.Shader3D.propertyNameToID("u_OutlineColor");
    var ta = s(function e() {
        l(this, e);
    });
    ta.ShadowVs = '\n    #if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n    precision highp int;\n    #else\n    precision mediump float;\n    precision mediump int;\n    #endif\n\n    #include "Lighting.glsl";\n    #include "LayaUtile.glsl"\n\n    attribute vec4 a_Position;\n\n    #ifdef GPU_INSTANCE\n    attribute mat4 a_MvpMatrix;\n    attribute mat4 a_WorldMat;\n    #else\n    uniform mat4 u_MvpMatrix;\n    uniform mat4 u_WorldMat;\n    #endif\n\n    #ifdef BONE\n    const int c_MaxBoneCount = 24;\n    attribute vec4 a_BoneIndices;\n    attribute vec4 a_BoneWeights;\n    uniform mat4 u_Bones[c_MaxBoneCount];\n    #endif\n\n    varying vec3 v_PositionWorld;\n    uniform vec4 u_ProjectionParams;\n    uniform mat4 u_ViewProjection;\n\n    #if defined(DIRECTIONLIGHT)||defined(POINTLIGHT)||defined(SPOTLIGHT)\n    #ifdef LEGACYSINGLELIGHTING\n    #ifdef DIRECTIONLIGHT\n    uniform DirectionLight u_DirectionLight;\n    #endif\n    #ifdef POINTLIGHT\n    uniform PointLight u_PointLight;\n    #endif\n    #ifdef SPOTLIGHT\n    uniform SpotLight u_SpotLight;\n    #endif\n    #else\n    uniform int u_DirationLightCount;\n    uniform sampler2D u_LightBuffer;\n    uniform sampler2D u_LightClusterBuffer;\n    #endif\n    #endif\n\n    #ifdef CUSTOMLIGHTDIRECTION\n    uniform vec3 u_CustomLightDir;\n    #endif\n\n    uniform vec4 u_ShadowPlane;\n    varying vec3 v_center;\n    varying vec3 v_shadowPos;\n    varying float v_OffsetH;\n    varying vec4 v_screenPos;\n    vec4 computeScreenPos (vec4 pos)\n    {\n        vec4 o = pos * 0.5;\n        o.xy = vec2(o.x, o.y*u_ProjectionParams.z) + o.w;\n        o.zw = pos.zw;\n\n        return o;\n    }\n\n\n\n    void main()\n    {\n        vec4 centerPos;\n        vec4 position;\n        #ifdef BONE\n        mat4 skinTransform;\n        #ifdef SIMPLEBONE\n        float currentPixelPos;\n        #ifdef GPU_INSTANCE\n        currentPixelPos = a_SimpleTextureParams.x+a_SimpleTextureParams.y;\n        #else\n        currentPixelPos = u_SimpleAnimatorParams.x+u_SimpleAnimatorParams.y;\n        #endif\n        float offset = 1.0/u_SimpleAnimatorTextureSize;\n        skinTransform =  loadMatFromTexture(currentPixelPos, int(a_BoneIndices.x), offset) * a_BoneWeights.x;\n        skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.y), offset) * a_BoneWeights.y;\n        skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.z), offset) * a_BoneWeights.z;\n        skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.w), offset) * a_BoneWeights.w;\n        #else\n        skinTransform =  u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n        skinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n        skinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n        skinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n        #endif\n        position = skinTransform*a_Position;\n        centerPos = skinTransform * vec4(0., 0., 0., 1.);\n        #else\n        position = a_Position;\n        centerPos = vec4(0., 0., 0., 1.);\n        #endif\n\n\n        mat4 worldMat;\n        #ifdef GPU_INSTANCE\n        worldMat = a_WorldMat;\n        #else\n        worldMat = u_WorldMat;\n        #endif\n        vec4 worldPosV4 = (worldMat*position);\n\n        v_PositionWorld = worldPosV4.xyz;\n        v_center = (worldMat * centerPos).xyz;\n        mat3 worldInvMat;\n        #ifdef BONE\n        worldInvMat=INVERSE_MAT(mat3(worldMat*skinTransform));\n        #else\n        worldInvMat=INVERSE_MAT(mat3(worldMat));\n        #endif\n        //        #ifdef GPU_INSTANCE\n        //        gl_Position = a_MvpMatrix * position;\n        //        #else\n        //        gl_Position = u_MvpMatrix * position;\n        //        #endif\n        vec3 lightVec;\n        #ifdef CUSTOMLIGHTDIRECTION\n        lightVec = u_CustomLightDir;\n        #else\n        #ifdef LEGACYSINGLELIGHTING\n        #ifdef DIRECTIONLIGHT\n        lightVec = u_DirectionLight.direction;\n        #endif\n\n        #ifdef POINTLIGHT\n        lightVec = v_PositionWorld - u_PointLight.position;\n        #endif\n\n        #ifdef SPOTLIGHT\n        lightVec =  v_PositionWorld - u_SpotLight.position;\n        #endif\n        #else\n        #ifdef DIRECTIONLIGHT\n        DirectionLight directionLight = getDirectionLight(u_LightBuffer, 0);\n        lightVec = directionLight.direction;\n        #endif\n        #ifdef POINTLIGHT\n        PointLight pointLight = getPointLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, 0);\n        lightVec = v_PositionWorld - pointLight.position;\n        #endif\n        #ifdef SPOTLIGHT\n        SpotLight spotLight = getSpotLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, 0);\n        lightVec = v_PositionWorld - spotLight.position;\n        #endif\n        #endif\n        #endif\n        lightVec = normalize(lightVec);\n        vec3 tmpvar_3 = v_PositionWorld - (dot(u_ShadowPlane.xyz, v_PositionWorld) - u_ShadowPlane.w) / dot(u_ShadowPlane.xyz, lightVec) * lightVec;\n        vec4 tempVec4 = vec4(tmpvar_3, 1.0);\n\n        v_shadowPos = tmpvar_3;\n        v_OffsetH = v_PositionWorld.y - u_ShadowPlane.w;\n        gl_Position = u_ViewProjection * tempVec4;\n        \n        \n        gl_Position = remapGLPositionZ(gl_Position);\n        v_screenPos = computeScreenPos(gl_Position);\n    }\n',
        ta.ShadowPs = '\n    #if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n    precision highp int;\n    #else\n    precision mediump float;\n    precision mediump int;\n    #endif\n\n    #include "Lighting.glsl";\n    #include "LayaUtile.glsl"\n\n    uniform vec4 u_ShadowColor;\n    uniform vec4 u_ShadowPara;\n    uniform float u_Dither[64];\n    uniform vec4 u_Viewport;\n\n    varying vec3 v_PositionWorld;\n    varying vec3 v_center;\n    varying vec3 v_shadowPos;\n    varying float v_OffsetH;\n    varying vec4 v_screenPos;\n    int scmod(int x, int y)\n    {\n        float temp = floor(float(x) / 8.0);\n        return x - y * int(temp);\n    }\n\n    float dither8x8Bayer(int x, int y)\n    {\n\n        //        const float dither[64] = float[64](\n        //        1.0, 49.0, 13.0, 61.0, 4.0, 52.0, 16.0, 64.0,\n        //        33.0, 17.0, 45.0, 29.0, 36.0, 20.0, 48.0, 32.0,\n        //        9.0, 57.0, 5.0, 53.0, 12.0, 60.0, 8.0, 56.0,\n        //        41.0, 25.0, 37.0, 21.0, 44.0, 28.0, 40.0, 24.0,\n        //        3.0, 51.0, 15.0, 63.0, 2.0, 50.0, 14.0, 62.0,\n        //        35.0, 19.0, 47.0, 31.0, 34.0, 18.0, 46.0, 30.0,\n        //        11.0, 59.0, 7.0, 55.0, 10.0, 58.0, 6.0, 54.0,\n        //        43.0, 27.0, 39.0, 23.0, 42.0, 26.0, 38.0, 22.0);\n        int r = y * 8 + x;\n        float v = 0.0;\n        for (int i =0;i<64;i++){\n            if (r == i){\n                v = u_Dither[i];\n            }\n        }\n        return v;\n    }\n\n    void main()\n    {\n        if (v_OffsetH < .0) discard;\n\n        vec4 color =  u_ShadowColor;\n        vec3 posToPlane = v_center - v_shadowPos;\n        float v = pow(1.0 - clamp(sqrt(dot(posToPlane, posToPlane)) * u_ShadowPara.w - u_ShadowPara.x, 0.0, 1.0), u_ShadowPara.y) * u_ShadowPara.z;\n        color.w *= v;\n        vec2 pos = v_screenPos.xy / v_screenPos.w;\n        pos *= u_Viewport.zw;\n        int x = scmod(int (pos.x), 8);\n        int y = scmod(int (pos.y), 8);\n        \n        float value = dither8x8Bayer(x, y);\n        if (color.w < value) discard;\n\n        gl_FragColor = color;\n    }\n';
    var na = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            l(this, t), (e = a.call(this))._enableCustomLight = !1, e.setShaderName("PBRStandardPlanarShadow");
            for (var n = new Float32Array([1, 49, 13, 61, 4, 52, 16, 64, 33, 17, 45, 29, 36, 20, 48, 32, 9, 57, 5, 53, 12, 60, 8, 56, 41, 25, 37, 21, 44, 28, 40, 24, 3, 51, 15, 63, 2, 50, 14, 62, 35, 19, 47, 31, 34, 18, 46, 30, 11, 59, 7, 55, 10, 58, 6, 54, 43, 27, 39, 23, 42, 26, 38, 22]), i = 0; i < n.length; i++) n[i] = (n[i] + 1) / 65;
            return e._shaderValues.setBuffer(t.SHADOW_Dither, n), e;
        }
        return s(t, [{
            key: "clone",
            value: function () {
                var e = new t();
                return this.cloneTo(e), e;
            }
        }, {
            key: "enableCustomLight",
            get: function () {
                return this._enableCustomLight;
            },
            set: function (e) {
                this._enableCustomLight = e, this._enableCustomLight ? this._shaderValues.addDefine(t.SHADOW_CUSTOM_DIR_DEFINE) : this._shaderValues.removeDefine(t.SHADOW_CUSTOM_DIR_DEFINE);
            }
        }, {
            key: "customLightDir",
            get: function () {
                return this._shaderValues.getVector3(t.SHADOW_LIGHT_DIR);
            },
            set: function (e) {
                this._shaderValues.setVector3(t.SHADOW_LIGHT_DIR, e);
            }
        }, {
            key: "shadowPlane",
            get: function () {
                return this._shaderValues.getVector(t.SHADOW_PLANE);
            },
            set: function (e) {
                this._shaderValues.setVector(t.SHADOW_PLANE, e);
            }
        }, {
            key: "shadowPara",
            get: function () {
                return this._shaderValues.getVector(t.SHADOW_PARA);
            },
            set: function (e) {
                this._shaderValues.setVector(t.SHADOW_PARA, e);
            }
        }, {
            key: "shadowColor",
            get: function () {
                return this._shaderValues.getVector(t.SHADOW_COLOR);
            },
            set: function (e) {
                this._shaderValues.setVector(t.SHADOW_COLOR, e);
            }
        }], [{
            key: "__init__",
            value: function () {
                var e = [[1, 49, 13, 61, 4, 52, 16, 64], [33, 17, 45, 29, 36, 20, 48, 32], [9, 57, 5, 53, 12, 60, 8, 56], [41, 25, 37, 21, 44, 28, 40, 24], [3, 51, 15, 63, 2, 50, 14, 62], [35, 19, 47, 31, 34, 18, 46, 30], [11, 59, 7, 55, 10, 58, 6, 54], [43, 27, 39, 23, 42, 26, 38, 22]], a = new Uint8Array(256);
                this.ThreSholdTex = new Laya.Texture2D(8, 8, Laya.TextureFormat.R8G8B8, !1, !1),
                    this.ThreSholdTex.filterMode = Laya.FilterMode.Point;
                for (var n = 0; n < 8; n++) for (var i = 0; i < 8; i++) {
                    var r = 4 * (8 * n + i);
                    a[r] = e[n][i], a[r + 1] = e[n][i], a[r + 2] = e[n][i], a[r + 3] = e[n][i];
                }
                this.ThreSholdTex.setPixels(a), this.ThreSholdTex.lock = !0;
                var o = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR
                }, s = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMap: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMapDirection: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectCubeHDRParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeProbePosition: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMax: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMin: Laya.Shader3D.PERIOD_SPRITE,
                    u_CameraPos: Laya.Shader3D.PERIOD_CAMERA,
                    u_View: Laya.Shader3D.PERIOD_CAMERA,
                    u_ProjectionParams: Laya.Shader3D.PERIOD_CAMERA,
                    u_Viewport: Laya.Shader3D.PERIOD_CAMERA,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OcclusionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Smoothness: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SmoothnessScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_occlusionStrength: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MetallicGlossTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Metallic: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ShadowColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ShadowPara: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ShadowPlane: Laya.Shader3D.PERIOD_MATERIAL,
                    u_CustomLightDir: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Dither: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AmbientColor: Laya.Shader3D.PERIOD_SCENE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE,
                    u_DirationLightCount: Laya.Shader3D.PERIOD_SCENE,
                    u_LightBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_LightClusterBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowBias: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightDirection: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowParams: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMatrices: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMapSize: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightPosition: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHC: Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.spot": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.color": Laya.Shader3D.PERIOD_SCENE
                }, l = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, u = Laya.Shader3D.add("PBRStandardPlanarShadow", o, s, !0, !0), h = new Laya.SubShader(o, s);
                u.addSubShader(h), h.addShaderPass($e.PBRVS, $e.PBRPS, l, "Forward"), h.addShaderPass(ta.ShadowVs, ta.ShadowPs),
                    Laya.ClassUtils.regClass("TY.PBRStandardPlanarShadowMaterial", t);
            }
        }]), t;
    }(Laya.PBRStandardMaterial);
    na.SHADOW_COLOR = Laya.Shader3D.propertyNameToID("u_ShadowColor"), na.SHADOW_PARA = Laya.Shader3D.propertyNameToID("u_ShadowPara"),
        na.SHADOW_PLANE = Laya.Shader3D.propertyNameToID("u_ShadowPlane"), na.SHADOW_Dither = Laya.Shader3D.propertyNameToID("u_Dither"),
        na.SHADOW_CUSTOM_DIR_DEFINE = Laya.Shader3D.getDefineByName("CUSTOMLIGHTDIRECTION"),
        na.SHADOW_LIGHT_DIR = Laya.Shader3D.propertyNameToID("u_CustomLightDir");
    var ia = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this))._enableCustomLight = !1, e.setShaderName("PBRStandardPlanarShadowOutLine"),
                e;
        }
        return s(t, [{
            key: "clone",
            value: function () {
                var e = new t();
                return this.cloneTo(e), e;
            }
        }, {
            key: "outlineColor",
            get: function () {
                return this._shaderValues.getVector(t.SHADOW_OUTLINE_COLOR);
            },
            set: function (e) {
                this._shaderValues.setVector(t.SHADOW_OUTLINE_COLOR, e);
            }
        }, {
            key: "outlineRange",
            get: function () {
                return this._shaderValues.getNumber(t.SHADOW_OUTLINE_RANGE);
            },
            set: function (e) {
                this._shaderValues.setNumber(t.SHADOW_OUTLINE_RANGE, e);
            }
        }], [{
            key: "__init__",
            value: function () {
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMap: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMapDirection: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectCubeHDRParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeProbePosition: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMax: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMin: Laya.Shader3D.PERIOD_SPRITE,
                    u_CameraPos: Laya.Shader3D.PERIOD_CAMERA,
                    u_View: Laya.Shader3D.PERIOD_CAMERA,
                    u_ProjectionParams: Laya.Shader3D.PERIOD_CAMERA,
                    u_Viewport: Laya.Shader3D.PERIOD_CAMERA,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OcclusionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Smoothness: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SmoothnessScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_occlusionStrength: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MetallicGlossTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Metallic: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ShadowColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ShadowPara: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ShadowPlane: Laya.Shader3D.PERIOD_MATERIAL,
                    u_CustomLightDir: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OutlineRange: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OutlineColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AmbientColor: Laya.Shader3D.PERIOD_SCENE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE,
                    u_DirationLightCount: Laya.Shader3D.PERIOD_SCENE,
                    u_LightBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_LightClusterBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowBias: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightDirection: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowParams: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMatrices: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMapSize: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightPosition: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHC: Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.spot": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.color": Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("PBRStandardPlanarShadowOutLine", e, a, !0, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r);
                var o = r.addShaderPass(ea.OutLineVs, ea.OutLinePs);
                o.renderState.cull = Laya.RenderState.CULL_FRONT, o.renderState.depthWrite = !1,
                    r.addShaderPass($e.PBRVS, $e.PBRPS, n, "Forward"), r.addShaderPass(ta.ShadowVs, ta.ShadowPs),
                    Laya.ClassUtils.regClass("TY.PBRStandardPlanarShadowOutLineMaterial", t);
            }
        }]), t;
    }(na);
    ia.SHADOW_OUTLINE_RANGE = Laya.Shader3D.propertyNameToID("u_OutlineRange"), ia.SHADOW_OUTLINE_COLOR = Laya.Shader3D.propertyNameToID("u_OutlineColor");
    var ra = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this))._albedoColor = new Laya.Vector4(1, 1, 1, 1),
                e._enableVertexColor = !1, e.setShaderName(e.ShaderName), e._shaderValues.setVector(t.ALBEDOCOLOR, new Laya.Vector4(1, 1, 1, 1)),
                e.renderMode = t.RENDERMODE_TRANSPARENT, e.cull = 0, e;
        }
        return s(t, [{
            key: "_ColorR",
            get: function () {
                return this._albedoColor.x;
            },
            set: function (e) {
                this._albedoColor.x = e, this.albedoColor = this._albedoColor;
            }
        }, {
            key: "_ColorG",
            get: function () {
                return this._albedoColor.y;
            },
            set: function (e) {
                this._albedoColor.y = e, this.albedoColor = this._albedoColor;
            }
        }, {
            key: "_ColorB",
            get: function () {
                return this._albedoColor.z;
            },
            set: function (e) {
                this._albedoColor.z = e, this.albedoColor = this._albedoColor;
            }
        }, {
            key: "_ColorA",
            get: function () {
                return this._albedoColor.w;
            },
            set: function (e) {
                this._albedoColor.w = e, this.albedoColor = this._albedoColor;
            }
        }, {
            key: "_MainTex_STX",
            get: function () {
                return this._shaderValues.getVector(t.TILINGOFFSET).x;
            },
            set: function (e) {
                var a = this._shaderValues.getVector(t.TILINGOFFSET);
                a.x = e, this.tilingOffset = a;
            }
        }, {
            key: "_MainTex_STY",
            get: function () {
                return this._shaderValues.getVector(t.TILINGOFFSET).y;
            },
            set: function (e) {
                var a = this._shaderValues.getVector(t.TILINGOFFSET);
                a.y = e, this.tilingOffset = a;
            }
        }, {
            key: "_MainTex_STZ",
            get: function () {
                return this._shaderValues.getVector(t.TILINGOFFSET).z;
            },
            set: function (e) {
                var a = this._shaderValues.getVector(t.TILINGOFFSET);
                a.z = e, this.tilingOffset = a;
            }
        }, {
            key: "_MainTex_STW",
            get: function () {
                return this._shaderValues.getVector(t.TILINGOFFSET).w;
            },
            set: function (e) {
                var a = this._shaderValues.getVector(t.TILINGOFFSET);
                a.w = e, this.tilingOffset = a;
            }
        }, {
            key: "_Cutoff",
            get: function () {
                return this.alphaTestValue;
            },
            set: function (e) {
                this.alphaTestValue = e;
            }
        }, {
            key: "albedoColorR",
            get: function () {
                return this._ColorR;
            },
            set: function (e) {
                this._ColorR = e;
            }
        }, {
            key: "albedoColorG",
            get: function () {
                return this._ColorG;
            },
            set: function (e) {
                this._ColorG = e;
            }
        }, {
            key: "albedoColorB",
            get: function () {
                return this._ColorB;
            },
            set: function (e) {
                this._ColorB = e;
            }
        }, {
            key: "albedoColorA",
            get: function () {
                return this._ColorA;
            },
            set: function (e) {
                this._ColorA = e;
            }
        }, {
            key: "albedoColor",
            get: function () {
                return this._albedoColor;
            },
            set: function (e) {
                this._albedoColor = e, this._shaderValues.setVector(t.ALBEDOCOLOR, this._albedoColor);
            }
        }, {
            key: "albedoTexture",
            get: function () {
                return this._shaderValues.getTexture(t.ALBEDOTEXTURE);
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADERDEFINE_ALBEDOTEXTURE) : this._shaderValues.removeDefine(t.SHADERDEFINE_ALBEDOTEXTURE),
                    this._shaderValues.setTexture(t.ALBEDOTEXTURE, e);
            }
        }, {
            key: "tilingOffsetX",
            get: function () {
                return this._MainTex_STX;
            },
            set: function (e) {
                this._MainTex_STX = e;
            }
        }, {
            key: "tilingOffsetY",
            get: function () {
                return this._MainTex_STY;
            },
            set: function (e) {
                this._MainTex_STY = e;
            }
        }, {
            key: "tilingOffsetZ",
            get: function () {
                return this._MainTex_STZ;
            },
            set: function (e) {
                this._MainTex_STZ = e;
            }
        }, {
            key: "tilingOffsetW",
            get: function () {
                return this._MainTex_STW;
            },
            set: function (e) {
                this._MainTex_STW = e;
            }
        }, {
            key: "tilingOffset",
            get: function () {
                return this._shaderValues.getVector(t.TILINGOFFSET);
            },
            set: function (e) {
                !e || 1 == e.x && 1 == e.y && 0 == e.z && 0 == e.w ? this._shaderValues.removeDefine(t.SHADERDEFINE_TILINGOFFSET) : this._shaderValues.addDefine(t.SHADERDEFINE_TILINGOFFSET),
                    this._shaderValues.setVector(t.TILINGOFFSET, e);
            }
        }, {
            key: "enableVertexColor",
            get: function () {
                return this._enableVertexColor;
            },
            set: function (e) {
                this._enableVertexColor = e, e ? this._shaderValues.addDefine(t.SHADERDEFINE_ENABLEVERTEXCOLOR) : this._shaderValues.removeDefine(t.SHADERDEFINE_ENABLEVERTEXCOLOR);
            }
        }, {
            key: "renderMode",
            set: function (e) {
                switch (e) {
                    case t.RENDERMODE_OPAQUE:
                        this.alphaTest = !1, this.renderQueue = Laya.Material.RENDERQUEUE_OPAQUE, this.depthWrite = !0,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_DISABLE,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    case t.RENDERMODE_CUTOUT:
                        this.renderQueue = Laya.Material.RENDERQUEUE_ALPHATEST, this.alphaTest = !0, this.depthWrite = !0,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_DISABLE,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    case t.RENDERMODE_TRANSPARENT:
                        this.renderQueue = Laya.Material.RENDERQUEUE_TRANSPARENT, this.alphaTest = !1, this.depthWrite = !1,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_ENABLE_ALL,
                            this.blendSrc = Laya.RenderState.BLENDPARAM_SRC_ALPHA, this.blendDst = Laya.RenderState.BLENDPARAM_ONE_MINUS_SRC_ALPHA,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    default:
                        throw new Error("UnlitMaterial : renderMode value error.");
                }
            }
        }, {
            key: "ShaderName",
            get: function () {
                return "SpriteRender";
            }
        }, {
            key: "clone",
            value: function () {
                var e = new t();
                return this.cloneTo(e), e;
            }
        }], [{
            key: "__initDefine__",
            value: function () {
                t.SHADERDEFINE_ALBEDOTEXTURE = Laya.Shader3D.getDefineByName("ALBEDOTEXTURE"), t.SHADERDEFINE_TILINGOFFSET = Laya.Shader3D.getDefineByName("TILINGOFFSET"),
                    t.SHADERDEFINE_ENABLEVERTEXCOLOR = Laya.Shader3D.getDefineByName("ENABLEVERTEXCOLOR");
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_InstanceColor: Laya.VertexMesh.MESH_CUSTOME0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR,
                    a_Color: Laya.VertexMesh.MESH_COLOR0
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("SpriteRender", null, null, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r), r.addShaderPass('#if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n#else\n    precision mediump float;\n#endif\n#include "Lighting.glsl";\n\nattribute vec4 a_Position;\n\nattribute vec2 a_Texcoord0;\n\n#ifdef GPU_INSTANCE\n    uniform mat4 u_ViewProjection;\n    attribute mat4 a_WorldMat;\n#else\n    uniform mat4 u_MvpMatrix;\n#endif\n\nattribute vec4 a_Color;\n\nvarying vec4 v_Color;\nvarying vec2 v_Texcoord0;\n\nuniform vec4 u_TilingOffset;\n\n#ifdef BONE\nconst int c_MaxBoneCount = 24;\nattribute vec4 a_BoneIndices;\nattribute vec4 a_BoneWeights;\nuniform mat4 u_Bones[c_MaxBoneCount];\n#endif\n\nvoid main() {\n    vec4 position;\n    #ifdef BONE\n        mat4 skinTransform;\n        #ifdef SIMPLEBONE\n            float currentPixelPos;\n            #ifdef GPU_INSTANCE\n                currentPixelPos = a_SimpleTextureParams.x+a_SimpleTextureParams.y;\n            #else\n                currentPixelPos = u_SimpleAnimatorParams.x+u_SimpleAnimatorParams.y;\n            #endif\n                float offset = 1.0/u_SimpleAnimatorTextureSize;\n                skinTransform =  loadMatFromTexture(currentPixelPos, int(a_BoneIndices.x), offset) * a_BoneWeights.x;\n                skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.y), offset) * a_BoneWeights.y;\n                skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.z), offset) * a_BoneWeights.z;\n                skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.w), offset) * a_BoneWeights.w;\n            #else\n            skinTransform =  u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n            skinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n            skinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n            skinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n        #endif\n        position=skinTransform*a_Position;\n    #else\n        position=a_Position;\n    #endif\n    #ifdef GPU_INSTANCE\n            gl_Position = u_ViewProjection * a_WorldMat * position;\n    #else\n            gl_Position = u_MvpMatrix * position;\n    #endif\n    v_Texcoord0=a_Texcoord0;\n    \n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n    v_Color = a_Color;\n    #endif\n    gl_Position=remapGLPositionZ(gl_Position);\n}', "#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\n#if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\nvarying vec4 v_Color;\n#endif\n\n#ifdef ALBEDOTEXTURE\nuniform sampler2D u_AlbedoTexture;\nvarying vec2 v_Texcoord0;\n#endif\n\nuniform vec4 u_AlbedoColor;\n\n#ifdef ALPHATEST\nuniform float u_AlphaTestValue;\n#endif\n\n#ifdef FOG\nuniform float u_FogStart;\nuniform float u_FogRange;\n#ifdef ADDTIVEFOG\n#else\nuniform vec3 u_FogColor;\n#endif\n#endif\n\nvoid main()\n{\n    vec4 color =  u_AlbedoColor;\n    #ifdef ALBEDOTEXTURE\n    color *= texture2D(u_AlbedoTexture, v_Texcoord0);\n    #endif\n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n    color *= v_Color;\n    #endif\n    \n   \n    \n    #ifdef ALPHATEST\n    if (color.a < u_AlphaTestValue)\n    discard;\n    #endif\n\n    gl_FragColor = color;\n\n    #ifdef FOG\n        float lerpFact = clamp((1.0 / gl_FragCoord.w - u_FogStart) / u_FogRange, 0.0, 1.0);\n        #ifdef ADDTIVEFOG\n            gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.0), lerpFact);\n        #else\n            gl_FragColor.rgb = mix(gl_FragColor.rgb, u_FogColor, lerpFact);\n        #endif\n    #endif\n}", n),
                    Laya.ClassUtils.regClass("TY.SpriteMaterial", t);
            }
        }]), t;
    }(Laya.Material);
    ra.RENDERMODE_OPAQUE = 0, ra.RENDERMODE_CUTOUT = 1, ra.RENDERMODE_TRANSPARENT = 2,
        ra.RENDERMODE_ADDTIVE = 3, ra.ALBEDOTEXTURE = Laya.Shader3D.propertyNameToID("u_AlbedoTexture"),
        ra.ALBEDOCOLOR = Laya.Shader3D.propertyNameToID("u_AlbedoColor"), ra.TILINGOFFSET = Laya.Shader3D.propertyNameToID("u_TilingOffset");
    var oa = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.apply(this, arguments))._MainTex_TexelSize = new Laya.Vector4(),
                e._MaskTex_TexelSize = new Laya.Vector4(), e;
        }
        return s(t, [{
            key: "albedoTexture",
            set: function (e) {
                e ? (this._MainTex_TexelSize.setValue(1 / e.width, 1 / e.height, e.width, e.height),
                    this._shaderValues.setVector(t.MAIN_TEXELSIZE, this._MainTex_TexelSize), this._shaderValues.addDefine(t.SHADERDEFINE_ALBEDOTEXTURE)) : this._shaderValues.removeDefine(t.SHADERDEFINE_ALBEDOTEXTURE),
                    this._shaderValues.setTexture(t.ALBEDOTEXTURE, e);
            }
        }, {
            key: "maskTexture",
            get: function () {
                return this._shaderValues.getTexture(t.MASK_TEXTURE);
            },
            set: function (e) {
                e ? (this._MaskTex_TexelSize.setValue(1 / e.width, 1 / e.height, e.width, e.height),
                    this._shaderValues.setVector(t.MASK_TEXELSIZE, this._MaskTex_TexelSize), this._shaderValues.addDefine(t.SHADERDEFINE_MASKTEXTURE)) : this._shaderValues.removeDefine(t.SHADERDEFINE_MASKTEXTURE),
                    this._shaderValues.setTexture(t.MASK_TEXTURE, e);
            }
        }, {
            key: "offsetX",
            get: function () {
                return this._offsetX;
            },
            set: function (e) {
                this._offsetX = e, this._shaderValues.setNumber(t.OFFSET_X, this._offsetX);
            }
        }, {
            key: "offsetY",
            get: function () {
                return this._offsetY;
            },
            set: function (e) {
                this._offsetY = e, this._shaderValues.setNumber(t.OFFSET_Y, this._offsetY);
            }
        }, {
            key: "maskScale",
            get: function () {
                return this._maskScale;
            },
            set: function (e) {
                this._maskScale = e, this._shaderValues.setNumber(t.MASK_SCALE, this._maskScale);
            }
        }, {
            key: "renderMode",
            set: function (e) {
                switch (e) {
                    case t.RENDERMODE_OPAQUE:
                        this.alphaTest = !1, this.renderQueue = Laya.Material.RENDERQUEUE_OPAQUE, this.depthWrite = !0,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_DISABLE,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    case t.RENDERMODE_CUTOUT:
                        this.renderQueue = Laya.Material.RENDERQUEUE_ALPHATEST, this.alphaTest = !0, this.depthWrite = !0,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_DISABLE,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    case t.RENDERMODE_TRANSPARENT:
                        this.renderQueue = Laya.Material.RENDERQUEUE_TRANSPARENT, this.alphaTest = !1, this.depthWrite = !1,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_ENABLE_ALL,
                            this.blendSrc = Laya.RenderState.BLENDPARAM_SRC_ALPHA, this.blendDst = Laya.RenderState.BLENDPARAM_ONE_MINUS_SRC_ALPHA,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    default:
                        throw new Error("UnlitMaterial : renderMode value error.");
                }
            }
        }, {
            key: "ShaderName",
            get: function () {
                return "SpriteMask";
            }
        }, {
            key: "clone",
            value: function () {
                var e = new t();
                return this.cloneTo(e), e;
            }
        }], [{
            key: "__initDefine__",
            value: function () {
                t.SHADERDEFINE_ALBEDOTEXTURE = Laya.Shader3D.getDefineByName("ALBEDOTEXTURE"), t.SHADERDEFINE_TILINGOFFSET = Laya.Shader3D.getDefineByName("TILINGOFFSET"),
                    t.SHADERDEFINE_ENABLEVERTEXCOLOR = Laya.Shader3D.getDefineByName("ENABLEVERTEXCOLOR"),
                    t.SHADERDEFINE_MASKTEXTURE = Laya.Shader3D.getDefineByName("MASKTEXTURE");
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_InstanceColor: Laya.VertexMesh.MESH_CUSTOME0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR,
                    a_Color: Laya.VertexMesh.MESH_COLOR0
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_OffsetX: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MaskScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OffsetY: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MaskTex: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MainTex_TexelSize: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MaskTex_TexelSize: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("SpriteMask", null, null, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r), r.addShaderPass('\n#if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n#else\n    precision mediump float;\n#endif\n#include "Lighting.glsl";\n\nattribute vec4 a_Position;\n\nattribute vec2 a_Texcoord0;\n\n#ifdef GPU_INSTANCE\n    uniform mat4 u_ViewProjection;\n    attribute mat4 a_WorldMat;\n#else\n    uniform mat4 u_MvpMatrix;\n#endif\n\nattribute vec4 a_Color;\n\nvarying vec4 v_Color;\nvarying vec2 v_Texcoord0;\n\nuniform vec4 u_TilingOffset;\n\n#ifdef BONE\n    const int c_MaxBoneCount = 24;\n    attribute vec4 a_BoneIndices;\n    attribute vec4 a_BoneWeights;\n    uniform mat4 u_Bones[c_MaxBoneCount];\n#endif\n\n#ifdef MASKTEXTURE\n    uniform vec4 u_MaskTex_TexelSize;\n    uniform vec4 u_MainTex_TexelSize;\n    varying vec2 texRatio;\n#endif\n\nvoid main() {\n    vec4 position;\n    #ifdef BONE\n    mat4 skinTransform;\n    #ifdef SIMPLEBONE\n    float currentPixelPos;\n    #ifdef GPU_INSTANCE\n    currentPixelPos = a_SimpleTextureParams.x+a_SimpleTextureParams.y;\n    #else\n    currentPixelPos = u_SimpleAnimatorParams.x+u_SimpleAnimatorParams.y;\n    #endif\n    float offset = 1.0/u_SimpleAnimatorTextureSize;\n    skinTransform =  loadMatFromTexture(currentPixelPos, int(a_BoneIndices.x), offset) * a_BoneWeights.x;\n    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.y), offset) * a_BoneWeights.y;\n    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.z), offset) * a_BoneWeights.z;\n    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.w), offset) * a_BoneWeights.w;\n    #else\n    skinTransform =  u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n    skinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n    skinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n    skinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n    #endif\n    position=skinTransform*a_Position;\n    #else\n    position=a_Position;\n    #endif\n    #ifdef GPU_INSTANCE\n    gl_Position = u_ViewProjection * a_WorldMat * position;\n    #else\n    gl_Position = u_MvpMatrix * position;\n    #endif\n    v_Texcoord0=a_Texcoord0;\n    \n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n    v_Color = a_Color;\n    #endif\n    gl_Position=remapGLPositionZ(gl_Position);\n    #ifdef MASKTEXTURE\n    texRatio = (u_MaskTex_TexelSize.xy / u_MainTex_TexelSize.xy);\n    #endif\n\n}', "#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\n#if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\nvarying vec4 v_Color;\n#endif\n\n#ifdef ALBEDOTEXTURE\nuniform sampler2D u_AlbedoTexture;\nvarying vec2 v_Texcoord0;\n#endif\n\n#ifdef MASKTEXTURE\nuniform sampler2D u_MaskTex;\nvarying vec2 texRatio;\n//uniform vec4 u_MainTex_TexelSize;\n//uniform vec4 u_MaskTex_TexelSize;\nuniform vec4 u_MaskTex_TexelSize;\nuniform vec4 u_MainTex_TexelSize;\nuniform float u_OffsetX;\nuniform float u_OffsetY;\nuniform float u_MaskScale;\n#endif\n\nuniform vec4 u_AlbedoColor;\n\n#ifdef ALPHATEST\nuniform float u_AlphaTestValue;\n#endif\n\n#ifdef FOG\nuniform float u_FogStart;\nuniform float u_FogRange;\n#ifdef ADDTIVEFOG\n#else\nuniform vec3 u_FogColor;\n#endif\n#endif\n\nvoid main()\n{\n    vec4 color =  u_AlbedoColor;\n    #ifdef ALBEDOTEXTURE\n    color *= texture2D(u_AlbedoTexture, v_Texcoord0);\n    #endif\n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n    color *= v_Color;\n    #endif\n\n    #ifdef MASKTEXTURE\n    vec2 uv2 = (v_Texcoord0  + vec2(-0.5, -0.5))* texRatio*u_MaskScale;\n    uv2.y = uv2.y;\n    //    vec2 vv = (u_MaskTex_TexelSize.xy /u_MainTex_TexelSize.xy);\n    uv2.x = u_OffsetX + uv2.x;\n    uv2.y = 1.0 - u_OffsetY + uv2.y;\n    //    uv2.x += 0.5;\n    //    uv2.y += 0.5;\n    vec4 maskCol = texture2D(u_MaskTex, uv2);\n\n    color.a -= maskCol.r;\n    #endif\n\n\n    #ifdef ALPHATEST\n    if (color.a < u_AlphaTestValue)\n    discard;\n    #endif\n\n    gl_FragColor = color;\n\n    #ifdef FOG\n    float lerpFact = clamp((1.0 / gl_FragCoord.w - u_FogStart) / u_FogRange, 0.0, 1.0);\n    #ifdef ADDTIVEFOG\n    gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.0), lerpFact);\n    #else\n    gl_FragColor.rgb = mix(gl_FragColor.rgb, u_FogColor, lerpFact);\n    #endif\n    #endif\n}", n),
                    Laya.ClassUtils.regClass("TY.SpriteMaskMaterial", t);
            }
        }]), t;
    }(ra);
    oa.OFFSET_X = Laya.Shader3D.propertyNameToID("u_OffsetX"), oa.OFFSET_Y = Laya.Shader3D.propertyNameToID("u_OffsetY"),
        oa.MASK_TEXTURE = Laya.Shader3D.propertyNameToID("u_MaskTex"), oa.MAIN_TEXELSIZE = Laya.Shader3D.propertyNameToID("u_MainTex_TexelSize"),
        oa.MASK_TEXELSIZE = Laya.Shader3D.propertyNameToID("u_MaskTex_TexelSize"), oa.MASK_SCALE = Laya.Shader3D.propertyNameToID("u_MaskScale");
    var sa = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.apply(this, arguments))._distance = 1, e._lineColor = new Laya.Vector4(1, 1, 1, 1),
                e;
        }
        return s(t, [{
            key: "lineColor",
            get: function () {
                return this._lineColor;
            },
            set: function (e) {
                this._lineColor = e, this._shaderValues.setVector(t.LINECOLOR, this._lineColor);
            }
        }, {
            key: "distance",
            get: function () {
                return this._distance;
            },
            set: function (e) {
                this._distance = e, this._shaderValues.setNumber(t.DISTANCE, this._distance);
            }
        }, {
            key: "albedoTexture",
            set: function (e) {
                e ? (this._shaderValues.addDefine(t.SHADERDEFINE_ALBEDOTEXTURE), this._shaderValues.setVector(t.ALBEDOTEXTURETEXELSIZE, new Laya.Vector4(1 / e.width, 1 / e.height, e.width, e.height))) : this._shaderValues.removeDefine(t.SHADERDEFINE_ALBEDOTEXTURE),
                    this._shaderValues.setTexture(t.ALBEDOTEXTURE, e);
            }
        }, {
            key: "tilingOffset",
            set: function (e) {
                this._shaderValues.addDefine(t.SHADERDEFINE_TILINGOFFSET), this._shaderValues.setVector(t.TILINGOFFSET, e),
                    console.log("---------tilingOffset-----------");
            }
        }, {
            key: "renderMode",
            set: function (e) {
                switch (e) {
                    case t.RENDERMODE_OPAQUE:
                        this.alphaTest = !1, this.renderQueue = Laya.Material.RENDERQUEUE_OPAQUE, this.depthWrite = !0,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_DISABLE,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    case t.RENDERMODE_CUTOUT:
                        this.renderQueue = Laya.Material.RENDERQUEUE_ALPHATEST, this.alphaTest = !0, this.depthWrite = !0,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_DISABLE,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    case t.RENDERMODE_TRANSPARENT:
                        this.renderQueue = Laya.Material.RENDERQUEUE_TRANSPARENT, this.alphaTest = !1, this.depthWrite = !1,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_ENABLE_ALL,
                            this.blendSrc = Laya.RenderState.BLENDPARAM_SRC_ALPHA, this.blendDst = Laya.RenderState.BLENDPARAM_ONE_MINUS_SRC_ALPHA,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    default:
                        throw new Error("UnlitMaterial : renderMode value error.");
                }
            }
        }, {
            key: "ShaderName",
            get: function () {
                return "SpriteOutline";
            }
        }, {
            key: "clone",
            value: function () {
                var e = new t();
                return this.cloneTo(e), e;
            }
        }], [{
            key: "__initDefine__",
            value: function () {
                t.SHADERDEFINE_ALBEDOTEXTURE = Laya.Shader3D.getDefineByName("ALBEDOTEXTURE"), t.SHADERDEFINE_TILINGOFFSET = Laya.Shader3D.getDefineByName("TILINGOFFSET"),
                    t.SHADERDEFINE_ENABLEVERTEXCOLOR = Laya.Shader3D.getDefineByName("ENABLEVERTEXCOLOR");
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_InstanceColor: Laya.VertexMesh.MESH_CUSTOME0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR,
                    a_Color: Laya.VertexMesh.MESH_COLOR0
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_LineColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Distance: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture_TexelSize: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("SpriteOutline", null, null, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r), r.addShaderPass('#include "Lighting.glsl";\n\nattribute vec4 a_Position;\n\nattribute vec2 a_Texcoord0;\n\n#ifdef GPU_INSTANCE\nattribute mat4 a_MvpMatrix;\n#else\nuniform mat4 u_MvpMatrix;\n#endif\n\nattribute vec4 a_Color;\n\nvarying vec4 v_Color;\nvarying vec2 v_Texcoord0;\n\nuniform vec4 u_TilingOffset;\n\n#ifdef BONE\nconst int c_MaxBoneCount = 24;\nattribute vec4 a_BoneIndices;\nattribute vec4 a_BoneWeights;\nuniform mat4 u_Bones[c_MaxBoneCount];\n#endif\n\nvoid main() {\n    vec4 position;\n    #ifdef BONE\n    mat4 skinTransform;\n    #ifdef SIMPLEBONE\n    float currentPixelPos;\n    #ifdef GPU_INSTANCE\n    currentPixelPos = a_SimpleTextureParams.x+a_SimpleTextureParams.y;\n    #else\n    currentPixelPos = u_SimpleAnimatorParams.x+u_SimpleAnimatorParams.y;\n    #endif\n    float offset = 1.0/u_SimpleAnimatorTextureSize;\n    skinTransform =  loadMatFromTexture(currentPixelPos, int(a_BoneIndices.x), offset) * a_BoneWeights.x;\n    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.y), offset) * a_BoneWeights.y;\n    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.z), offset) * a_BoneWeights.z;\n    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.w), offset) * a_BoneWeights.w;\n    #else\n    skinTransform =  u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n    skinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n    skinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n    skinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n    #endif\n    position=skinTransform*a_Position;\n    #else\n    position=a_Position;\n    #endif\n\n    #ifdef GPU_INSTANCE\n    gl_Position = u_ViewProjection * a_WorldMat * position;\n    #else\n    gl_Position = u_MvpMatrix * position;\n    #endif\n    v_Texcoord0=a_Texcoord0;\n    \n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n    v_Color = a_Color;\n    #endif\n    gl_Position=remapGLPositionZ(gl_Position);\n}', "#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n\nuniform float u_Distance;\nuniform vec4 u_LineColor;\nuniform vec4 u_AlbedoTexture_TexelSize;\n\n#if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\nvarying vec4 v_Color;\n#endif\n\n#ifdef ALBEDOTEXTURE\nuniform sampler2D u_AlbedoTexture;\nvarying vec2 v_Texcoord0;\n#endif\n\nuniform vec4 u_AlbedoColor;\n\n#ifdef ALPHATEST\nuniform float u_AlphaTestValue;\n#endif\n\n#ifdef FOG\nuniform float u_FogStart;\nuniform float u_FogRange;\n#ifdef ADDTIVEFOG\n#else\nuniform vec3 u_FogColor;\n#endif\n#endif\n\nvoid main()\n{\n    vec4 color =  u_AlbedoColor;\n    #ifdef ALBEDOTEXTURE\n    color *= texture2D(u_AlbedoTexture, v_Texcoord0);\n    #endif\n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n    color *= v_Color;\n    #endif\n    //#ifdef TILINGOFFSET\n    //    color = vec4(1,0,0,1);\n    //#endif\n    //vec4 retColor = vec4(u_TilingOffset.x,u_TilingOffset.y,u_TilingOffset.z,u_TilingOffset.w);\n    vec4 retColor;\n    float d = max(u_AlbedoTexture_TexelSize.x, u_AlbedoTexture_TexelSize.y);\n    d *= u_Distance;\n    float a1 = texture2D(u_AlbedoTexture, v_Texcoord0 + d *vec2(-1.0, -1.0)).a;\n    float a2 = texture2D(u_AlbedoTexture, v_Texcoord0 + d *vec2(0.0, -1.0)).a;\n    float a3 = texture2D(u_AlbedoTexture, v_Texcoord0 + d *vec2(1.0, -1.0)).a;\n\n    float a4 = texture2D(u_AlbedoTexture, v_Texcoord0 + d *vec2(-1.0, 0.0)).a;\n    float a6 = texture2D(u_AlbedoTexture, v_Texcoord0 + d *vec2(1.0, 0.0)).a;\n\n    float a7 = texture2D(u_AlbedoTexture, v_Texcoord0 + d *vec2(-1.0, 1.0)).a;\n    float a8 = texture2D(u_AlbedoTexture, v_Texcoord0 + d *vec2(-0.0, 1.0)).a;\n    float a9 = texture2D(u_AlbedoTexture, v_Texcoord0 + d *vec2(1.0, 1.0)).a;\n    //\n    float gx = -a1 - a2*2.0 - a3 + a7 + a8*2.0 + a9;\n    float gy = - a1 - a4*2.0 - a7 + a3 + a6*2.0 + a9;\n\n    float w = sqrt(gx * gx + gy * gy) * 0.25;\n    //\n    retColor.xyz = u_LineColor.xyz - color.xyz;\n    retColor.xyz = vec3(w, w, w) * retColor.xyz + color.xyz;\n    retColor.w = color.w;\n\n    #ifdef ALPHATEST\n    if (retColor.a < u_AlphaTestValue)\n    discard;\n    #endif\n\n    gl_FragColor = retColor;\n\n    #ifdef FOG\n    float lerpFact = clamp((1.0 / gl_FragCoord.w - u_FogStart) / u_FogRange, 0.0, 1.0);\n    #ifdef ADDTIVEFOG\n    gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.0), lerpFact);\n    #else\n    gl_FragColor.rgb = mix(gl_FragColor.rgb, u_FogColor, lerpFact);\n    #endif\n    #endif\n}", n),
                    Laya.ClassUtils.regClass("TY.SpriteOutlineMaterial", t);
            }
        }]), t;
    }(ra);
    sa.ALBEDOCOLOR = Laya.Shader3D.propertyNameToID("u_AlbedoColor"), sa.LINECOLOR = Laya.Shader3D.propertyNameToID("u_LineColor"),
        sa.DISTANCE = Laya.Shader3D.propertyNameToID("u_Distance"), sa.TILINGOFFSET = Laya.Shader3D.propertyNameToID("u_TilingOffset"),
        sa.ALBEDOTEXTURETEXELSIZE = Laya.Shader3D.propertyNameToID("u_AlbedoTexture_TexelSize");
    var la = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.apply(this, arguments))._shadowColor = new Laya.Vector4(1, 1, 1, 1),
                e._offsetX = .01, e._offsetY = .01, e;
        }
        return s(t, [{
            key: "shadowColor",
            get: function () {
                return this._shadowColor;
            },
            set: function (e) {
                this._shadowColor = e, this._shaderValues.setVector(t.SHADOWCOLOR, this._shadowColor);
            }
        }, {
            key: "shadowTexture",
            get: function () {
                return this._shaderValues.getTexture(t.SHADOWTEXTURE);
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADERDEFINE_SHADOWTEXTURE) : this._shaderValues.removeDefine(t.SHADERDEFINE_SHADOWTEXTURE),
                    this._shaderValues.setTexture(t.SHADOWTEXTURE, e);
            }
        }, {
            key: "offsetX",
            get: function () {
                return this._offsetX;
            },
            set: function (e) {
                this._offsetX = e, this._shaderValues.setNumber(t.OFFSETX, this._offsetX);
            }
        }, {
            key: "offsetY",
            get: function () {
                return this._offsetY;
            },
            set: function (e) {
                this._offsetY = e, this._shaderValues.setNumber(t.OFFSETY, this._offsetY);
            }
        }, {
            key: "albedoTexture",
            get: function () {
                return this._shaderValues.getTexture(t.ALBEDOTEXTURE);
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADERDEFINE_ALBEDOTEXTURE) : this._shaderValues.removeDefine(t.SHADERDEFINE_ALBEDOTEXTURE),
                    this._shaderValues.setTexture(t.ALBEDOTEXTURE, e);
            }
        }, {
            key: "tilingOffset",
            get: function () {
                return this._shaderValues.getVector(t.TILINGOFFSET);
            },
            set: function (e) {
                !e || 1 == e.x && 1 == e.y && 0 == e.z && 0 == e.w ? this._shaderValues.removeDefine(t.SHADERDEFINE_TILINGOFFSET) : this._shaderValues.addDefine(t.SHADERDEFINE_TILINGOFFSET),
                    this._shaderValues.setVector(t.TILINGOFFSET, e);
            }
        }, {
            key: "enableVertexColor",
            set: function (e) {
                this._enableVertexColor = e, e ? this._shaderValues.addDefine(t.SHADERDEFINE_ENABLEVERTEXCOLOR) : this._shaderValues.removeDefine(t.SHADERDEFINE_ENABLEVERTEXCOLOR);
            }
        }, {
            key: "renderMode",
            set: function (e) {
                switch (e) {
                    case t.RENDERMODE_OPAQUE:
                        this.alphaTest = !1, this.renderQueue = Laya.Material.RENDERQUEUE_OPAQUE, this.depthWrite = !0,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_DISABLE,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    case t.RENDERMODE_CUTOUT:
                        this.renderQueue = Laya.Material.RENDERQUEUE_ALPHATEST, this.alphaTest = !0, this.depthWrite = !0,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_DISABLE,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    case t.RENDERMODE_TRANSPARENT:
                        this.renderQueue = Laya.Material.RENDERQUEUE_TRANSPARENT, this.alphaTest = !1, this.depthWrite = !1,
                            this.cull = Laya.RenderState.CULL_BACK, this.blend = Laya.RenderState.BLEND_ENABLE_ALL,
                            this.blendSrc = Laya.RenderState.BLENDPARAM_SRC_ALPHA, this.blendDst = Laya.RenderState.BLENDPARAM_ONE_MINUS_SRC_ALPHA,
                            this.depthTest = Laya.RenderState.DEPTHTEST_LESS;
                        break;

                    default:
                        throw new Error("UnlitMaterial : renderMode value error.");
                }
            }
        }, {
            key: "ShaderName",
            get: function () {
                return "SpriteShadow";
            }
        }, {
            key: "clone",
            value: function () {
                var e = new t();
                return this.cloneTo(e), e;
            }
        }], [{
            key: "__initDefine__",
            value: function () {
                t.SHADERDEFINE_ALBEDOTEXTURE = Laya.Shader3D.getDefineByName("ALBEDOTEXTURE"), t.SHADERDEFINE_SHADOWTEXTURE = Laya.Shader3D.getDefineByName("SHADOWTEXTURE"),
                    t.SHADERDEFINE_TILINGOFFSET = Laya.Shader3D.getDefineByName("TILINGOFFSET"), t.SHADERDEFINE_ENABLEVERTEXCOLOR = Laya.Shader3D.getDefineByName("ENABLEVERTEXCOLOR");
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_InstanceColor: Laya.VertexMesh.MESH_CUSTOME0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR,
                    a_Color: Laya.VertexMesh.MESH_COLOR0
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_OffsetX: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OffsetY: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ShadowTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ShadowColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("SpriteShadow", null, null, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r), r.addShaderPass('#include "Lighting.glsl";\n\nattribute vec4 a_Position;\n\nattribute vec2 a_Texcoord0;\n\n#ifdef GPU_INSTANCE\nuniform mat4 u_ViewProjection;\nattribute mat4 a_WorldMat;\n#else\nuniform mat4 u_MvpMatrix;\n#endif\n\nattribute vec4 a_Color;\n\nvarying vec4 v_Color;\nvarying vec2 v_Texcoord0;\n\nuniform vec4 u_TilingOffset;\n\n//x偏移\nuniform float u_OffsetX;\n//y偏移\nuniform float u_OffsetY;\n\n#ifdef BONE\nconst int c_MaxBoneCount = 24;\nattribute vec4 a_BoneIndices;\nattribute vec4 a_BoneWeights;\nuniform mat4 u_Bones[c_MaxBoneCount];\n#endif\n\nvoid main() {\n    vec4 position;\n    #ifdef BONE\n    mat4 skinTransform;\n    #ifdef SIMPLEBONE\n        float currentPixelPos;\n        #ifdef GPU_INSTANCE\n            currentPixelPos = a_SimpleTextureParams.x+a_SimpleTextureParams.y;\n        #else\n            currentPixelPos = u_SimpleAnimatorParams.x+u_SimpleAnimatorParams.y;\n        #endif\n    float offset = 1.0/u_SimpleAnimatorTextureSize;\n        skinTransform =  loadMatFromTexture(currentPixelPos, int(a_BoneIndices.x), offset) * a_BoneWeights.x;\n        skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.y), offset) * a_BoneWeights.y;\n        skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.z), offset) * a_BoneWeights.z;\n        skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.w), offset) * a_BoneWeights.w;\n    #else\n        skinTransform =  u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n        skinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n        skinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n        skinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n    #endif\n        position=skinTransform*a_Position;\n    #else\n    position=a_Position;\n    \n    position.x += u_OffsetX;\n    position.y += u_OffsetY;\n\n    #ifdef GPU_INSTANCE\n    gl_Position =u_ViewProjection * a_WorldMat * position;\n    #else\n    gl_Position = u_MvpMatrix * position;\n    #endif\n\n    v_Texcoord0=TransformUV(a_Texcoord0, u_TilingOffset);\n    \n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n    v_Color = a_Color;\n    #endif\n    gl_Position=remapGLPositionZ(gl_Position);\n}\n', "\n    #ifdef GL_FRAGMENT_PRECISION_HIGH\n    precision highp float;\n    #else\n    precision mediump float;\n    #endif\n\n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n    varying vec4 v_Color;\n    #endif\n\n    #ifdef SHADOWTEXTURE\n    uniform sampler2D u_ShadowTexture;\n    varying vec2 v_Texcoord0;\n    #endif\n\n\n    uniform vec4 u_ShadowColor;\n\n    #ifdef ALPHATEST\n    uniform float u_AlphaTestValue;\n    #endif\n\n    #ifdef FOG\n    uniform float u_FogStart;\n    uniform float u_FogRange;\n    #ifdef ADDTIVEFOG\n    #else\n    uniform vec3 u_FogColor;\n    #endif\n    #endif\n\n    void main()\n    {\n        vec4 color =  u_ShadowColor;\n        #ifdef SHADOWTEXTURE\n        color *= texture2D(u_ShadowTexture, v_Texcoord0);\n        #endif\n        \n        #ifdef ALPHATEST\n        if (color.a < u_AlphaTestValue)\n        discard;\n        #endif\n\n        gl_FragColor = color;\n\n        #ifdef FOG\n            float lerpFact = clamp((1.0 / gl_FragCoord.w - u_FogStart) / u_FogRange, 0.0, 1.0);\n            #ifdef ADDTIVEFOG\n                gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.0), lerpFact);\n            #else\n                gl_FragColor.rgb = mix(gl_FragColor.rgb, u_FogColor, lerpFact);\n            #endif\n        #endif\n    }\n", n),
                    r.addShaderPass('\n    #include "Lighting.glsl";\n\n    attribute vec4 a_Position;\n\n    attribute vec2 a_Texcoord0;\n\n    #ifdef GPU_INSTANCE\n    attribute mat4 a_MvpMatrix;\n    #else\n    uniform mat4 u_MvpMatrix;\n    #endif\n\n    attribute vec4 a_Color;\n\n    varying vec4 v_Color;\n    varying vec2 v_Texcoord0;\n\n    #ifdef TILINGOFFSET\n    uniform vec4 u_TilingOffset;\n    #endif\n\n    #ifdef BONE\n    const int c_MaxBoneCount = 24;\n    attribute vec4 a_BoneIndices;\n    attribute vec4 a_BoneWeights;\n    uniform mat4 u_Bones[c_MaxBoneCount];\n    #endif\n\n    void main() {\n        vec4 position;\n        #ifdef BONE\n        mat4 skinTransform = u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n        skinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n        skinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n        skinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n        position=skinTransform*a_Position;\n        #else\n        position=a_Position;\n        #endif\n        #ifdef GPU_INSTANCE\n        gl_Position = a_MvpMatrix * position;\n        #else\n        gl_Position = u_MvpMatrix * position;\n        #endif\n\n        #ifdef TILINGOFFSET\n        v_Texcoord0=TransformUV(a_Texcoord0, u_TilingOffset);\n        #else\n        v_Texcoord0=a_Texcoord0;\n        #endif\n        #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n        v_Color = a_Color;\n        #endif\n        gl_Position=remapGLPositionZ(gl_Position);\n    }\n\n', "\n    #ifdef GL_FRAGMENT_PRECISION_HIGH\n    precision highp float;\n    #else\n    precision mediump float;\n    #endif\n\n    #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n    varying vec4 v_Color;\n    #endif\n\n    varying vec2 v_Texcoord0;\n\n    #ifdef ALBEDOTEXTURE\n    uniform sampler2D u_AlbedoTexture;\n    #endif\n\n    #ifdef SHADOWTEXTURE\n    uniform sampler2D u_ShadowTexture;\n    #endif\n\n    uniform vec4 u_AlbedoColor;\n    uniform vec4 u_ShadowColor;\n\n    #ifdef ALPHATEST\n    uniform float u_AlphaTestValue;\n    #endif\n\n    #ifdef FOG\n    uniform float u_FogStart;\n    uniform float u_FogRange;\n    #ifdef ADDTIVEFOG\n    #else\n    uniform vec3 u_FogColor;\n    #endif\n    #endif\n\n    void main()\n    {\n        vec4 color =  u_AlbedoColor;\n        #ifdef ALBEDOTEXTURE\n        color *= texture2D(u_AlbedoTexture, v_Texcoord0);\n        #endif\n        #if defined(COLOR)&&defined(ENABLEVERTEXCOLOR)\n        color *= v_Color;\n        #endif\n\n\n        #ifdef SHADOWTEXTURE\n        vec4 shadowColor = texture2D(u_ShadowTexture, v_Texcoord0);\n        color.rgb = color.rgb * (color.a - shadowColor.a) + shadowColor.rgb * shadowColor.a;\n        #endif\n\n        #ifdef ALPHATEST\n        if (color.a < u_AlphaTestValue)\n        discard;\n        #endif\n\n        gl_FragColor = color;\n\n        #ifdef FOG\n        float lerpFact = clamp((1.0 / gl_FragCoord.w - u_FogStart) / u_FogRange, 0.0, 1.0);\n        #ifdef ADDTIVEFOG\n        gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.0), lerpFact);\n        #else\n        gl_FragColor.rgb = mix(gl_FragColor.rgb, u_FogColor, lerpFact);\n        #endif\n        #endif\n    }\n", n),
                    Laya.ClassUtils.regClass("TY.SpriteShadowMaterial", t);
            }
        }]), t;
    }(ra);
    la.SHADOWTEXTURE = Laya.Shader3D.propertyNameToID("u_ShadowTexture"), la.SHADOWCOLOR = Laya.Shader3D.propertyNameToID("u_ShadowColor"),
        la.OFFSETX = Laya.Shader3D.propertyNameToID("u_OffsetX"), la.OFFSETY = Laya.Shader3D.propertyNameToID("u_OffsetY");
    var ua = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this))._offRealTimeLight = !1, e.setShaderName("TYPBRSpecular"),
                e;
        }
        return s(t, [{
            key: "clone",
            value: function () {
                var e = new t();
                return e.offRealTimeLight = this.offRealTimeLight, this.cloneTo(e), e;
            }
        }, {
            key: "offRealTimeLight",
            get: function () {
                return this._offRealTimeLight;
            },
            set: function (e) {
                this._offRealTimeLight = e, e ? this._shaderValues.addDefine(t.SHADER_DEFINE_OFF_REAL_TIME_LIGHT) : this._shaderValues.removeDefine(t.SHADER_DEFINE_OFF_REAL_TIME_LIGHT);
            }
        }], [{
            key: "__init__",
            value: function () {
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_InstanceColor: Laya.VertexMesh.MESH_CUSTOME0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMap: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMapDirection: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectCubeHDRParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeProbePosition: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMax: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMin: Laya.Shader3D.PERIOD_SPRITE,
                    u_CameraPos: Laya.Shader3D.PERIOD_CAMERA,
                    u_View: Laya.Shader3D.PERIOD_CAMERA,
                    u_ProjectionParams: Laya.Shader3D.PERIOD_CAMERA,
                    u_Viewport: Laya.Shader3D.PERIOD_CAMERA,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OcclusionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Smoothness: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SmoothnessScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_occlusionStrength: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SpecGlossTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SpecularColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AmbientColor: Laya.Shader3D.PERIOD_SCENE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE,
                    u_DirationLightCount: Laya.Shader3D.PERIOD_SCENE,
                    u_LightBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_LightClusterBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowBias: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightDirection: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowParams: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMatrices: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMapSize: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightPosition: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHC: Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.spot": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.color": Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("TYPBRSpecular", e, a, !0, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r), r.addShaderPass($e.PBRVS, $e.PBRPS, n, "Forward"), r.addShaderPass('\n    #include "ShadowCasterVS.glsl"\n    \n    void main()\n    {\n        vec4 positionCS =  shadowCasterVertex();\n        gl_Position=remapGLPositionZ(positionCS);\n    }\n', '\n#if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\n    precision highp float;\n    precision highp int;\n#else\n    precision mediump float;\n    precision mediump int;\n#endif\n\n#include "ShadowCasterFS.glsl"\n\nvoid main()\n{\n    gl_FragColor=shadowCasterFragment();\n}\n', n, "ShadowCaster"),
                    r.addShaderPass(We.DepthNormalsVS, We.DepthNormalsPS, n, "DepthNormal"), Laya.ClassUtils.regClass("TY.TYPBRSpecularMaterial", t);
            }
        }]), t;
    }(Laya.PBRSpecularMaterial);
    ua.SHADER_DEFINE_OFF_REAL_TIME_LIGHT = Laya.Shader3D.getDefineByName("OFF_REAL_TIME_LIGHT");
    var ha = s(function e() {
        l(this, e);
    });
    ha.PBRVS = '\n#if defined(GL_FRAGMENT_PRECISION_HIGH)\nprecision highp float;\nprecision highp int;\n#else\nprecision mediump float;\nprecision mediump int;\n#endif\n#include "Lighting.glsl";\n#include "LayaUtile.glsl"\n#include "Shadow.glsl"\n#include "PBRVSInput.glsl";\n#include "PBRVertex.glsl";\n\nvoid main()\n{\n    vertexForward();\n    gl_Position=remapGLPositionZ(gl_Position);\n}\n',
        ha.PBRPS = ' \n#if defined(GL_FRAGMENT_PRECISION_HIGH)\nprecision highp float;\nprecision highp int;\n#else\nprecision mediump float;\nprecision mediump int;\n#endif\n\n#include "Lighting.glsl";\n#include "Shadow.glsl"\n#include "PBRFSInput.glsl";\n#include "LayaPBRBRDF.glsl";\n#include "GlobalIllumination.glsl";\n#include "PBRCore.glsl";\nmediump vec4 tyBRDFHighLight(mediump vec3 diffColor, mediump vec3 specColor,\n                                mediump float oneMinusReflectivity, float perceptualRoughness,\n                                float roughness, mediump float nv, vec3 normal, vec3 viewDir, LayaLight light)\n{\n    vec3 halfDir = safeNormalize(viewDir-light.dir);\n\n    float nl = clamp(dot(normal, -light.dir), 0.0, 1.0);\n    float nh = clamp(dot(normal, halfDir), 0.0, 1.0);\n    mediump float lv = clamp(dot(light.dir, viewDir), 0.0, 1.0);\n    mediump float lh = clamp(dot(light.dir, -halfDir), 0.0, 1.0);\n\n    // Diffuse term\n    mediump float diffuseTerm = disneyDiffuse(nv, nl, lh, perceptualRoughness) * nl;\n\n    // Specular term\n    // HACK: theoretically we should divide diffuseTerm by Pi and not multiply specularTerm!\n    // BUT that will make shader look significantly darker than Legacy ones\n\n    // GGX with roughtness to 0 would mean no specular at all, using max(roughness, 0.002) here to match HDrenderloop roughtness remapping.\n    roughness = max(roughness, 0.002);\n    float V = smithJointGGXVisibilityTerm(nl, nv, roughness);\n    float D = ggxTerm(nh, roughness);\n\n    float specularTerm = V * D * PI;// Torrance-Sparrow model, Fresnel is applied later\n\n    //#ifdef LAYA_COLORSPACE_GAMMA\n    specularTerm = sqrt(max(1e-4, specularTerm));\n    //#endif\n    specularTerm = max(0.0, specularTerm * nl);\n\n    mediump vec3 color = diffColor * light.color * diffuseTerm + specularTerm * light.color * fresnelTerm(specColor, lh);\n    return vec4(color, 1.0);\n}\n\nvoid myFragmentForward()\n{ \n    vec2 uv;\n    #if defined(ALBEDOTEXTURE)||defined(METALLICGLOSSTEXTURE)||defined(NORMALTEXTURE)||defined(EMISSIONTEXTURE)||defined(OCCLUSIONTEXTURE)||defined(PARALLAXTEXTURE)\n        #ifdef PARALLAXTEXTURE\n            uv = parallax(v_Texcoord0, normalize(v_ViewDirForParallax));\n        #else\n            uv = v_Texcoord0;\n        #endif\n    #endif\n        \n    mediump float alpha = getAlpha(uv);\n    #ifdef ALPHATEST\n        if (alpha<u_AlphaTestValue)\n            discard;\n    #endif\n        \n    FragmentCommonData o = SETUP_BRDF_INPUT(uv);\n    vec3 binormal;\n    vec3 tangent;\n    #ifdef NORMALTEXTURE\n        tangent = v_Tangent;\n        binormal = v_Binormal;\n    #endif\n    //o.diffColor = vec4(1.,0.,0.);\n    vec3 normal = v_Normal;\n    vec3 normalWorld = perPixelWorldNormal(uv, normal, binormal, tangent);//In FS if the normal use mediump before normalize will cause precision prolem in mobile device.\n    vec3 eyeVec = normalize(v_EyeVec);\n    vec3 posworld = v_PositionWorld;\n\n    #ifdef TRANSPARENTBLEND\n        o.diffColor=preMultiplyAlpha(o.diffColor, alpha, o.oneMinusReflectivity, /*out*/alpha);// shader relies on pre-multiply alpha-blend (srcBlend = One, dstBlend = OneMinusSrcAlpha)\n    #endif\n        \n    mediump float occlusion = getOcclusion(uv);\n    mediump vec2 lightMapUV;\n    #ifdef LIGHTMAP\n        lightMapUV=v_LightMapUV;\n    #endif\n    float perceptualRoughness = smoothnessToPerceptualRoughness(o.smoothness);\n    float roughness = perceptualRoughnessToRoughness(perceptualRoughness);\n    float nv = abs(dot(normalWorld, eyeVec));\n    LayaGI gi =fragmentGI(o.smoothness, eyeVec, occlusion, lightMapUV, normalWorld, posworld);\n    vec4 color = LAYA_BRDF_GI(o.diffColor, o.specColor, o.oneMinusReflectivity, o.smoothness, perceptualRoughness, roughness, nv, normalWorld, eyeVec, gi);\n    \n    float shadowAttenuation = 1.0;\n    \n    \n    #if !defined(OFF_REAL_TIME_LIGHT)\n//    #else\n    \n    \n    #ifdef LEGACYSINGLELIGHTING\n        #ifdef DIRECTIONLIGHT\n            #if defined(CALCULATE_SHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                #ifdef SHADOW_CASCADE\n                    vec4 shadowCoord = getShadowCoord(vec4(v_PositionWorld, 1.0));\n                #else\n                    vec4 shadowCoord = v_ShadowCoord;\n                #endif\n                shadowAttenuation=sampleShadowmap(shadowCoord);\n            #endif\n            LayaLight dirLight = layaDirectionLightToLight(u_DirectionLight, shadowAttenuation);\n            color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, dirLight);\n        #endif\n    \n        #ifdef POINTLIGHT\n            shadowAttenuation = 1.0;\n            LayaLight poiLight = layaPointLightToLight(posworld, normalWorld, u_PointLight, shadowAttenuation);\n            color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, poiLight);\n        #endif\n        \n        #ifdef SPOTLIGHT\n            shadowAttenuation = 1.0;\n            #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                vec4 spotShadowcoord = v_SpotShadowCoord;\n                shadowAttenuation = sampleSpotShadowmap(spotShadowcoord);\n            #endif\n            LayaLight spoLight = layaSpotLightToLight(posworld, normalWorld, u_SpotLight, shadowAttenuation);\n            color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, spoLight);\n        #endif\n    #else\n         #ifdef DIRECTIONLIGHT\n            for (int i = 0; i < MAX_LIGHT_COUNT; i++) \n            { \n                shadowAttenuation = 1.0;\n                if (i >= u_DirationLightCount)\n                    break;\n                #if defined(CALCULATE_SHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                    if (i == 0)\n                    { \n                        #ifdef SHADOW_CASCADE\n                            vec4 shadowCoord = getShadowCoord(vec4(v_PositionWorld, 1.0));\n                        #else\n                            vec4 shadowCoord = v_ShadowCoord;\n                        #endif\n                        shadowAttenuation *= sampleShadowmap(shadowCoord);\n                     }\n                #endif\n                DirectionLight directionLight = getDirectionLight(u_LightBuffer, i);\n                LayaLight dirLight = layaDirectionLightToLight(directionLight, shadowAttenuation);\n                 color+=tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, dirLight);\n             }\n        #endif\n        #if defined(POINTLIGHT)||defined(SPOTLIGHT)\n            ivec4 clusterInfo =getClusterInfo(u_LightClusterBuffer, u_View, u_Viewport, v_PositionWorld, gl_FragCoord, u_ProjectionParams);\n        #ifdef POINTLIGHT\n            for (int i = 0; i < MAX_LIGHT_COUNT; i++) \n            { \n                shadowAttenuation = 1.0;\n                if (i >= clusterInfo.x)//PointLightCount\n                    break;\n                PointLight pointLight = getPointLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, i);\n                LayaLight poiLight = layaPointLightToLight(posworld, normalWorld, pointLight, shadowAttenuation);\n                color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, poiLight);\n             }\n        #endif\n            #ifdef SPOTLIGHT\n                for (int i = 0; i < MAX_LIGHT_COUNT; i++) \n                { \n                    shadowAttenuation = 1.0;\n                    if (i >= clusterInfo.y)//SpotLightCount\n                        break;\n                    #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                        if (i == 0)\n                        { \n                            vec4 spotShadowcoord = v_SpotShadowCoord;\n                            shadowAttenuation= sampleSpotShadowmap(spotShadowcoord);\n                         }\n                    #endif\n                    SpotLight spotLight = getSpotLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, i);\n                    LayaLight spoLight = layaSpotLightToLight(posworld, normalWorld, spotLight, shadowAttenuation);\n                    color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, spoLight);\n                 }\n            #endif\n        #endif\n     #endif\n                    #endif\n    #ifdef EMISSION\n        vec3 eC = emission(uv);\n        color.rgb += eC;\n    #endif\n\n    #ifdef FOG\n        float lerpFact=clamp((1.0/gl_FragCoord.w-u_FogStart)/u_FogRange, 0.0, 1.0);\n        color.rgb=mix(color.rgb, u_FogColor, lerpFact);\n    #endif\n            \n    gl_FragColor=vec4(color.rgb, alpha);\n}\n\nvoid main()\n{\n    myFragmentForward();\n}';
    var da = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this))._offRealTimeLight = !1, e.setShaderName("TYPBRStandard"),
                e;
        }
        return s(t, [{
            key: "clone",
            value: function () {
                var e = new t();
                return e.offRealTimeLight = this._offRealTimeLight, this.cloneTo(e), e;
            }
        }, {
            key: "offRealTimeLight",
            get: function () {
                return this._offRealTimeLight;
            },
            set: function (e) {
                this._offRealTimeLight = e, e ? this._shaderValues.addDefine(t.SHADER_DEFINE_OFF_REAL_TIME_LIGHT) : this._shaderValues.removeDefine(t.SHADER_DEFINE_OFF_REAL_TIME_LIGHT);
            }
        }], [{
            key: "__init__",
            value: function () {
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_InstanceColor: Laya.VertexMesh.MESH_CUSTOME0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMap: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMapDirection: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectCubeHDRParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeProbePosition: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMax: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMin: Laya.Shader3D.PERIOD_SPRITE,
                    u_CameraPos: Laya.Shader3D.PERIOD_CAMERA,
                    u_View: Laya.Shader3D.PERIOD_CAMERA,
                    u_ProjectionParams: Laya.Shader3D.PERIOD_CAMERA,
                    u_Viewport: Laya.Shader3D.PERIOD_CAMERA,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OcclusionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Smoothness: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SmoothnessScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_occlusionStrength: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MetallicGlossTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Metallic: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AmbientColor: Laya.Shader3D.PERIOD_SCENE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE,
                    u_DirationLightCount: Laya.Shader3D.PERIOD_SCENE,
                    u_LightBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_LightClusterBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowBias: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightDirection: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowParams: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMatrices: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMapSize: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightPosition: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHC: Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.spot": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.color": Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("TYPBRStandard", e, a, !0, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r), r.addShaderPass(ha.PBRVS, ha.PBRPS, n, "Forward"), Laya.ClassUtils.regClass("TY.TYPBRStandardMaterial", t);
            }
        }]), t;
    }(Laya.PBRStandardMaterial);
    da.SHADER_DEFINE_OFF_REAL_TIME_LIGHT = Laya.Shader3D.getDefineByName("OFF_REAL_TIME_LIGHT");
    var _a = s(function e() {
        l(this, e);
    });
    _a.PBRVS = '\n#if defined(GL_FRAGMENT_PRECISION_HIGH)\nprecision highp float;\nprecision highp int;\n#else\nprecision mediump float;\nprecision mediump int;\n#endif\n#include "Lighting.glsl";\n#include "LayaUtile.glsl"\n#include "Shadow.glsl"\n#include "PBRVSInput.glsl";\n#include "PBRVertex.glsl";\n\nvoid main()\n{\n    vertexForward();\n    gl_Position=remapGLPositionZ(gl_Position);\n}\n',
        _a.PBRPS = ' \n#if defined(GL_FRAGMENT_PRECISION_HIGH)\nprecision highp float;\nprecision highp int;\n#else\nprecision mediump float;\nprecision mediump int;\n#endif\n\n#include "Lighting.glsl";\n#include "Shadow.glsl"\n#include "PBRFSInput.glsl";\n#include "LayaPBRBRDF.glsl";\n#include "GlobalIllumination.glsl";\n#include "PBRCore.glsl";\n#include "TYPBSCore.glsl";\nvoid main()\n{\n    tyFragmentForward();\n}';
    var ca = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this))._offRealTimeLight = !1, e.setShaderName("TYPBSStandard"),
                e;
        }
        return s(t, [{
            key: "clone",
            value: function () {
                var e = new t();
                return e.offRealTimeLight = this._offRealTimeLight, this.cloneTo(e), e;
            }
        }, {
            key: "offRealTimeLight",
            get: function () {
                return this._offRealTimeLight;
            },
            set: function (e) {
                this._offRealTimeLight = e, e ? this._shaderValues.addDefine(t.SHADER_DEFINE_OFF_REAL_TIME_LIGHT) : this._shaderValues.removeDefine(t.SHADER_DEFINE_OFF_REAL_TIME_LIGHT);
            }
        }, {
            key: "hColor",
            get: function () {
                return this.getShaderPropertyValue("u_HColor");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_HColor", e);
            }
        }, {
            key: "sColor",
            get: function () {
                return this.getShaderPropertyValue("u_SColor");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_SColor", e);
            }
        }, {
            key: "rampThreshold",
            get: function () {
                return this.getShaderPropertyValue("u_RampThreshold");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RampThreshold", e);
            }
        }, {
            key: "rampSmooth",
            get: function () {
                return this.getShaderPropertyValue("u_RampSmooth");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RampSmooth", e);
            }
        }, {
            key: "rampSmoothAdd",
            get: function () {
                return this.getShaderPropertyValue("u_RampSmoothAdd");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RampSmoothAdd", e);
            }
        }, {
            key: "specSmooth",
            get: function () {
                return this.getShaderPropertyValue("u_SpecSmooth");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_SpecSmooth", e);
            }
        }, {
            key: "specBlend",
            get: function () {
                return this.getShaderPropertyValue("u_SpecBlend");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_SpecBlend", e);
            }
        }, {
            key: "rimStrength",
            get: function () {
                return this.getShaderPropertyValue("u_RimStrength");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RimStrength", e);
            }
        }, {
            key: "rimMin",
            get: function () {
                return this.getShaderPropertyValue("u_RimMin");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RimMin", e);
            }
        }, {
            key: "rimMax",
            get: function () {
                return this.getShaderPropertyValue("u_RimMax");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RimMax", e);
            }
        }, {
            key: "enableFresnel",
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADER_DEFINE_FRESNEL) : this._shaderValues.removeDefine(t.SHADER_DEFINE_FRESNEL);
            }
        }], [{
            key: "__init__",
            value: function () {
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_InstanceColor: Laya.VertexMesh.MESH_CUSTOME0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMap: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMapDirection: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectCubeHDRParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeProbePosition: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMax: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMin: Laya.Shader3D.PERIOD_SPRITE,
                    u_HColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RampThreshold: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RampSmooth: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RampSmoothAdd: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SpecSmooth: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SpecBlend: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimStrength: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimMin: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimMax: Laya.Shader3D.PERIOD_MATERIAL,
                    u_CameraPos: Laya.Shader3D.PERIOD_CAMERA,
                    u_View: Laya.Shader3D.PERIOD_CAMERA,
                    u_ProjectionParams: Laya.Shader3D.PERIOD_CAMERA,
                    u_Viewport: Laya.Shader3D.PERIOD_CAMERA,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OcclusionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Smoothness: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SmoothnessScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_occlusionStrength: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MetallicGlossTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Metallic: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AmbientColor: Laya.Shader3D.PERIOD_SCENE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE,
                    u_DirationLightCount: Laya.Shader3D.PERIOD_SCENE,
                    u_LightBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_LightClusterBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowBias: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightDirection: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowParams: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMatrices: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMapSize: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightPosition: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHC: Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.spot": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.color": Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("TYPBSStandard", e, a, !0, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r), r.addShaderPass(_a.PBRVS, _a.PBRPS, n, "Forward"), Laya.ClassUtils.regClass("TY.PBSStandardMaterial", t);
            }
        }]), t;
    }(Laya.PBRStandardMaterial);
    ca.SHADER_DEFINE_OFF_REAL_TIME_LIGHT = Laya.Shader3D.getDefineByName("OFF_REAL_TIME_LIGHT"),
        ca.SHADER_DEFINE_FRESNEL = Laya.Shader3D.getDefineByName("FRESNEL");
    var Ea, Sa = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this)).setShaderName("TYPBSStandardOutLine"), e;
        }
        return s(t, [{
            key: "clone",
            value: function () {
                var e = new t();
                return this.cloneTo(e), e;
            }
        }, {
            key: "outlineColor",
            get: function () {
                return this.getShaderPropertyValue("u_OutlineColor");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_OutlineColor", e);
            }
        }, {
            key: "outlineRange",
            get: function () {
                return this.getShaderPropertyValue("u_OutlineRange");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_OutlineRange", e);
            }
        }], [{
            key: "__init__",
            value: function () {
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_InstanceColor: Laya.VertexMesh.MESH_CUSTOME0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMap: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMapDirection: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectCubeHDRParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeProbePosition: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMax: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMin: Laya.Shader3D.PERIOD_SPRITE,
                    u_HColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RampThreshold: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RampSmooth: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RampSmoothAdd: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SpecSmooth: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SpecBlend: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimStrength: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimMin: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimMax: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OutlineRange: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OutlineColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_CameraPos: Laya.Shader3D.PERIOD_CAMERA,
                    u_View: Laya.Shader3D.PERIOD_CAMERA,
                    u_ProjectionParams: Laya.Shader3D.PERIOD_CAMERA,
                    u_Viewport: Laya.Shader3D.PERIOD_CAMERA,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OcclusionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Smoothness: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SmoothnessScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_occlusionStrength: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MetallicGlossTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Metallic: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AmbientColor: Laya.Shader3D.PERIOD_SCENE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE,
                    u_DirationLightCount: Laya.Shader3D.PERIOD_SCENE,
                    u_LightBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_LightClusterBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowBias: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightDirection: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowParams: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMatrices: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMapSize: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightPosition: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHC: Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.spot": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.color": Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("TYPBSStandardOutLine", e, a, !0, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r);
                var o = r.addShaderPass(ea.OutLineVs, ea.OutLinePs);
                o.renderState.cull = Laya.RenderState.CULL_FRONT, o.renderState.depthWrite = !1,
                    r.addShaderPass(_a.PBRVS, _a.PBRPS, n, "Forward"), Laya.ClassUtils.regClass("TY.PBSStandardOutLineMaterial", t);
            }
        }]), t;
    }(ca);
    Ea = "\nuniform vec4 u_HColor;\nuniform vec4 u_SColor;\n\nuniform float u_RampThreshold;\nuniform float u_RampSmooth;\nuniform float u_RampSmoothAdd;\n\nuniform float u_SpecSmooth;\nuniform float u_SpecBlend;\n\n#if defined(FRESNEL)\n    uniform float u_RimStrength;\n    uniform float u_RimMin;\n    uniform float u_RimMax;\n#endif\n\nfloat wrapRampNL(float nl,float threshold,float smoothness)\n{\n    nl = smoothstep(threshold - smoothness *0.5, threshold + smoothness*0.5, nl);\n    return nl;\n}\n\nfloat stylizedSpecular(float specularTerm,float specSmoothness)\n{\n    return smoothstep(specSmoothness*0.5, 0.5 + specSmoothness*0.5, specularTerm);\n}\n\nvec3 stylizedFresnel(float nv, float roughness, LayaLight light, vec3 normal, float rimMin, float rimMax, float rimStrength)\n{\n    float rim = 1.0-nv;\n    rim = smoothstep(rimMin, rimMax, rim) * rimStrength * clamp(1.33-roughness,0.0,1.0);\n    return rim * clamp(dot(normal, -light.dir),0.0,1.0) * light.color;\n}\n\nmediump vec4 tyBRDFHighLight(mediump vec3 diffColor, mediump vec3 specColor,\nmediump float oneMinusReflectivity, float perceptualRoughness,\nfloat roughness, mediump float nv,\nvec3 normal, vec3 viewDir, LayaLight light,float ramp_smooth)\n{\n    \n    vec3 halfDir = safeNormalize(viewDir-light.dir);\n//\n    float nl = clamp(dot(normal, -light.dir), 0.0, 1.0);\n    float nh = clamp(dot(normal, halfDir), 0.0, 1.0);\n    mediump float lv = clamp(dot(light.dir, viewDir), 0.0, 1.0);\n    mediump float lh = clamp(dot(light.dir, -halfDir), 0.0, 1.0);\n    \n    nl = wrapRampNL(nl,u_RampThreshold,ramp_smooth);\n    \n    // Diffuse term\n    mediump float diffuseTerm = disneyDiffuse(nv, nl, lh, perceptualRoughness) * nl;\n\n    // Specular term\n    // HACK: theoretically we should divide diffuseTerm by Pi and not multiply specularTerm!\n    // BUT that will make shader look significantly darker than Legacy ones\n\n    // GGX with roughtness to 0 would mean no specular at all, using max(roughness, 0.002) here to match HDrenderloop roughtness remapping.\n    roughness = max(roughness, 0.002);\n    float V = smithJointGGXVisibilityTerm(nl, nv, roughness);\n    float D = ggxTerm(nh, roughness);\n\n    float specularTerm = V * D * PI;// Torrance-Sparrow model, Fresnel is applied later\n    \n    float r = sqrt(roughness) * 0.85;\n    r += 1e-4;\n    specularTerm = mix(specularTerm,stylizedSpecular(specularTerm,u_SpecSmooth) * (1.0/r),u_SpecBlend);\n\n    //#ifdef LAYA_COLORSPACE_GAMMA\n    specularTerm = sqrt(max(1e-4, specularTerm));\n    //#endif\n    specularTerm = max(0.0, specularTerm * nl);\n\n    vec4 sColor = mix(u_HColor,u_SColor,u_SColor.a);\n    \n    vec3 diffuseTermRGB = mix(sColor.rgb,u_HColor.rgb,diffuseTerm);\n    vec3 diffuseTY = diffColor * light.color * diffuseTermRGB;\n    //    mediump vec3 color = diffColor * light.color * diffuseTerm + specularTerm * light.color * fresnelTerm(specColor, lh);\n    mediump vec3 color = diffuseTY + specularTerm * light.color * fresnelTerm(specColor, lh);\n    #if defined(FRESNEL)\n        color += stylizedFresnel(nv, roughness, light, normal, u_RimMin, u_RimMax, u_RimStrength);\n    #endif\n    return vec4(color, 1.0);\n}\n\nvoid tyFragmentForward()\n{\n    vec2 uv;\n    #if defined(ALBEDOTEXTURE)||defined(METALLICGLOSSTEXTURE)||defined(NORMALTEXTURE)||defined(EMISSIONTEXTURE)||defined(OCCLUSIONTEXTURE)||defined(PARALLAXTEXTURE)\n        #ifdef PARALLAXTEXTURE\n            uv = parallax(v_Texcoord0, normalize(v_ViewDirForParallax));\n        #else\n            uv = v_Texcoord0;\n        #endif\n    #endif\n\n    mediump float alpha = getAlpha(uv);\n    #ifdef ALPHATEST\n        if (alpha<u_AlphaTestValue)\n        discard;\n    #endif\n\n    FragmentCommonData o = SETUP_BRDF_INPUT(uv);\n    vec3 binormal;\n    vec3 tangent;\n    #ifdef NORMALTEXTURE\n        tangent = v_Tangent;\n        binormal = v_Binormal;\n    #endif\n    //o.diffColor = vec4(1.,0.,0.);\n    vec3 normal = v_Normal;\n    vec3 normalWorld = perPixelWorldNormal(uv, normal, binormal, tangent);//In FS if the normal use mediump before normalize will cause precision prolem in mobile device.\n    vec3 eyeVec = normalize(v_EyeVec);\n    vec3 posworld = v_PositionWorld;\n\n    #ifdef TRANSPARENTBLEND\n        o.diffColor=preMultiplyAlpha(o.diffColor, alpha, o.oneMinusReflectivity, /*out*/alpha);// shader relies on pre-multiply alpha-blend (srcBlend = One, dstBlend = OneMinusSrcAlpha)\n    #endif\n\n    mediump float occlusion = getOcclusion(uv);\n    mediump vec2 lightMapUV;\n    #ifdef LIGHTMAP\n        lightMapUV=v_LightMapUV;\n    #endif\n    float perceptualRoughness = smoothnessToPerceptualRoughness(o.smoothness);\n    float roughness = perceptualRoughnessToRoughness(perceptualRoughness);\n    float nv = abs(dot(normalWorld, eyeVec));\n    LayaGI gi =fragmentGI(o.smoothness, eyeVec, occlusion, lightMapUV, normalWorld, posworld);\n    vec4 color = LAYA_BRDF_GI(o.diffColor, o.specColor, o.oneMinusReflectivity, o.smoothness, perceptualRoughness, roughness, nv, normalWorld, eyeVec, gi);\n\n    float shadowAttenuation = 1.0;\n    float ramp_smooth = u_RampSmoothAdd;\n\n    #if !defined(OFF_REAL_TIME_LIGHT)\n        #ifdef LEGACYSINGLELIGHTING\n            #ifdef DIRECTIONLIGHT\n                #if defined(CALCULATE_SHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                    #ifdef SHADOW_CASCADE\n                        vec4 shadowCoord = getShadowCoord(vec4(v_PositionWorld, 1.0));\n                    #else\n                        vec4 shadowCoord = v_ShadowCoord;\n                    #endif\n                        ramp_smooth = u_RampSmooth;\n                        shadowAttenuation=sampleShadowmap(shadowCoord);\n                #endif\n                LayaLight dirLight = layaDirectionLightToLight(u_DirectionLight, shadowAttenuation);\n                color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, dirLight,ramp_smooth);\n            #endif\n            #ifdef POINTLIGHT\n                shadowAttenuation = 1.0;\n                LayaLight poiLight = layaPointLightToLight(posworld, normalWorld, u_PointLight, shadowAttenuation);\n                color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, poiLight,ramp_smooth);\n            #endif\n\n            #ifdef SPOTLIGHT\n                shadowAttenuation = 1.0;\n                #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                    vec4 spotShadowcoord = v_SpotShadowCoord;\n                    shadowAttenuation = sampleSpotShadowmap(spotShadowcoord);\n                    ramp_smooth = u_RampSmooth;\n                #endif\n                LayaLight spoLight = layaSpotLightToLight(posworld, normalWorld, u_SpotLight, shadowAttenuation);\n                color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, spoLight,ramp_smooth);\n            #endif\n        #else\n            #ifdef DIRECTIONLIGHT\n                for (int i = 0; i < MAX_LIGHT_COUNT; i++)\n                {\n                    shadowAttenuation = 1.0;\n                    if (i >= u_DirationLightCount)\n                        break;\n                    #if defined(CALCULATE_SHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                        if (i == 0)\n                        {\n                            #ifdef SHADOW_CASCADE\n                                vec4 shadowCoord = getShadowCoord(vec4(v_PositionWorld, 1.0));\n                            #else\n                                vec4 shadowCoord = v_ShadowCoord;\n                            #endif\n                            shadowAttenuation *= sampleShadowmap(shadowCoord);\n                            ramp_smooth = u_RampSmooth;\n                        }\n                    #endif\n                    DirectionLight directionLight = getDirectionLight(u_LightBuffer, i);\n                    LayaLight dirLight = layaDirectionLightToLight(directionLight, shadowAttenuation);\n                    color+=tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, dirLight,ramp_smooth);\n                }\n            #endif\n            #if defined(POINTLIGHT)||defined(SPOTLIGHT)\n                ivec4 clusterInfo =getClusterInfo(u_LightClusterBuffer, u_View, u_Viewport, v_PositionWorld, gl_FragCoord, u_ProjectionParams);\n                #ifdef POINTLIGHT\n                    for (int i = 0; i < MAX_LIGHT_COUNT; i++)\n                    {\n                        shadowAttenuation = 1.0;\n                        if (i >= clusterInfo.x)//PointLightCount\n                        break;\n                        PointLight pointLight = getPointLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, i);\n                        LayaLight poiLight = layaPointLightToLight(posworld, normalWorld, pointLight, shadowAttenuation);\n                        color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, poiLight,ramp_smooth);\n                    }\n                #endif\n                #ifdef SPOTLIGHT\n                    for (int i = 0; i < MAX_LIGHT_COUNT; i++)\n                    {\n                        shadowAttenuation = 1.0;\n                        if (i >= clusterInfo.y)//SpotLightCount\n                        break;\n                        #if defined(CALCULATE_SPOTSHADOWS)//shader中自定义的宏不可用ifdef 必须改成if defined\n                        if (i == 0)\n                        {\n                            vec4 spotShadowcoord = v_SpotShadowCoord;\n                            shadowAttenuation= sampleSpotShadowmap(spotShadowcoord);\n                            ramp_smooth = u_RampSmooth;\n                        }\n                        #endif\n                        SpotLight spotLight = getSpotLight(u_LightBuffer, u_LightClusterBuffer, clusterInfo, i);\n                        LayaLight spoLight = layaSpotLightToLight(posworld, normalWorld, spotLight, shadowAttenuation);\n                        color+= tyBRDFHighLight(o.diffColor, o.specColor, o.oneMinusReflectivity, perceptualRoughness, roughness, nv, normalWorld, eyeVec, spoLight,ramp_smooth);\n                    }\n                #endif\n            #endif\n        #endif\n    #endif\n#ifdef EMISSION\n    vec3 eC = emission(uv);\n    color.rgb += eC;\n#endif\n\n#ifdef FOG\n    float lerpFact=clamp((1.0/gl_FragCoord.w-u_FogStart)/u_FogRange, 0.0, 1.0);\n    color.rgb=mix(color.rgb, u_FogColor, lerpFact);\n#endif\n\n    gl_FragColor=vec4(color.rgb, alpha);\n}\n";
    var fa = function (a) {
        r(u, a);
        var t = o(u);
        function u() {
            var a, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null, i = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
            return l(this, u), (a = t.call(this, i))._color = new Laya.Color(1, 1, 1, 1), a._width = 1,
                a._height = 1, a._pixelsPerUnit = 100, a._pivot = new Laya.Vector2(.5, .5), a._uvRect = new Laya.Rectangle(),
                a.vertex_0 = new Laya.Vector3(), a.vertex_1 = new Laya.Vector3(), a.vertex_2 = new Laya.Vector3(),
                a.vertex_3 = new Laya.Vector3(), a._meshFilter = new Laya.MeshFilter(e(a)), a._render = new Laya.MeshRenderer(e(a)),
                n && (a._meshFilter.sharedMesh = n), a;
        }
        return s(u, [{
            key: "pixelsPerUnit",
            get: function () {
                return this._pixelsPerUnit;
            }
        }, {
            key: "width",
            get: function () {
                return this._width;
            },
            set: function (e) {
                this._width = e, this.changeMeshPos();
            }
        }, {
            key: "height",
            get: function () {
                return this._height;
            },
            set: function (e) {
                this._height = e, this.changeMeshPos();
            }
        }, {
            key: "color",
            get: function () {
                return this._color;
            },
            set: function (e) {
                this._color = e, this.meshFilter.sharedMesh && this.meshFilter.sharedMesh.setColors([this._color, this._color, this._color, this._color]);
            }
        }, {
            key: "v4Color",
            set: function (e) {
                this._color.r = e.x, this._color.g = e.y, this._color.b = e.z, this._color.a = e.w,
                    this.meshFilter.sharedMesh && this.meshFilter.sharedMesh.setColors([this._color, this._color, this._color, this._color]);
            }
        }, {
            key: "pivot",
            get: function () {
                return this._pivot;
            },
            set: function (e) {
                e.cloneTo(this._pivot), this.setPos(), this.changeMeshPos();
            }
        }, {
            key: "meshFilter",
            get: function () {
                return this._meshFilter;
            }
        }, {
            key: "meshRenderer",
            get: function () {
                return this._render;
            }
        }, {
            key: "createMesh",
            value: function () {
                var e = Laya.VertexMesh.getVertexDeclaration("POSITION,NORMAL,UV,COLOR");
                this.setPos();
                var a = new Float32Array([this.vertex_0.x, this.vertex_0.y, this.vertex_0.z, 0, 0, -1, this._uvRect.x, this._uvRect.y, this._color.r, this._color.g, this._color.b, this._color.a, this.vertex_1.x, this.vertex_1.y, this.vertex_1.z, 0, 0, -1, this._uvRect.x + this._uvRect.width, this._uvRect.y, this._color.r, this._color.g, this._color.b, this._color.a, this.vertex_2.x, this.vertex_2.y, this.vertex_2.z, 0, 0, -1, this._uvRect.x + this._uvRect.width, this._uvRect.y + this._uvRect.height, this._color.r, this._color.g, this._color.b, this._color.a, this.vertex_3.x, this.vertex_3.y, this.vertex_3.z, 0, 0, -1, this._uvRect.x, this._uvRect.y + this._uvRect.height, this._color.r, this._color.g, this._color.b, this._color.a]), t = new Uint16Array([0, 1, 2, 0, 2, 3]);
                return Laya.PrimitiveMesh._createMesh(e, a, t);
            }
        }, {
            key: "createMeshByData",
            value: function (e) {
                var a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : new Laya.Vector4(1, 1, 1, 1), t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 100, n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : new Laya.Vector4(0, 0, 1, 1), i = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : new Laya.Vector2(.5, .5);
                this.setData({
                    color: [a.x, a.y, a.z, a.w],
                    pixelsPerUnit: t,
                    uv: [n.x, n.y, n.z, n.w],
                    pivot: [i.x, i.y],
                    width: e.width,
                    height: e.height
                });
                var r = new ra();
                this.meshRenderer.sharedMaterial = r, r.albedoTexture = e, r.enableVertexColor = !0,
                    this.meshFilter.sharedMesh = this.createMesh(), this.meshFilter.sharedMesh.setColors([this._color, this._color, this._color, this._color]);
            }
        }, {
            key: "setData",
            value: function (e) {
                e.color && (this._color.r = e.color[0], this._color.g = e.color[1], this._color.b = e.color[2],
                    this._color.a = e.color[3]), e.width && (this._width = e.width), e.height && (this._height = e.height),
                    e.pixelsPerUnit && (this._pixelsPerUnit = e.pixelsPerUnit), e.uv && (this._uvRect.x = e.uv[0],
                        this._uvRect.y = e.uv[1], this._uvRect.width = e.uv[2], this._uvRect.height = e.uv[3]),
                    e.pivot && this._pivot.setValue(e.pivot[0], e.pivot[1]);
            }
        }, {
            key: "_parse",
            value: function (e, a) {
                n(i(u.prototype), "_parse", this).call(this, e, a), this.setData(e), this.meshFilter.sharedMesh = this.createMesh(),
                    this.meshFilter.sharedMesh.setColors([this._color, this._color, this._color, this._color]),
                    this.meshRenderer.sharedMaterial = Laya.loader.getRes(e.material), this.meshRenderer.sharedMaterial.enableVertexColor = !0;
            }
        }, {
            key: "changeMeshPos",
            value: function () {
                this.meshFilter.sharedMesh && (this.setPos(), this.meshFilter.sharedMesh.setPositions([this.vertex_0, this.vertex_1, this.vertex_2, this.vertex_3]));
            }
        }, {
            key: "setPos",
            value: function () {
                var e = this._width / this._pixelsPerUnit, a = this._height / this._pixelsPerUnit, t = e * this._pivot.x, n = a * this._pivot.y;
                this.vertex_0.setValue(t, a - n, 0), this.vertex_1.setValue(-e + t, a - n, 0), this.vertex_2.setValue(-e + t, 0 - n, 0),
                    this.vertex_3.setValue(t, 0 - n, 0);
            }
        }, {
            key: "getPosUv",
            value: function (e) {
                var a = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null;
                null == a && (a = new Laya.Vector2());
                var t = u._tempMatrix0;
                return this.parent.transform, this.transform.worldMatrix.invert(t), Laya.Vector3.transformCoordinate(e, t, u.temp_v3),
                    a.x = this.vertex_0.x - u.temp_v3.x, a.y = this.vertex_0.y - u.temp_v3.y, a.x /= this.width / this._pixelsPerUnit,
                    a.y /= this.height / this._pixelsPerUnit, a;
            }
        }, {
            key: "hitTestPoint",
            value: function (e, a) {
                u.temp_v3.setValue(e, a, 0);
                var t = u._tempMatrix0;
                this.transform.worldMatrix.invert(t), Laya.Vector3.transformCoordinate(u.temp_v3, t, u.temp_v3);
                var n = u.temp_v3.x, i = u.temp_v3.y;
                return n <= this.vertex_0.x && n >= this.vertex_2.x && i <= this.vertex_0.y && i >= this.vertex_2.y;
            }
        }, {
            key: "hitTestSp",
            value: function (e) {
                var a = oe.transformPoint(e.transform, e.vertex_0), t = oe.transformPoint(e.transform, e.vertex_1), n = oe.transformPoint(e.transform, e.vertex_2), i = oe.transformPoint(e.transform, e.vertex_3);
                return this.hitTestPoint(a.x, a.y) || this.hitTestPoint(t.x, t.y) || this.hitTestPoint(n.x, n.y) || this.hitTestPoint(i.x, i.y);
            }
        }, {
            key: "_cloneTo",
            value: function (e, a, t) {
                var r = e;
                r.height = this.height, r.width = this.width, r.color = this.color, r._uvRect = this._uvRect.clone(),
                    r._pixelsPerUnit = this._pixelsPerUnit, r._meshFilter.sharedMesh = this._meshFilter.sharedMesh;
                var o = this._render, s = r._render;
                s.enable = o.enable, s.sharedMaterials = o.sharedMaterials, s.castShadow = o.castShadow;
                var l = o.lightmapScaleOffset;
                l && (s.lightmapScaleOffset = l.clone()), s.lightmapIndex = o.lightmapIndex, s.receiveShadow = o.receiveShadow,
                    s.sortingFudge = o.sortingFudge, n(i(u.prototype), "_cloneTo", this).call(this, e, a, t);
            }
        }, {
            key: "_create",
            value: function () {
                return new u();
            }
        }]), u;
    }(Laya.RenderableSprite3D);
    fa._tempMatrix0 = new Laya.Matrix4x4(), fa.temp_v3 = new Laya.Vector3();
    var La = "\n    #ifdef GL_FRAGMENT_PRECISION_HIGH\n    precision highp float;\n    #else\n    precision mediump float;\n    #endif\n\n    varying vec3 v_Normal;\n    varying vec3 v_ViewDir;\n    #ifdef RIMNORMALTEXTURE\n    uniform sampler2D u_RimNormalTexture;\n    uniform float u_RimNormalTextureScale;\n    varying vec3 v_Tangent;\n    varying vec3 v_Binormal;\n    #endif\n    varying vec2 v_Texcoord0;\n\n    uniform vec4 u_RimColor;\n    uniform float u_RimPower;\n\n    #ifdef ALPHATEST\n    uniform float u_AlphaTestValue;\n    #endif\n\n    #ifdef FOG\n    uniform float u_FogStart;\n    uniform float u_FogRange;\n    #ifdef ADDTIVEFOG\n    #else\n    uniform vec3 u_FogColor;\n    #endif\n    #endif\n\n    vec3 NormalSampleToWorldSpace(vec4 normalMapSample,float scale) {\n        vec3 normalT;\n        normalT.x = 2.0 * normalMapSample.x - 1.0;\n        normalT.y = 1.0 - 2.0 * normalMapSample.y;\n\n        normalT.xy *= scale;\n\n        normalT.z = sqrt(1.0 - clamp(dot(normalT.xy, normalT.xy), 0.0, 1.0));\n\n        vec3 bumpedNormal = normalize(normalT);\n\n        return bumpedNormal;\n    }\n\n\n    void main()\n    {\n        //gl_FragColor = vec4(1.0,1.0,1.0,1.0);\n        vec3 normal;//light and SH maybe use normal\n\n        #if defined(RIMNORMALTEXTURE)\n        vec4 normalMapSample = texture2D(u_RimNormalTexture, v_Texcoord0);\n        vec3 normalTangent=NormalSampleToWorldSpace(normalMapSample,u_RimNormalTextureScale);\n        normal = normalize(v_Tangent * normalTangent.x + v_Binormal * normalTangent.y + v_Normal * normalTangent.z);\n        #else\n        normal = normalize(v_Normal);\n        #endif\n        //    normal = normalize(v_Normal);\n        vec3 viewDir= normalize(v_ViewDir);\n        float t = dot(normal, viewDir);\n        float Rim = pow(1.0 - max(0.0,dot(normal, viewDir)),u_RimPower);\n\n        gl_FragColor = u_RimColor;\n\n        #ifdef ALPHATEST\n        if (gl_FragColor.a < u_AlphaTestValue)\n        discard;\n        #endif\n\n        gl_FragColor.a = Rim;\n\n        #ifdef FOG\n        float lerpFact = clamp((1.0 / gl_FragCoord.w - u_FogStart) / u_FogRange, 0.0, 1.0);\n        #ifdef ADDTIVEFOG\n        gl_FragColor.rgb = mix(gl_FragColor.rgb, vec3(0.0), lerpFact);\n        #else\n        gl_FragColor.rgb = mix(gl_FragColor.rgb, u_FogColor, lerpFact);\n        #endif\n        #endif\n    }\n", Da = '#if defined(GL_FRAGMENT_PRECISION_HIGH)// 原来的写法会被我们自己的解析流程处理，而我们的解析是不认内置宏的，导致被删掉，所以改成 if defined 了\nprecision highp float;\n#else\nprecision mediump float;\n#endif\n#include "Lighting.glsl";\n#include "LayaUtile.glsl"\n#include "Shadow.glsl"\n\nattribute vec4 a_Position;\n\nattribute vec2 a_Texcoord0;\n\n#ifdef GPU_INSTANCE\nuniform mat4 u_ViewProjection;\nattribute mat4 a_WorldMat;\n#else\nuniform mat4 u_MvpMatrix;\nuniform mat4 u_WorldMat;\n#endif\n\nattribute vec4 a_Color;\n\nvarying vec4 v_Color;\nvarying vec2 v_Texcoord0;\n\nuniform vec4 u_TilingOffset;\n\n#ifdef BONE\nconst int c_MaxBoneCount = 24;\nattribute vec4 a_BoneIndices;\nattribute vec4 a_BoneWeights;\nuniform mat4 u_Bones[c_MaxBoneCount];\n#endif\nattribute vec3 a_Normal;\nvarying vec3 v_Normal;\n\nuniform vec3 u_CameraPos;\nvarying vec3 v_ViewDir;\n\n#if defined(RIMNORMALTEXTURE)\nattribute vec4 a_Tangent0;\nvarying vec3 v_Tangent;\nvarying vec3 v_Binormal;\n#endif\nvarying vec3 v_PositionWorld;\n\nvoid main() {\n    vec4 position;\n    #ifdef BONE\n    mat4 skinTransform;\n    #ifdef SIMPLEBONE\n    float currentPixelPos;\n    #ifdef GPU_INSTANCE\n    currentPixelPos = a_SimpleTextureParams.x+a_SimpleTextureParams.y;\n    #else\n    currentPixelPos = u_SimpleAnimatorParams.x+u_SimpleAnimatorParams.y;\n    #endif\n    float offset = 1.0/u_SimpleAnimatorTextureSize;\n    skinTransform =  loadMatFromTexture(currentPixelPos, int(a_BoneIndices.x), offset) * a_BoneWeights.x;\n    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.y), offset) * a_BoneWeights.y;\n    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.z), offset) * a_BoneWeights.z;\n    skinTransform += loadMatFromTexture(currentPixelPos, int(a_BoneIndices.w), offset) * a_BoneWeights.w;\n    #else\n    skinTransform =  u_Bones[int(a_BoneIndices.x)] * a_BoneWeights.x;\n    skinTransform += u_Bones[int(a_BoneIndices.y)] * a_BoneWeights.y;\n    skinTransform += u_Bones[int(a_BoneIndices.z)] * a_BoneWeights.z;\n    skinTransform += u_Bones[int(a_BoneIndices.w)] * a_BoneWeights.w;\n    #endif\n    position=skinTransform*a_Position;\n    #else\n    position=a_Position;\n    #endif\n\n    mat4 worldMat;\n    #ifdef GPU_INSTANCE\n        worldMat = a_WorldMat;\n    #else\n        worldMat = u_WorldMat;\n    #endif\n    \n    #ifdef GPU_INSTANCE\n        gl_Position = u_ViewProjection * worldMat * position;\n    #else\n        gl_Position = u_MvpMatrix * position;\n    #endif\n    v_Texcoord0 = a_Texcoord0;\n\n  \n    \n    mat3 worldInvMat;\n    #ifdef BONE\n        worldInvMat=INVERSE_MAT(mat3(worldMat*skinTransform));\n    #else\n        worldInvMat=INVERSE_MAT(mat3(worldMat));\n    #endif\n    v_PositionWorld =(worldMat * position).xyz;\n    v_Normal=normalize(a_Normal*worldInvMat);\n\n    v_ViewDir = u_CameraPos-v_PositionWorld;\n    \n    #if defined(RIMNORMALTEXTURE)\n        v_Tangent=normalize(a_Tangent0.xyz*worldInvMat);\n        v_Binormal=cross(v_Normal, v_Tangent)*a_Tangent0.w;\n    #endif\n    \n    gl_Position=remapGLPositionZ(gl_Position);\n}', Ta = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this))._enableCustomLight = !1, e.setShaderName("PBRStandardRimBack"),
                e;
        }
        return s(t, [{
            key: "clone",
            value: function () {
                var e = new t();
                return this.cloneTo(e), e;
            }
        }, {
            key: "rimColor",
            get: function () {
                return this.getShaderPropertyValue("u_RimColor");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RimColor", e);
            }
        }, {
            key: "rimPower",
            get: function () {
                return this.getShaderPropertyValue("u_RimPower");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RimPower", e);
            }
        }, {
            key: "rimNormalTextureScale",
            get: function () {
                return this.getShaderPropertyValue("u_RimNormalTextureScale");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RimNormalTextureScale", e);
            }
        }, {
            key: "rimNormalTexture",
            get: function () {
                return this.getShaderPropertyValue("u_RimNormalTexture");
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADER_DEF_RIMNORMALTEXTURE) : this._shaderValues.removeDefine(t.SHADER_DEF_RIMNORMALTEXTURE),
                    this.setShaderPropertyValue("u_RimNormalTexture", e);
            }
        }], [{
            key: "__init__",
            value: function () {
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_Texcoord1: Laya.VertexMesh.MESH_TEXTURECOORDINATE1,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMap: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMapDirection: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectCubeHDRParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_ReflectTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeProbePosition: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMax: Laya.Shader3D.PERIOD_SPRITE,
                    u_SpecCubeBoxMin: Laya.Shader3D.PERIOD_SPRITE,
                    u_CameraPos: Laya.Shader3D.PERIOD_CAMERA,
                    u_View: Laya.Shader3D.PERIOD_CAMERA,
                    u_ProjectionParams: Laya.Shader3D.PERIOD_CAMERA,
                    u_Viewport: Laya.Shader3D.PERIOD_CAMERA,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AlbedoTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_OcclusionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_EmissionTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Smoothness: Laya.Shader3D.PERIOD_MATERIAL,
                    u_SmoothnessScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_occlusionStrength: Laya.Shader3D.PERIOD_MATERIAL,
                    u_NormalScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_ParallaxScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_TilingOffset: Laya.Shader3D.PERIOD_MATERIAL,
                    u_MetallicGlossTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_Metallic: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimNormalTextureScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimNormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimPower: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_AmbientColor: Laya.Shader3D.PERIOD_SCENE,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE,
                    u_DirationLightCount: Laya.Shader3D.PERIOD_SCENE,
                    u_LightBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_LightClusterBuffer: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowBias: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightDirection: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowParams: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMatrices: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMapSize: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightPosition: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHAb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBr: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBg: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHBb: Laya.Shader3D.PERIOD_SCENE,
                    u_AmbientSHC: Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_DirectionLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_PointLight.color": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.position": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.direction": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.range": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.spot": Laya.Shader3D.PERIOD_SCENE,
                    "u_SpotLight.color": Laya.Shader3D.PERIOD_SCENE
                }, n = {
                    s_Cull: Laya.Shader3D.RENDER_STATE_CULL,
                    s_Blend: Laya.Shader3D.RENDER_STATE_BLEND,
                    s_BlendSrc: Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    s_BlendDst: Laya.Shader3D.RENDER_STATE_BLEND_DST,
                    s_DepthTest: Laya.Shader3D.RENDER_STATE_DEPTH_TEST,
                    s_DepthWrite: Laya.Shader3D.RENDER_STATE_DEPTH_WRITE
                }, i = Laya.Shader3D.add("PBRStandardRimBack", e, a, !0, !0), r = new Laya.SubShader(e, a);
                i.addSubShader(r);
                var o = r.addShaderPass(Da, La);
                o.renderState.blend = Laya.RenderState.BLEND_ENABLE_ALL, o.renderState.srcBlend = Laya.RenderState.BLENDPARAM_SRC_ALPHA,
                    o.renderState.dstBlend = Laya.RenderState.BLENDPARAM_ONE, o.renderState.depthWrite = !1,
                    o.renderState.depthTest = Laya.RenderState.DEPTHTEST_GREATER, r.addShaderPass($e.PBRVS, $e.PBRPS, n, "Forward"),
                    Laya.ClassUtils.regClass("TY.PBRStandardRimBackMaterial", t);
            }
        }]), t;
    }(Laya.PBRStandardMaterial);
    Ta.SHADER_DEF_RIMNORMALTEXTURE = Laya.Shader3D.getDefineByName("RIMNORMALTEXTURE");
    var ya = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this))._enableCustomLight = !1, e.setShaderName("RimColorShader"),
                e;
        }
        return s(t, [{
            key: "clone",
            value: function () {
                var e = new t();
                return this.cloneTo(e), e;
            }
        }, {
            key: "rimColor",
            get: function () {
                return this.getShaderPropertyValue("u_RimColor");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RimColor", e);
            }
        }, {
            key: "rimPower",
            get: function () {
                return this.getShaderPropertyValue("u_RimPower");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RimPower", e);
            }
        }, {
            key: "rimNormalTextureScale",
            get: function () {
                return this.getShaderPropertyValue("u_RimNormalTextureScale");
            },
            set: function (e) {
                this.setShaderPropertyValue("u_RimNormalTextureScale", e);
            }
        }, {
            key: "rimNormalTexture",
            get: function () {
                return this.getShaderPropertyValue("u_RimNormalTexture");
            },
            set: function (e) {
                e ? this._shaderValues.addDefine(t.SHADER_DEF_RIMNORMALTEXTURE) : this._shaderValues.removeDefine(t.SHADER_DEF_RIMNORMALTEXTURE),
                    this.setShaderPropertyValue("u_RimNormalTexture", e);
            }
        }], [{
            key: "__init__",
            value: function () {
                var e = {
                    a_Position: Laya.VertexMesh.MESH_POSITION0,
                    a_Normal: Laya.VertexMesh.MESH_NORMAL0,
                    a_Tangent0: Laya.VertexMesh.MESH_TANGENT0,
                    a_Texcoord0: Laya.VertexMesh.MESH_TEXTURECOORDINATE0,
                    a_BoneWeights: Laya.VertexMesh.MESH_BLENDWEIGHT0,
                    a_BoneIndices: Laya.VertexMesh.MESH_BLENDINDICES0,
                    a_WorldMat: Laya.VertexMesh.MESH_WORLDMATRIX_ROW0,
                    a_SimpleTextureParams: Laya.VertexMesh.MESH_SIMPLEANIMATOR
                }, a = {
                    u_Bones: Laya.Shader3D.PERIOD_CUSTOM,
                    u_MvpMatrix: Laya.Shader3D.PERIOD_SPRITE,
                    u_WorldMat: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightmapScaleOffset: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMap: Laya.Shader3D.PERIOD_SPRITE,
                    u_LightMapDirection: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTexture: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorParams: Laya.Shader3D.PERIOD_SPRITE,
                    u_SimpleAnimatorTextureSize: Laya.Shader3D.PERIOD_SPRITE,
                    u_CameraPos: Laya.Shader3D.PERIOD_CAMERA,
                    u_View: Laya.Shader3D.PERIOD_CAMERA,
                    u_ProjectionParams: Laya.Shader3D.PERIOD_CAMERA,
                    u_Viewport: Laya.Shader3D.PERIOD_CAMERA,
                    u_ViewProjection: Laya.Shader3D.PERIOD_CAMERA,
                    u_AlphaTestValue: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimNormalTextureScale: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimNormalTexture: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimPower: Laya.Shader3D.PERIOD_MATERIAL,
                    u_RimColor: Laya.Shader3D.PERIOD_MATERIAL,
                    u_FogStart: Laya.Shader3D.PERIOD_SCENE,
                    u_FogRange: Laya.Shader3D.PERIOD_SCENE,
                    u_FogColor: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowBias: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightDirection: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowParams: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowSplitSpheres: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMatrices: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowMapSize: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotShadowMap: Laya.Shader3D.PERIOD_SCENE,
                    u_SpotViewProjectMatrix: Laya.Shader3D.PERIOD_SCENE,
                    u_ShadowLightPosition: Laya.Shader3D.PERIOD_SCENE
                };
                Laya.Shader3D.RENDER_STATE_CULL, Laya.Shader3D.RENDER_STATE_BLEND, Laya.Shader3D.RENDER_STATE_BLEND_SRC,
                    Laya.Shader3D.RENDER_STATE_BLEND_DST, Laya.Shader3D.RENDER_STATE_DEPTH_TEST, Laya.Shader3D.RENDER_STATE_DEPTH_WRITE;
                var n = Laya.Shader3D.add("RimColorShader", e, a, !0, !0), i = new Laya.SubShader(e, a);
                n.addSubShader(i);
                var r = i.addShaderPass(Da, La);
                r.renderState.blend = Laya.RenderState.BLEND_ENABLE_ALL, r.renderState.srcBlend = Laya.RenderState.BLENDPARAM_SRC_ALPHA,
                    r.renderState.dstBlend = Laya.RenderState.BLENDPARAM_ONE_MINUS_SRC_ALPHA, r.renderState.depthWrite = !0,
                    r.renderState.depthTest = Laya.RenderState.DEPTHTEST_LESS, Laya.ClassUtils.regClass("TY.RimColorMaterial", t);
            }
        }]), t;
    }(Laya.Material);
    ya.SHADER_DEF_RIMNORMALTEXTURE = Laya.Shader3D.getDefineByName("RIMNORMALTEXTURE");
    var Ra = function () {
        function e() {
            l(this, e);
        }
        return s(e, [{
            key: "init",
            value: function (e) {
                var a = this;
                this.config = e;
                var t = window.navigator.userAgent.match(/os\s+(\d+)/i);
                null != t && 15 == +t[1] && (Config.useWebGL2 = !1), window.Laya3D ? Laya3D.init(e.width, e.height) : Laya.init(e.width, e.height, Laya.WebGL),
                    Laya.Physics && Laya.Physics.enable(), Laya.DebugPanel && Laya.DebugPanel.enable(),
                    Laya.stage.scaleMode = e.scaleMode, Laya.stage.screenMode = e.screenMode, Laya.stage.alignV = e.alignV,
                    Laya.stage.alignH = e.alignH, Config3D.useCannonPhysics = e.useCannon, Laya.URL.exportSceneToJson = !0,
                    e.showStat && Laya.Stat.show(0, 60), Laya.MouseManager.multiTouchEnabled = e.multiTouchEnabled;
                var n = "";
                if (e.productMode == TY.ProductMode.Publish && (e.cdnUrl && (Laya.URL.basePath = e.cdnUrl,
                    n = "?v=" + Date.now().toString()), e.whitelist)) {
                    var i = e.whitelist;
                    i && i.length && (Laya.MiniAdpter && (Laya.MiniAdpter.nativefiles = i),
                        Laya.BMiniAdapter && (Laya.BMiniAdapter.nativefiles = i),
                        Laya.BLMiniAdapter && (Laya.BLMiniAdapter.nativefiles = i),
                        Laya.HWMiniAdapter && (Laya.HWMiniAdapter.nativefiles = i),
                        Laya.KGMiniAdapter && (Laya.KGMiniAdapter.nativefiles = i),
                        Laya.QGMiniAdapter && (Laya.QGMiniAdapter.nativefiles = i),
                        Laya.QQMiniAdapter && (Laya.QQMiniAdapter.nativefiles = i),
                        Laya.TBMiniAdapter && (Laya.TBMiniAdapter.nativefiles = i),
                        Laya.TTMiniAdapter && (Laya.TTMiniAdapter.nativefiles = i,
                            Laya.TTMiniAdapter.autoCacheFile = !0),
                        Laya.VVMiniAdapter && (Laya.VVMiniAdapter.nativefiles = i),
                        Laya.ALIMiniAdapter && (Laya.ALIMiniAdapter.nativefiles = i));
                }
                this.initEngineExt(), Laya.ResourceVersion.enable("version.json" + n, Laya.Handler.create(this, function () {
                    a.initFramework(e);
                }), Laya.ResourceVersion.FILENAME_VERSION);
            }
        }, {
            key: "initEngineExt",
            value: function () {
                this.initClass(),
                    e.initUtils(),
                    e.initRender(),
                    this.initPhysics();
            }
        }, {
            key: "initPhysics",
            value: function () {
                var e = window.TY;
                Laya.Physics3D._enablePhysics && e.Physics && e.Physics.PhysicsComUtil.init(this.config.layerCollisionMatrix),
                    Laya.Physics3D._cannon && Config3D.useCannonPhysics && e.Cannon && e.Cannon.CannonUtils.init(this.config.layerCollisionMatrix),
                    e.P2Utils && TY.P2Utils.P2PhysicsSettings.enable && e.P2Utils && e.P2Utils.init();
            }
        }, {
            key: "initClass",
            value: function () {
                if (this.config.regLayaClass) for (var e in this.config.regLayaClass) if (Object.prototype.hasOwnProperty.call(this.config.regLayaClass, e)) {
                    var a = this.config.regLayaClass[e];
                    Laya.ClassUtils.regClass(e, a);
                }
            }
        }, {
            key: "beforeBootstrap",
            value: function (e) { }
        }, {
            key: "onStartCompleted",
            value: function () { }
        }, {
            key: "initFramework",
            value: function (e) {
                this.application = this.createApp(e), this.application.instance(I.IConfig, e), this.application.on(TY.ApplicationEvents.OnStartCompleted, this.onStartCompleted, this),
                    this.application.bootstrap([new Y(e)]), this.application.init();
            }
        }, {
            key: "createApp",
            value: function (e) {
                return new ne(e.debugLevel);
            }
        }], [{
            key: "initRender",
            value: function () {
                Laya.Shader3D.addInclude("TYPBSCore.glsl", Ea), qe.__initDefine__(), ua.__init__(),
                    da.__init__(), Xe.__initDefine__(), ia.__init__(), na.__init__(), aa.__init__(),
                    ca.__init__(), Sa.__init__(), Je.__init__(), ra.__initDefine__(), la.__initDefine__(),
                    sa.__initDefine__(), oa.__initDefine__(), Ta.__init__(), ya.__init__(), me.regHierarchyResGet("SpriteRenderer3D", function (e, a, t, n, i, r, o, s) {
                        var l = e.props;
                        l.material && (l.material = me.addHierarchyInnerUrls(t, r, o, s, l.material, Laya3D.MATERIAL));
                    }), me.regSprite3DType("SpriteRenderer3D", function () {
                        return new fa();
                    });
            }
        }, {
            key: "initUtils",
            value: function () {
                Ae(), Laya.ClassUtils.regClass("TY.Label3d", ie), Laya.ClassUtils.regClass("AnimatorEventListener", Ee),
                    Laya.ClassUtils.regClass("CollisionTriggerListener", Se), Laya.ClassUtils.regClass("BezierCurvesComponent", Fe),
                    Laya.ClassUtils.regClass("ExplosionScript", Ne);
            }
        }]), e;
    }(), ma = Object.freeze({
        __proto__: null,
        GameServer: R
    }), ga = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.call(this)).loadInfos = [], e;
        }
        return s(t, [{
            key: "addRes",
            value: function (e) {
                var a = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], t = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null, n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null;
                return -1 == this.loadInfos.findIndex(function (a) {
                    return a.url == e;
                }) && this.loadInfos.push({
                    url: e,
                    isKeepMemory: a,
                    params: t,
                    propertyParams: n
                }), this;
            }
        }, {
            key: "onTaskStart",
            value: function () {
                this.loadInfos.length > 0 ? Q.loadRes(this.loadInfos, this.loaded.bind(this), this.onProgress.bind(this)) : this.loaded();
            }
        }, {
            key: "loaded",
            value: function () {
                this.finish();
            }
        }, {
            key: "onProgress",
            value: function (e) {
                this.mProgress = e;
            }
        }, {
            key: "isRunning",
            get: function () {
                return !1;
            }
        }, {
            key: "onProcess",
            value: function (e) {
                return n(i(t.prototype), "onProcess", this).call(this, e);
            }
        }]), t;
    }(TY.Task.Task), pa = function () {
        function e(a) {
            l(this, e), this.fileName = a;
        }
        return s(e, [{
            key: "load",
            value: function (e, a) {
                var t = this;
                fgui.UIPackage.loadPackage(this.fileName, Laya.Handler.create(this, function () {
                    t.loaded = !0, e.call(a);
                }));
            }
        }]), e;
    }(), Ia = function (e) {
        r(t, e);
        var a = o(t);
        function t(e) {
            var n;
            return l(this, t), (n = a.call(this)).uiRootUrl = e, n.addUISource(new pa(n.uiRootUrl + "/" + n.UIPack)),
                n;
        }
        return s(t, [{
            key: "UIPack",
            get: function () {
                return null;
            }
        }, {
            key: "url",
            get: function () {
                return "ui://".concat(this.UIPack, "/").concat(this.UICom);
            }
        }, {
            key: "showUI",
            value: function (e) {
                this.callback = e, this.show();
            }
        }, {
            key: "hideUI",
            value: function () {
                this.hideImmediately();
            }
        }, {
            key: "onInit",
            value: function () {
                var e = fgui.UIPackage.createObjectFromURL("ui://".concat(this.UIPack, "/").concat(this.UICom));
                if (null == e) throw new Error("创建窗口失败 [".concat(this.UIPack, "][").concat(this.UICom, "]"));
                if (this.contentPane = e.asCom, this.width = fairygui.GRoot.inst.width, this.height = fairygui.GRoot.inst.height,
                    this.centerOn(fgui.GRoot.inst, !0), null != this.mCloseBtnName && 0 != this.mCloseBtnName.length) {
                    var a = this.contentPane.getChild(this.mCloseBtnName);
                    a && (a.asCom || a.asButton) && (this.closeButton = a);
                }
            }
        }, {
            key: "doShowAnimation",
            value: function () {
                n(i(t.prototype), "doShowAnimation", this).call(this), this.callback && (this.callback(),
                    this.callback = null);
            }
        }, {
            key: "doHideAnimation",
            value: function () {
                n(i(t.prototype), "doHideAnimation", this).call(this);
            }
        }, {
            key: "setLoadData",
            value: function (e, a) {
                this.callback = e, this.data = a;
            }
        }]), t;
    }(fgui.Window), Pa = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.apply(this, arguments)).UICom = "QuitGameBoxBaseUI", e;
        }
        return s(t, [{
            key: "UIPack",
            get: function () {
                return "Protocol";
            }
        }, {
            key: "onCancel",
            value: function (e) {
                return this.cancelFunc = e, this;
            }
        }, {
            key: "onEnter",
            value: function (e) {
                return this.enterFunc = e, this;
            }
        }, {
            key: "onInit",
            value: function () {
                n(i(t.prototype), "onInit", this).call(this), this.contentPane.getChild("btnExit").onClick(this, this.onBtnExitClick),
                    this.contentPane.getChild("btnBack").onClick(this, this.onCancelClick);
            }
        }, {
            key: "onBtnExitClick",
            value: function () {
                TY.App.exit(), this.enterFunc && (this.enterFunc(), this.enterFunc = null);
            }
        }, {
            key: "onCancelClick",
            value: function () {
                this.cancelFunc && (this.cancelFunc(), this.cancelFunc = null), this.hideUI();
            }
        }]), t;
    }(Ia), va = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.apply(this, arguments)).UICom = "ProtocolContentUI", e.needServices = [I.IResource],
                e;
        }
        return s(t, [{
            key: "UIPack",
            get: function () {
                return "Protocol";
            }
        }, {
            key: "onCloseListener",
            value: function (e) {
                return this.closeListener = e, this;
            }
        }, {
            key: "onShowListener",
            value: function (e) {
                return this.showListener = e, this;
            }
        }, {
            key: "onInit",
            value: function () {
                var e = this;
                n(i(t.prototype), "onInit", this).call(this), this.userProtocolContent = this.contentPane.getChild("userProtocolContent").asLabel,
                    this.privacyProtoContent = this.contentPane.getChild("privacyProtoContent").asLabel,
                    this.contentPane.getChild("okbtn").onClick(this, function () {
                        e.hide();
                    }), this.resMgr.loadRes(this.userProtocolUrl, function (a) {
                        e.userProtocolContent.text = a;
                    }, null), this.resMgr.loadRes(this.privacyProtocolUrl, function (a) {
                        e.privacyProtoContent.text = a;
                    }, null);
            }
        }, {
            key: "onShown",
            value: function () {
                n(i(t.prototype), "onShown", this).call(this), this.userProtocolContent.visible = this.curType == d.user,
                    this.privacyProtoContent.visible = this.curType == d.privacy, this.showListener && (this.showListener(),
                        this.showListener = null);
            }
        }, {
            key: "onHide",
            value: function () {
                n(i(t.prototype), "onHide", this).call(this), this.closeListener && (this.closeListener(),
                    this.closeListener = null);
            }
        }, {
            key: "setType",
            value: function (e) {
                return this.curType = e, this;
            }
        }, {
            key: "onServiceSet",
            value: function (e) {
                this.resMgr = e;
            }
        }]), t;
    }(Ia), Aa = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.apply(this, arguments)).UICom = "ProtocolBoxUI", e;
        }
        return s(t, [{
            key: "UIPack",
            get: function () {
                return "Protocol";
            }
        }, {
            key: "onInit",
            value: function () {
                var e = this;
                n(i(t.prototype), "onInit", this).call(this);
                var a = TY.App.make(I.IConfig);
                this.contentPane.getChild("btnShiling").visible = !1, this.contentPane.getChild("btnShiling").onClick(this, this.onBtnShiling),
                    this.contentPane.getChild("comYinsi").asCom.getChild("content").asTextField.text = a.companyName;
                var r = this.contentPane.getChild("comYinsi").asCom.getChild("customBg"), o = this.contentPane.getChild("comYinsi").asCom.getChild("privacy").asTextField;
                r.visible = !(null == a.privacyDesc || 0 == a.privacyDesc.length), o.visible = !(null == a.privacyDesc || 0 == a.privacyDesc.length),
                    o.visible && (o.text = a.privacyDesc), this.contentPane.getChildByPath("comYinsi").asCom.getChild("btnyhxy").onClick(this, this.onYhxyClicked),
                    this.contentPane.getChildByPath("comYinsi").asCom.getChild("btnysxy").onClick(this, this.onYsxyClicked),
                    this.contentPane.getChildByPath("comYinsi").asCom.getChild("btnCancel").onClick(this, function () {
                        ee.show();
                    }), this.contentPane.getChildByPath("comYinsi").asCom.getChild("btnSure").onClick(this, function () {
                        t.AgreeProtocol = !0, e.hide();
                    });
            }
        }, {
            key: "showUI",
            value: function (e) {
                t.AgreeProtocol ? this.enterListener && (this.enterListener(), this.enterListener = null) : n(i(t.prototype), "showUI", this).call(this, e);
            }
        }, {
            key: "onShown",
            value: function () {
                n(i(t.prototype), "onShown", this).call(this);
            }
        }, {
            key: "onHide",
            value: function () {
                n(i(t.prototype), "onHide", this).call(this), this.enterListener && (this.enterListener(),
                    this.enterListener = null);
            }
        }, {
            key: "onYsxyClicked",
            value: function () {
                ae.show(d.privacy, null, null);
            }
        }, {
            key: "onYhxyClicked",
            value: function () {
                ae.show(d.user, null, null);
            }
        }, {
            key: "onEnterListener",
            value: function (e) {
                return this.enterListener = e, this;
            }
        }, {
            key: "onBtnShiling",
            value: function () {
                this.shilingListener && (this.shilingListener(), this.shilingListener = null);
            }
        }, {
            key: "onShilingListener",
            value: function (e) {
                return this.shilingListener = e, this;
            }
        }], [{
            key: "AgreeProtocol",
            get: function () {
                return "1" == localStorage.getItem("__AgreeProtocol");
            },
            set: function (e) {
                localStorage.setItem("__AgreeProtocol", e ? "1" : "0");
            }
        }]), t;
    }(Ia), Ca = function (e) {
        r(t, e);
        var a = o(t);
        function t() {
            var e;
            return l(this, t), (e = a.apply(this, arguments)).channel = T.None, e;
        }
        return s(t, [{
            key: "showVideo",
            value: function (e, a) {
                e && e();
            }
        }]), t;
    }(g), Oa = Object.freeze({
        __proto__: null,
        ProviderTween: C,
        Tween: A,
        ProviderResource: M,
        Resource: O,
        LoadResTask: ga,
        FixedUpdateRunner: B,
        LateUpdateRunner: k,
        StandardSchedulers: H,
        Task: function (e) {
            r(t, e);
            var a = o(t);
            function t() {
                return l(this, t), a.apply(this, arguments);
            }
            return s(t, [{
                key: "run",
                value: function () {
                    var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
                    e || (e = H.standardScheduler), n(i(t.prototype), "run", this).call(this, e);
                }
            }]), t;
        }(TY.Task.Task),
        UpdateMgr: w,
        UpdateRunner: b,
        ProviderSceneMgr: x,
        Scene: function () {
            function e() {
                l(this, e);
            }
            return s(e, [{
                key: "sceneTask",
                get: function () {
                    return this.loadTasks;
                }
            }, {
                key: "sceneUrl",
                get: function () {
                    return null;
                }
            }, {
                key: "onEnter",
                value: function (e) { }
            }, {
                key: "onExit",
                value: function () { }
            }, {
                key: "loadRes",
                value: function (e, a, t) {
                    this.loadTasks = new TY.Task.SerialTaskCollection(), this.loadResTask = new ga(),
                        this.sceneTask.addTask(this.loadResTask), this.sceneUrl && this.loadResTask.addRes(this.sceneUrl, !1),
                        this.onLoadRes(e), this.sceneTask.onComplete(function () {
                            a && a();
                        }).onUpdate(function (e) {
                            t && t(e);
                        }).run(H.standardScheduler);
                }
            }, {
                key: "addRes",
                value: function (e, a, t, n) {
                    return this.loadResTask.addRes(e, a, t, n), this;
                }
            }, {
                key: "addTask",
                value: function (e) {
                    return this.loadTasks.addTask(e), this;
                }
            }, {
                key: "onLoadRes",
                value: function (e) { }
            }]), e;
        }(),
        SceneMgr: N,
        LoadFGUIPackTask: function (e) {
            r(t, e);
            var a = o(t);
            function t(e) {
                var n;
                return l(this, t), (n = a.call(this)).packUrl = e, n;
            }
            return s(t, [{
                key: "onTaskStart",
                value: function () {
                    n(i(t.prototype), "onTaskStart", this).call(this), fgui.UIPackage.loadPackage(this.packUrl, new Laya.Handler(this, this.finish), new Laya.Handler(this, this.onLoadProgress));
                }
            }, {
                key: "onLoadProgress",
                value: function (e) {
                    this.mProgress = e;
                }
            }]), t;
        }(TY.Task.Task),
        LoadPackSource: pa,
        UIBase: Ia,
        UIMgr: F,
        ProviderUIMgr: G,
        QuitGameBoxBaseUI: Pa,
        ProviderQuitGameUIBase: function (e) {
            r(t, e);
            var a = o(t);
            function t() {
                var e, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : Pa;
                return l(this, t), (e = a.call(this)).mClass = null, e.mClass = n, e;
            }
            return s(t, [{
                key: "uiClass",
                get: function () {
                    return this.mClass;
                }
            }, {
                key: "register",
                value: function () {
                    n(i(t.prototype), "register", this).call(this);
                    var e = TY.App.make(I.IUIMgr).regUI(this.uiClass);
                    TY.App.instance(I.IQuickGameBoxUI, e);
                }
            }]), t;
        }(TY.ServiceProvider),
        ProtocolContentUIBase: va,
        ProviderProtocolContentUIBase: function (e) {
            r(t, e);
            var a = o(t);
            function t() {
                var e, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : va;
                return l(this, t), (e = a.call(this)).mClass = null, e.mClass = n, e;
            }
            return s(t, [{
                key: "uiClass",
                get: function () {
                    return this.mClass;
                }
            }, {
                key: "userProtocolUrl",
                get: function () {
                    return "res/yhxy.txt";
                }
            }, {
                key: "privacyProtocolUrl",
                get: function () {
                    return "res/ysxy.txt";
                }
            }, {
                key: "register",
                value: function () {
                    n(i(t.prototype), "register", this).call(this);
                    var e = TY.App.make(I.IUIMgr).regUI(this.uiClass);
                    e.userProtocolUrl = this.userProtocolUrl, e.privacyProtocolUrl = this.privacyProtocolUrl,
                        TY.App.instance(I.IProtocolContentUI, e, !0);
                }
            }]), t;
        }(TY.ServiceProvider),
        ProtocolBoxUIBase: Aa,
        ProviderProtocolBoxUI: function (e) {
            r(t, e);
            var a = o(t);
            function t() {
                var e, n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : Aa;
                return l(this, t), (e = a.call(this)).mClass = null, e.mClass = n, e;
            }
            return s(t, [{
                key: "uiClass",
                get: function () {
                    return this.mClass;
                }
            }, {
                key: "register",
                value: function () {
                    n(i(t.prototype), "register", this).call(this);
                    var e = TY.App.make(I.IUIMgr).regUI(this.uiClass);
                    TY.App.instance(I.IProtocolBoxUI, e);
                }
            }]), t;
        }(TY.ServiceProvider),
        ProviderSoundMgr: z,
        SoundMgr: W,
        ProviderSDKModel: function (e) {
            r(t, e);
            var a = o(t);
            function t() {
                return l(this, t), a.apply(this, arguments);
            }
            return s(t, [{
                key: "register",
                value: function () {
                    n(i(t.prototype), "register", this).call(this), TY.App.singleton(I.ISDKModel, y);
                }
            }]), t;
        }(TY.ServiceProvider),
        PCSDK: Ca,
        ProviderSDK: function (e) {
            r(t, e);
            var a = o(t);
            function t() {
                return l(this, t), a.apply(this, arguments);
            }
            return s(t, [{
                key: "register",
                value: function () {
                    n(i(t.prototype), "register", this).call(this), TY.App.singleton(I.ISDK, Ca);
                }
            }]), t;
        }(TY.ServiceProvider),
        ProviderSDKView: function (e) {
            r(t, e);
            var a = o(t);
            function t(e, n) {
                var i;
                return l(this, t), (i = a.call(this)).ViewClass = null, i.customServiceName = null,
                    i.ViewClass = e, i.customServiceName = n, i;
            }
            return s(t, [{
                key: "register",
                value: function () {
                    n(i(t.prototype), "register", this).call(this);
                    var e = new this.ViewClass();
                    e = TY.App.instance(I.ISDKView, e), this.customServiceName && this.customServiceName.trim().length > 0 && TY.App.alias(this.customServiceName, I.ISDKView);
                    for (var a = TY.App.make(I.IUIMgr), r = 0; r < e.ui.length; r++) a.regUI(e.ui[r]);
                    for (var o in e.regCom) fgui.UIObjectFactory.setExtension(o, e.regCom[o]);
                }
            }]), t;
        }(TY.ServiceProvider),
        ProviderSDKConfig: function (e) {
            r(t, e);
            var a = o(t);
            function t(e) {
                var n;
                return l(this, t), (n = a.call(this)).sdkcfg = e, n;
            }
            return s(t, [{
                key: "register",
                value: function () {
                    n(i(t.prototype), "register", this).call(this), TY.App.singleton(I.ISDKConfig, this.sdkcfg);
                }
            }]), t;
        }(TY.ServiceProvider)
    }), Ma = Object.freeze({
        __proto__: null,
        LayaExt: Me,
        BezierCurves: Ge,
        init: function () {
            Ae(), Laya.ClassUtils.regClass("TY.Label3d", ie), Laya.ClassUtils.regClass("AnimatorEventListener", Ee),
                Laya.ClassUtils.regClass("CollisionTriggerListener", Se), Laya.ClassUtils.regClass("BezierCurvesComponent", Fe),
                Laya.ClassUtils.regClass("ExplosionScript", Ne);
        },
        GameUtils: oe,
        RTCanvas: ce,
        AnimatorListener: Ee,
        CollisionTriggerListener: Se,
        ExplosionScript: Ne,
        Plane: function () {
            function e(a, t) {
                l(this, e), this.m_Distance = 0, this.m_Normal = new Laya.Vector3(), a.cloneTo(this.m_Normal),
                    this.m_Distance = Laya.Vector3.dot(this.m_Normal, t);
            }
            return s(e, [{
                key: "rayCast",
                value: function (e, a) {
                    var t = 0, n = Laya.Vector3.dot(e.direction, this.m_Normal);
                    return !oe.approximately(n, 0) && (t = (-Laya.Vector3.dot(e.origin, this.m_Normal) - this.m_Distance) / n,
                        a && (Laya.Vector3.scale(e.direction, t, a), Laya.Vector3.add(e.origin, a, a)),
                        t > 0);
                }
            }]), e;
        }()
    }), Na = Object.freeze({
        __proto__: null,
        init: function () {
            Laya.Shader3D.addInclude("TYPBSCore.glsl", Ea), qe.__initDefine__(), ua.__init__(),
                da.__init__(), Xe.__initDefine__(), ia.__init__(), na.__init__(), aa.__init__(),
                ca.__init__(), Sa.__init__(), Je.__init__(), ra.__initDefine__(), la.__initDefine__(),
                sa.__initDefine__(), oa.__initDefine__(), Ta.__init__(), ya.__init__(), me.regHierarchyResGet("SpriteRenderer3D", function (e, a, t, n, i, r, o, s) {
                    var l = e.props;
                    l.material && (l.material = me.addHierarchyInnerUrls(t, r, o, s, l.material, Laya3D.MATERIAL));
                }), me.regSprite3DType("SpriteRenderer3D", function () {
                    return new fa();
                });
        },
        BlinnPhongEmissionMaterial: Xe,
        GlitterMaterial: qe,
        PBRStandardDitheringFadeMaterial: Je,
        PBRStandardOutLineMaterial: aa,
        PBRStandardPlanarShadowMaterial: na,
        PBRStandardPlanarShadowOutLineMaterial: ia,
        SpriteMaskMaterial: oa,
        SpriteMaterial: ra,
        SpriteOutlineMaterial: sa,
        SpriteShadowMaterial: la,
        TYPBRSpecularMaterial: ua,
        TYPBRStandardMaterial: da,
        TYPBSStandardMaterial: ca,
        TYPBSStandardOutLineMaterial: Sa
    });
    u.API = v, u.Framework = Ra, u.Label3d = ie, u.Label3dTool = re, u.LayaApplication = ne,
        u.ProtocolBoxUI = te, u.ProtocolContentUI = ae, u.QuitGameBoxUI = ee, u.Render = Na,
        u.Resource = Q, u.SDK = Z, u.SDKModel = $, u.Scene = K, u.Server = ma, u.Services = Oa,
        u.Sound = J, u.Tween = j, u.UI = q, u.Utils = Ma,
        Object.defineProperty(u, "__esModule", {
            value: !0
        });
}(window.TY.LayaCore = window.TY.LayaCore || {});