Egret – WebGL下显示错误的问题

Canvas中setTransform

绘制一个矩形,通过 setTransform() 重置并创建新的变换矩阵,再次绘制矩形,重置并创建新的变换矩阵,然后再次绘制矩形。
setTransform() 允许您缩放、旋转、移动并倾斜当前的环境。


// a 表示水平旋转绘图
// b 表示水平倾斜绘图
// c 表示垂直倾斜绘图
// d 表示垂直缩放绘图
// e 表示水平移动绘图
// f 表示垂直移动绘图
context.setTransform(a,b,c,d,e,f);

drawTexture


/**
 * 绘制材质
 */
WebGLRenderContext.prototype.drawTexture = function (texture, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, destWidth, destHeight, textureWidth, textureHeight, meshUVs, meshVertices, meshIndices, bounds) {
    var buffer = this.currentBuffer;
    if (this.contextLost || !texture || !buffer) {
        return;
    }
    if (meshVertices && meshIndices) {
        if (this.vao.reachMaxSize(meshVertices.length / 2, meshIndices.length)) {
            this.$drawWebGL();
        }
    }
    else {
        if (this.vao.reachMaxSize()) {
            this.$drawWebGL();
        }
    }
    if (meshUVs) {
        this.vao.changeToMeshIndices();
    }
    var transform = buffer.globalMatrix;
    var alpha = buffer.globalAlpha;
    var count = meshIndices ? meshIndices.length / 3 : 2;
    // 应用$filter,因为只可能是colorMatrixFilter,最后两个参数可不传
    this.drawCmdManager.pushDrawTexture(texture, count, this.$filter);
    this.vao.cacheArrays(transform, alpha, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, destWidth, destHeight, textureWidth, textureHeight, meshUVs, meshVertices, meshIndices);
};

texture, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, destWidth, destHeight, textureWidth, textureHeight, meshUVs, meshVertices, meshIndices, bounds

欢迎留言

avatar
  Subscribe  
Notify of