New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
even more type check for buffer pools #7214
Conversation
interface IPassViewType extends IBufferTypeManifest { | ||
[PassView.PRIORITY]: number; | ||
[PassView.STAGE]: RenderPassStage; | ||
[PassView.PHASE]: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
对于存放 Vec3, Mat4 类型的数据该怎么写呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那就取决于怎么用了,理论上这个 interface 只用于 set 和 get,所以应该声明成 number。
后面加的 setVec3 之类的可能要根据需求再另加类型检查
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那是不是 GeneralBufferElement 的类型得支持 Vec3 等类型呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该不用,因为 buffer element 是单个元素,这个类型不会跑出 number 和 handle 两种
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setVec3 等那边合了我再单独处理吧,估计还得再声明一个 interface
https://github.com/cocos-creator/3d-tasks/pull/4249
All types can now be automatically inferred except the following usage:
There are two options to properly declare the variable type in situations like this: