Egret Engine 5.3.10 版本发布,主要修复基于 iOS14 系统的卡顿问题

栏目: 软件资讯 · 发布时间: 4年前

内容简介:今天Egret Engine5.3.10版正式发布,主要内容是修复iOS14 系统上 mesh 卡顿、htmlsound 声音挂载到后台后无法返回以及龙骨模型显示异常三个问题。 截至目前,虽然Egret Engine5.3系列依然属测试版,但产品功能已趋...

今天Egret Engine5.3.10版正式发布,主要内容是修复iOS14 系统上 mesh 卡顿、htmlsound 声音挂载到后台后无法返回以及龙骨模型显示异常三个问题。

截至目前,虽然Egret Engine5.3系列依然属测试版,但产品功能已趋于稳定,建议有卡顿问题的开发者升级处理!

如若您的上线项目使用的是Egret Engine 5.2系列的稳定版,且不想升级引擎版本解决卡顿问题,我们为您提供了第二套解决方案,需要您在Egret Engine 5.2.X版本中手动修改以下2个位置的代码:

位置1:WebGLVertexArrayObject.ts

cacheArrays方法

.......

            if (meshVertices) {
                let vertData = [];
                // 计算索引位置与赋值
                const vertices = this.vertices;
                const verticesUint32View = this._verticesUint32View;
                let index = this.vertexIndex * this.vertSize;
                // 缓存顶点数组
                let i = 0, iD = 0, l = 0;
                let u = 0, v = 0, x = 0, y = 0;
                for (i = 0, l = meshUVs.length; i < l; i += 2) {
                    iD = index + i * 5 / 2;
                    x = meshVertices[i];
                    y = meshVertices[i + 1];
                    u = meshUVs[i];
                    v = meshUVs[i + 1];

                    if (rotated) {
                        vertData.push([
                            a * x + c * y + tx,
                            b * x + d * y + ty,
                            (sourceX + (1.0 - v) * sourceHeight) / textureSourceWidth,
                            (sourceY + u * sourceWidth) / textureSourceHeight,
                        ]);
                    } else {
                        vertData.push([
                            a * x + c * y + tx,
                            b * x + d * y + ty,
                            (sourceX + u * sourceWidth) / textureSourceWidth,
                            (sourceY + v * sourceHeight) / textureSourceHeight,
                        ]);
                    }
                    verticesUint32View[iD + 4] = alpha;
                }
                for (let i = 0; i < meshIndices.length; i += 3) {
                    let data0 = vertData[meshIndices[i]];
                    vertices[index++] = data0[0];
                    vertices[index++] = data0[1];
                    vertices[index++] = data0[2];
                    vertices[index++] = data0[3];
                    verticesUint32View[index++] = alpha;

                    let data1 = vertData[meshIndices[i + 1]];
                    vertices[index++] = data1[0];
                    vertices[index++] = data1[1];
                    vertices[index++] = data1[2];
                    vertices[index++] = data1[3];
                    verticesUint32View[index++] = alpha;

                    let data2 = vertData[meshIndices[i + 2]];
                    vertices[index++] = data2[0];
                    vertices[index++] = data2[1];
                    vertices[index++] = data2[2];
                    vertices[index++] = data2[3];
                    verticesUint32View[index++] = alpha;

                    // 填充数据
                    vertices[index++] = data2[0];
                    vertices[index++] = data2[1];
                    vertices[index++] = data2[2];
                    vertices[index++] = data2[3];
                    verticesUint32View[index++] = alpha;
                }

                let meshNum = meshIndices.length / 3;
                this.vertexIndex += 4 * meshNum;
                this.indexIndex += 6 * meshNum;

            } else {
              ......

位置2:WebGLRenderContext.ts

drawTexture方法

   let buffer = this.currentBuffer;
            if (this.contextLost || !texture || !buffer) {
                return;
            }

            let meshNum = meshIndices && (meshIndices.length / 3) || 0;
            if (meshIndices) {
                if (this.vao.reachMaxSize(meshNum * 4, meshNum * 6)) {
                    this.$drawWebGL();
                }
            } else {
                if (this.vao.reachMaxSize()) {
                    this.$drawWebGL();
                }
            }

            if (smoothing != undefined && texture["smoothing"] != smoothing) {
                this.drawCmdManager.pushChangeSmoothing(texture, smoothing);
            }

            // if (meshUVs) {
            //     this.vao.changeToMeshIndices();
            // }

            let count = meshIndices ? meshNum * 2 : 2;
            .........

以上2种方案均可解决基于iOS14系统带来的卡顿问题,大家可根据项目情况自行选择。


以上所述就是小编给大家介绍的《Egret Engine 5.3.10 版本发布,主要修复基于 iOS14 系统的卡顿问题》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Head First Web Design

Head First Web Design

Ethan Watrall、Jeff Siarto / O’Reilly Media, Inc. / 2009-01-02 / USD 49.99

Want to know how to make your pages look beautiful, communicate your message effectively, guide visitors through your website with ease, and get everything approved by the accessibility and usability ......一起来看看 《Head First Web Design》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具