"use strict";
cc._RF.push(module, 'faf27AoK/ZCOrghpYoEK7kY', 'bezier_render');
// OP13/script/bezier_render.ts

"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var bezier_assembler_1 = require("./bezier_assembler");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var BezierRender = /** @class */ (function (_super) {
    __extends(BezierRender, _super);
    function BezierRender() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.textureList = [];
        _this.pointsCount = 10;
        _this._initedMaterial = false;
        return _this;
    }
    BezierRender.prototype.onEnable = function () {
        _super.prototype.onEnable.call(this);
        this.init();
    };
    BezierRender.prototype.init = function () {
        if (!this._initedMaterial) {
            this.updateMaterial();
        }
        this.setVertsDirty();
    };
    BezierRender.prototype._resetAssembler = function () {
        var assembler = this._assembler = new bezier_assembler_1.default();
        assembler.init(this);
    };
    BezierRender.prototype._updateMaterial = function () {
        var material = this.getMaterial(0);
        if (material) {
            material.define('CC_USE_MODEL', 1);
            if (this.textureList.length === 2) {
                material.setProperty('texture0', this.textureList[0]);
                material.setProperty('texture1', this.textureList[1]);
            }
        }
    };
    BezierRender.prototype.updateMaterial = function () {
        if (this.textureList.length === 2) {
            this._updateMaterial();
            this._initedMaterial = true;
            return;
        }
    };
    BezierRender.prototype.getPointCount = function () {
        return this.pointsCount;
    };
    BezierRender.prototype.updateAngle = function (angle) {
        if (!this._assembler) {
            return;
        }
        this._assembler.angle = angle;
        this._assembler.updateRenderData(this);
    };
    __decorate([
        property({ type: [cc.Texture2D], displayName: "纹理" })
    ], BezierRender.prototype, "textureList", void 0);
    __decorate([
        property({ displayName: "每条边上的顶点数量" })
    ], BezierRender.prototype, "pointsCount", void 0);
    BezierRender = __decorate([
        ccclass
    ], BezierRender);
    return BezierRender;
}(cc.RenderComponent));
exports.default = BezierRender;

cc._RF.pop();