laya-coreui-es
Version:
laya核心库、ui库es版本,剔除了媒体、TTF等功能。基于 LayaAir-release_2.12.0 修改
44 lines (43 loc) • 1.64 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DrawTrianglesCmd = void 0;
const ColorFilter_1 = require("../../filters/ColorFilter");
const ColorUtils_1 = require("../../utils/ColorUtils");
const Pool_1 = require("../../utils/Pool");
class DrawTrianglesCmd {
static create(texture, x, y, vertices, uvs, indices, matrix, alpha, color, blendMode, colorNum) {
var cmd = Pool_1.Pool.getItemByClass("DrawTrianglesCmd", DrawTrianglesCmd);
cmd.texture = texture;
cmd.x = x;
cmd.y = y;
cmd.vertices = vertices;
cmd.uvs = uvs;
cmd.indices = indices;
cmd.matrix = matrix;
cmd.alpha = alpha;
if (color) {
cmd.color = new ColorFilter_1.ColorFilter();
var c = ColorUtils_1.ColorUtils.create(color).arrColor;
cmd.color.color(c[0] * 255, c[1] * 255, c[2] * 255, c[3] * 255);
}
cmd.blendMode = blendMode;
cmd.colorNum = colorNum;
return cmd;
}
recover() {
this.texture = null;
this.vertices = null;
this.uvs = null;
this.indices = null;
this.matrix = null;
Pool_1.Pool.recover("DrawTrianglesCmd", this);
}
run(context, gx, gy) {
context.drawTriangles(this.texture, this.x + gx, this.y + gy, this.vertices, this.uvs, this.indices, this.matrix, this.alpha, this.color, this.blendMode, this.colorNum);
}
get cmdID() {
return DrawTrianglesCmd.ID;
}
}
exports.DrawTrianglesCmd = DrawTrianglesCmd;
DrawTrianglesCmd.ID = "DrawTriangles";