v6 迁移指南
¥v6 Migration Guide
PixiJS 6 带来了一些表面层面的突破性变化。本文档并不完整。
¥PixiJS 6 comes with few surface-level breaking changes. This document is not complete.
类型
¥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
的正确同步统一,甚至更糟 - 获取空指针。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);