Skip to content
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

Merged
merged 6 commits into from
May 20, 2016
Merged

Added removeUnusedVertices stage #50

merged 6 commits into from
May 20, 2016

Conversation

leerichard42
Copy link
Contributor

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?

@pjcozzi
Copy link
Contributor

pjcozzi commented May 13, 2016

@tfili can you also take a quick look at this? For #1 (comment)

@pjcozzi
Copy link
Contributor

pjcozzi commented May 13, 2016

Do you think I should keep both of these stages in the same file as private functions and just have two test files?

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;
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 13, 2016

Good start here! Nice tests.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 13, 2016

@tfili perhaps wait until this PR includes removing vertices not referenced by indices before reviewing.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 91.433% when pulling 16b2ac5 on removeUnusedVertices into 09c7f72 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.1%) to 92.27% when pulling c921345 on removeUnusedVertices into 09c7f72 on master.

@leerichard42
Copy link
Contributor Author

leerichard42 commented May 16, 2016

Updated - the index stage was tough!

Here's an image of the box with a removed face:
image

@pjcozzi
Copy link
Contributor

pjcozzi commented May 17, 2016

Updated - the index stage was tough!

Cool. Hope it was fun!

Here's an image of the box with a removed face:

You meant to remove the face, right? :)

@leerichard42
Copy link
Contributor Author

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 = [];
Copy link
Contributor

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?

@pjcozzi
Copy link
Contributor

pjcozzi commented May 17, 2016

@tfili this is ready. Can you also take a look at it?

@pjcozzi
Copy link
Contributor

pjcozzi commented May 17, 2016

Yep, I did tests where I removed the top, side, and bottom face indices! They're in the spec as well.

The tests look good!

@coveralls
Copy link

Coverage Status

Coverage increased (+1.2%) to 92.318% when pulling 5d26fa4 on removeUnusedVertices into 09c7f72 on master.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 20, 2016

@tfili this is waiting on you.

@tfili
Copy link

tfili commented May 20, 2016

@pjcozzi Looks good to me.

@pjcozzi pjcozzi merged commit 3db3306 into master May 20, 2016
@pjcozzi pjcozzi deleted the removeUnusedVertices branch May 20, 2016 19:44
@pjcozzi pjcozzi mentioned this pull request May 20, 2016
1 task
@pjcozzi pjcozzi mentioned this pull request Jun 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants