-
Notifications
You must be signed in to change notification settings - Fork 250
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
Added removeUnusedVertices stage #50
Conversation
@tfili can you also take a quick look at this? For #1 (comment) |
Yes, I think when the end user builds a glTF pipeline they will just want to "remove unused vertices", even if it is implemented as two separate stages. As for the tests, it would even be fine to put all the tests in one file. Up to you. |
|
||
removeUnusedVertices(testGltf); | ||
|
||
delete testGltf.buffers.buffer_0.extras._pipeline.offset; |
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.
These two lines could go into an afterEach
function. Or replace the file-scoped gltf
variable with a function that returns the glTF object that is called in each function so we don't have to worry about managing state between each test.
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.
Actually, turns out I don't need these lines as I was using them in a test which I deleted.
Good start here! Nice tests. |
@tfili perhaps wait until this PR includes removing vertices not referenced by indices before reviewing. |
Cool. Hope it was fun!
You meant to remove the face, right? :) |
Yep, I did tests where I removed the top, side, and bottom face indices! They're in the spec as well. |
var bufferViews = gltf.bufferViews; | ||
var meshes = gltf.meshes; | ||
|
||
var primitives = []; |
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.
Is this array really needed? Couldn't the top-level for
loop in calculateIndexIntervals
be replaced with a loop like the one below?
@tfili this is ready. Can you also take a look at it? |
The tests look good! |
@tfili this is waiting on you. |
@pjcozzi Looks good to me. |
I think it's a good call to separate this into two stages, so this stage removes unused buffer data based on bufferViews, and the other stage will modify and split up bufferViews based on indices. Do you think I should keep both of these stages in the same file as private functions and just have two test files, or should I make a new lib file?