-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Convert Mesh to TypeScript #6382
Conversation
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.
Good job! Oh wait, its draft...
@@ -399,7 +427,7 @@ export class Mesh extends Container | |||
} | |||
else | |||
{ | |||
this.uvs = geomUvs.data; | |||
this.uvs = geomUvs.data as Float32Array; |
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.
We can use ITypedArray
in such places in future, but its fine to convert it if we know certain type.
@@ -477,20 +505,21 @@ export class Mesh extends Container | |||
this.geometry.dispose(); | |||
} | |||
|
|||
this.geometry = null; | |||
(this as any).geometry = null; |
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.
@eXponenta changed geometry to private field + readonly prop, but for destroy
both ways are fine and I want to underline that by approving this PR :)
/** | ||
* @param {Float32Array|number[]} vertices - Positional data on geometry. | ||
* @param {Float32Array|number[]} uvs - Texture UVs. | ||
* @param {Uint16Array|number[]} index - IndexBuffer | ||
*/ | ||
constructor(vertices, uvs, index) | ||
constructor(vertices: IArrayBuffer, uvs: IArrayBuffer, index: IArrayBuffer) |
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.
yay! That's why I created IArrayBuffer.
@ivanpopelyshev I do have a question for this pr. Inside |
Codecov Report
@@ Coverage Diff @@
## dev #6382 +/- ##
=========================================
- Coverage 74.84% 74.64% -0.2%
=========================================
Files 81 78 -3
Lines 4401 4355 -46
=========================================
- Hits 3294 3251 -43
+ Misses 1107 1104 -3 Continue to review full report at Codecov.
|
Description of change
Converts Mesh to TypeScript. Nice and simple
Pre-Merge Checklist
npm run lint
)npm run test
)