"use strict";
cc._RF.push(module, '63638rOyKFPQIApyU2KNZEs', 'BFSRenderCompon');
// Script/BFSRenderCompon.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 BFSAssembler_1 = require("./BFSAssembler");
var _a = cc._decorator, ccclass = _a.ccclass, menu = _a.menu, disallowMultiple = _a.disallowMultiple;
//@ts-ignore
var RenderFlow = cc.RenderFlow;
var BFSRenderCompon = /** @class */ (function (_super) {
    __extends(BFSRenderCompon, _super);
    function BFSRenderCompon() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this._vertsDirty = true;
        _this._assembler = null;
        return _this;
    }
    BFSRenderCompon.prototype._resetAssembler = function () {
        //console.warn('_resetAssembler');
        this._assembler = new BFSAssembler_1.default();
        this._assembler.init(this);
        //this._updateColor();
        this.setVertsDirty();
    };
    BFSRenderCompon.prototype.__preload = function () {
        this._resetAssembler();
    };
    BFSRenderCompon.prototype.onEnable = function () {
        //@ts-ignore
        var renderCompon = this.node._renderComponent;
        if (renderCompon) {
            renderCompon.enabled = false;
        }
        //@ts-ignore
        this.node._renderComponent = this;
        //@ts-ignore
        this.node._renderFlag |= cc.RenderFlow.FLAG_OPACITY_COLOR;
        this.setVertsDirty();
        if (!CC_EDITOR && !CC_NATIVERENDERER) {
            //@ts-ignore
            this.node._renderFlag |= cc.RenderFlow.FLAG_POST_RENDER;
        }
    };
    BFSRenderCompon.prototype.onDisable = function () {
        //@ts-ignore
        this.node._renderComponent = null;
        this.disableRender();
    };
    BFSRenderCompon.prototype.setVertsDirty = function () {
        this._vertsDirty = true;
        this.markForRender(true);
    };
    BFSRenderCompon.prototype.markForValidate = function () {
        RenderFlow.registerValidate(this);
    };
    BFSRenderCompon.prototype.markForRender = function (enable) {
        //@ts-ignore
        var flag = RenderFlow.FLAG_RENDER | RenderFlow.FLAG_UPDATE_RENDER_DATA;
        if (enable) {
            //@ts-ignore
            this.node._renderFlag |= flag;
            this.markForValidate();
        }
        else {
            //@ts-ignore
            this.node._renderFlag &= ~flag;
        }
    };
    BFSRenderCompon.prototype.disableRender = function () {
        //@ts-ignore
        this.node._renderFlag &= ~(RenderFlow.FLAG_RENDER | RenderFlow.FLAG_UPDATE_RENDER_DATA);
    };
    BFSRenderCompon.prototype._on3DNodeChanged = function () {
        this._resetAssembler();
    };
    BFSRenderCompon.prototype._updateColor = function () {
    };
    BFSRenderCompon.prototype._checkBacth = function (renderer, cullingMask) {
    };
    BFSRenderCompon.prototype._validateRender = function () {
    };
    BFSRenderCompon = __decorate([
        ccclass,
        disallowMultiple,
        menu("引擎扩展/渲染扩展/BFS渲染 BFSRenderCompon")
    ], BFSRenderCompon);
    return BFSRenderCompon;
}(cc.Component));
exports.default = BFSRenderCompon;

cc._RF.pop();