Skip to main content

v6 迁移指南

🌐 v6 Migration Guide

PixiJS 6 带来了一些表面上的重大更改。本文档不完整

类型

🌐 Typings

如果你正在使用 TypeScript,请确保在你的 tsconfig.json 中添加以下内容:

🌐 If you're using TypeScript, make sure the follow is added to your tsconfig.json:

{
"compilerOptions": {
"moduleResolution": "node",
// Required for importing 3rd-party dependencies like EventEmitter3
"esModuleInterop": true
}
}

网状内部结构

🌐 Mesh Internals

如果你曾经重写过 Mesh._renderDefault 来考虑更多像这样的统一变量:v5 参考

🌐 If you ever overrode Mesh._renderDefault to take into account more uniforms like this: v5 Reference

if (shader.program.uniformData.translationMatrix) {
shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);
}

删除 if,保留内容,否则你可能无法为 translationMatrix 获得正确的同步 uniform,甚至更糟 - 可能会得到空指针。v6 参考

🌐 Remove the if, leave the contents, otherwise you might not get correct sync uniform for translationMatrix, or even worse - get null pointer. v6 Reference.

shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);