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

Update version -> 2.0 (#271) #272

Closed
wants to merge 39 commits into from
Closed

Update version -> 2.0 (#271) #272

wants to merge 39 commits into from

Conversation

lasalvavida
Copy link
Contributor

@lilleyse, @pjcozzi, this is the PR for merging 2.0 into master

* Added updateVersion stage as well as some refactoring

* Split out into multiple functions

* Cleaned up a few failing tests

* Added new upgrades to specs

* Application specific parameters are prefixed with underscores

* Migrated changes back from cesium

* Changed 1.1 to 2.0

* Lots of 1.0->2.0 changes in pipeline stages

* Tweaks from model generation

* Generate default material

* Add updateVersion to buildForCesium

* Select default scene

* A few more small changes

* Add removePipelineExtras to cesium build

* kmc fixes

* Build global cesium include

* Update

* Update CHANGES.md

* Added two more update functions

* Update CHANGES.md

* Strip version numbers when guessing if invalid

* WIP Array-based Traversal

* More WIP changes

* Removed combineMeshes -> nodes only have a singular mesh now

* Operator -> operate

* combineNodes, removeUnused and dagToTree traversal changes

* More WIP

* Bulk WIP changes for traversal

* Fixed a few more failing tests

* Removed findUsedIds

* WIP, switching workspaces

* WIP, pretty much just AO left

* Fixed a few more tests

* All tests pass

* Removed riggedSimpleUnoptimized

* Delete generateTangentsBitangents models

* Don't look for slots in array, just append

* Small fixes from testing

* More fixes

* A few test fixes and byteStride -> bufferView

* A few more test fixes

* Missed a function

* Removed vestigial byteStride references

* Some fixes from cesium changes

* Fixed cesium dependency list

* Fixed some plurality issues

* Add KHR_technique_webgl extensions if there are techniques
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.9%) to 91.952% when pulling 1406b32 on 2.0 into ce48e5f on master.

accessor.bufferView = accessor.extras._pipeline.bufferView;
// compute the total size for each arraybuffer type
ForEach.accessor(gltf, function (accessor) {
var bufferView = gltf.bufferViews[accessor.bufferView];

Choose a reason for hiding this comment

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

@lasalvavida I think in the most recent spec. Accessor doesn't have to have a bufferView property?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the review, @fanzhanggoogle! You are correct, see KhronosGroup/glTF#863

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fanzhanggoogle you are correct, however the only situation where an accessor doesn't have a bufferView property is if it is a sparse accessor. That isn't something that we support here yet, however a guard to make sure it is defined may be a good idea.

Choose a reason for hiding this comment

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

Yes, I agree with using a guard here. Just a note, cctually in the most recently 2.0 spec, there is:
"When nor sparse, neither bufferView is defined, min and max properties could have any values. This is intended for use cases when binary data is supplied by external means (e.g., via extensions)."
Which means bufferView could just be omitted.

accessorIds.push(accessorId);
}
}
var bufferViews = [{

Choose a reason for hiding this comment

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

In this file, it packs all the bufferViews if they are belong to an accessor and write over the original array of bufferViews. However, if there are some bufferViews are not belong to any accessor, e.g. is a property of an extension, then it won't work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fanzhanggoogle, that is a good point, but I'm not really sure how to work around it, since you'll have the same problem with the removeUnused functions as well. This is an optimization pipeline after all. I think the best solution we have is to support known extensions. So whichever extension specifies a bufferView will also be checked and added here.

If your example use case comes from the mesh compression you guys have been working on, I would be happy to add support based on an extension spec draft.

Choose a reason for hiding this comment

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

Sounds good! Thanks. I'm actually working on a branch to add support for the mesh compression extension in glTF-pipeline, I'll make a PR once it's done. It would be great to have you review it.
I agree with you that supporting known extension is enough here.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 3, 2017

@lilleyse, @pjcozzi, this is the PR for merging 2.0 into master

@lilleyse I most likely will not have time to review this so please merge when ready without me.

Copy link
Contributor

@lilleyse lilleyse left a comment

Choose a reason for hiding this comment

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

This has a lot of much needed cleanup in it! I plan on testing more thoroughly later.

Some other differences in the spec that should be handled:

  • JOINT and WEIGHT are now JOINTS_0 and WEIGHTS_0.
  • byteStride is now required
  • Empty arrays are disallowed now. There are probably corner cases throughout the code related to this.

function getAccessorByteStride(accessor) {
if (accessor.byteStride > 0) {
return accessor.byteStride;
function getAccessorByteStride(gltf, accessor) {
Copy link
Contributor

Choose a reason for hiding this comment

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

gltf is missing from the doc

@@ -44,6 +45,7 @@ function addCesiumRTC(gltf, options) {
extensions.CESIUM_RTC = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hidden from the diff:

     var extensions = gltf.extensions;
     if (!defined(extensions)) {
         extensions = {};
         gltf.extensions = extensions;
     }

I noticed a few others areas like this and thought it could benefit from a smaller helper file.

@@ -6,6 +6,7 @@ var Ellipsoid = Cesium.Ellipsoid;
var defaultValue = Cesium.defaultValue;
Copy link
Contributor

Choose a reason for hiding this comment

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

This file can use ForEach.technique and ForEach.techniqueParameters.

],
asset : {},
buffers : [
{
byteLength: 0,
type: 'arraybuffer'
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed.

],
asset : {},
buffers : [
{
byteLength: 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

byteLength now has a minimum of 1.

function glTF10to20(gltf) {
if (!defined(gltf.asset)) {
gltf.asset = {};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The check here and in gltf08to10 aren't required since asset is always created initially.

var skeletons = node.skeletons;
var skeletonsLength = skeletons.length;
if (skeletonsLength > 0) {
node.skeleton = globalMapping.nodes[skeletons[0]];
Copy link
Contributor

Choose a reason for hiding this comment

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

As noted before, skeleton is now part of skin.

if (topLevelId === 'animations') {
objectMapping = {};
object.samplers = objectToArray(object.samplers, objectMapping);
globalMapping[topLevelId].samplers = objectMapping;
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this handled below?

var bufferView = gltf.bufferViews[accessor.bufferView];
if (defined(bufferView.byteStride) && bufferView.byteStride !== byteStride) {
// another accessor uses this with a different byte stride
bufferView = clone(bufferView);
Copy link
Contributor

Choose a reason for hiding this comment

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

Bit of a nitpick, but in the case of the presence of an extras objects clone should be a deep clone.

var yfov = perspective.yfov;
if (defined(yfov) && yfov === 0.0) {
perspective.yfov = 1.0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 1.0?

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.9%) to 91.951% when pulling 8c909e8 on 2.0 into ce48e5f on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.9%) to 91.951% when pulling 5b04132 on 2.0 into ce48e5f on master.

@lilleyse
Copy link
Contributor

uninterleaveAndPackBuffers may need some further adjustments for byte alignment in 2.0:
#279 (comment)

@lilleyse lilleyse mentioned this pull request Jun 5, 2017
14 tasks
@fanzhanggoogle
Copy link

Hi @lilleyse @lasalvavida , I was wondering if the PR is still active. Which is the active glTF-pipeline repo for glTF2.0? Thanks!

@lilleyse
Copy link
Contributor

This PR hasn't been visibly active, but there is a separate pull request coming in here soon. A lot of the code here will also be used in Cesium for converting 1.0 models to 2.0.

Long term however, this PR will stay parked on a branch until a full cleanup is complete that puts gltf 2.0 first. The working branch for that is cleanup and will be ready a couple months from now.

@fanzhanggoogle
Copy link

Thanks. Good to know!

@lilleyse
Copy link
Contributor

lilleyse commented Aug 7, 2017

Closing - but the keeping the branch alive since this is the basis for Cesium's implementation. Development for 2.0 will now be on the cleanup branch.

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.

None yet

7 participants