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

Backport changes from master to the 1.0 branch #163

Merged
merged 17 commits into from
Nov 1, 2018
Merged

Conversation

lilleyse
Copy link
Contributor

Includes fixes ported from #161 and #162. Also includes some fixes in loadObj that I noticed were in master but not the 1.0 branch.

@likangning93 likangning93 self-assigned this Oct 30, 2018
Copy link
Contributor

@likangning93 likangning93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lilleyse couple comments, but otherwise looks like it will work as-described when integrated with CesiumGS/gltf-pipeline#430.

break;
}
materialName = originalMaterialName + '-' + suffix++;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as in 163, splitting this out to a separate getUniqueId function seems more readable to me.

lib/loadObj.js Outdated
nodes = cleanNodes(nodes);
if (nodes.length === 0) {
return Promise.reject(new RuntimeError(objPath + ' does not have any geometry data'));
}
return loadMaterials(mtlPaths, objPath, options)
.then(function(materials) {
if (materials.length > 0 && !usesMaterials) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

materials here looks to be a dictionary instead of an array.

lib/loadObj.js Outdated
@@ -494,6 +514,23 @@ function getImagePaths(materials) {
return Object.keys(imagePaths);
}

function assignDefaultMaterial(nodes, materials) {
var defaultMaterial = materials[0].name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, looks like materials is an object. Maybe this pathway needs a separate spec? I only managed to get here with an obj that didn't usemtl but had a material library.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there's already a spec for this case but it's currently too permissive to catch the bug above + here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. I had brought over the functionality without bringing over the tests.

As I was looking at which tests needed to be brought over I noticed that a lot of PRs that made it into master never made it into 1.0. This PR kind of blew up because of that and I renamed the title accordingly...

The only PR I didn't bring over is #124 which is a lot more work than the others and isn't super common to see. The alpha texture would need to be written to the diffuse texture alpha channel which requires all the raw pixel reading/packing in master.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will also test all the obj models I have tomorrow to make sure nothing broke.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lilleyse lilleyse force-pushed the fixes-from-master branch 2 times, most recently from 971f1d7 to d721d4f Compare November 1, 2018 04:14
@lilleyse lilleyse changed the title Mixed attribute changes for the 1.0 branch Backport changes from master to the 1.0 branch Nov 1, 2018
@likangning93 likangning93 merged commit c2cb2e9 into 1.0 Nov 1, 2018
@likangning93 likangning93 deleted the fixes-from-master branch November 1, 2018 13:42
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.

2 participants