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 #191

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
a5f1ad8
Added updateVersion stage as well as some refactoring
lasalvavida Dec 5, 2016
74c6635
Merge branch 'master' of https://github.com/AnalyticalGraphicsInc/glt…
lasalvavida Dec 5, 2016
b4ff281
Split out into multiple functions
lasalvavida Dec 14, 2016
96160e5
Merge branch 'master' of https://github.com/AnalyticalGraphicsInc/glt…
lasalvavida Dec 14, 2016
318d2b8
Cleaned up a few failing tests
lasalvavida Dec 14, 2016
77cd995
Added new upgrades to specs
lasalvavida Dec 14, 2016
6478c98
Application specific parameters are prefixed with underscores
lasalvavida Dec 14, 2016
1ef43e3
Merge branch 'master' of github.com:AnalyticalGraphicsInc/gltf-pipeli…
Jan 17, 2017
cf697a9
Merge branch 'updateVersion' of github.com:AnalyticalGraphicsInc/gltf…
Jan 17, 2017
a6db842
Migrated changes back from cesium
Jan 17, 2017
439f0fa
Merge branch 'master' of github.com:AnalyticalGraphicsInc/gltf-pipeli…
Jan 25, 2017
611d148
Merge branch 'cleanup-add-defaults' of github.com:AnalyticalGraphicsI…
Jan 25, 2017
e882790
Changed 1.1 to 2.0
Jan 25, 2017
d2cb44c
Merge branch 'master' of github.com:AnalyticalGraphicsInc/gltf-pipeli…
Jan 25, 2017
e88fd50
Lots of 1.0->2.0 changes in pipeline stages
Jan 25, 2017
f2557af
Tweaks from model generation
Jan 26, 2017
3d35c21
Generate default material
Jan 26, 2017
7f8ad7c
Add updateVersion to buildForCesium
Jan 26, 2017
ed61ae7
Select default scene
Jan 26, 2017
7ee3137
A few more small changes
Jan 26, 2017
7b63d22
Add removePipelineExtras to cesium build
Jan 26, 2017
a76c503
kmc fixes
Jan 26, 2017
d8337e1
Build global cesium include
Jan 26, 2017
9bb2d3c
Update
Jan 26, 2017
01b3140
Update CHANGES.md
Jan 26, 2017
3bc06ba
Added two more update functions
Jan 26, 2017
6d58407
Update CHANGES.md
pjcozzi Jan 26, 2017
0d6e895
Strip version numbers when guessing if invalid
Jan 27, 2017
99c98e2
Merge branch 'updateVersion' of github.com:AnalyticalGraphicsInc/gltf…
Jan 27, 2017
843a480
WIP Array-based Traversal
Feb 14, 2017
9f4b12b
More WIP changes
Feb 14, 2017
dee1009
Removed combineMeshes -> nodes only have a singular mesh now
Feb 14, 2017
c9f79c4
Merge branch 'master' of github.com:AnalyticalGraphicsInc/gltf-pipeli…
Feb 15, 2017
2ac3bfd
Operator -> operate
Feb 15, 2017
2ec8545
combineNodes, removeUnused and dagToTree traversal changes
Feb 15, 2017
29e21f2
More WIP
Feb 15, 2017
9ad94f3
Bulk WIP changes for traversal
lasalvavida Feb 17, 2017
f952bc0
Merge branch 'master' of https://github.com/AnalyticalGraphicsInc/glt…
lasalvavida Mar 3, 2017
4c884d5
Fixed a few more failing tests
lasalvavida Mar 3, 2017
13aa73d
Removed findUsedIds
lasalvavida Mar 10, 2017
b5d8002
WIP, switching workspaces
lasalvavida Mar 20, 2017
6427738
WIP, pretty much just AO left
Mar 21, 2017
af0a51a
Fixed a few more tests
Mar 21, 2017
a4a0331
All tests pass
Mar 21, 2017
94ee8e5
Removed riggedSimpleUnoptimized
Mar 21, 2017
d75085e
Delete generateTangentsBitangents models
Mar 21, 2017
37b97c0
Merge branch 'master' of github.com:AnalyticalGraphicsInc/gltf-pipeli…
Mar 21, 2017
9fc99cc
Don't look for slots in array, just append
Mar 21, 2017
d172439
Small fixes from testing
Mar 21, 2017
d4ccb41
More fixes
Mar 21, 2017
edee467
A few test fixes and byteStride -> bufferView
Mar 21, 2017
2e7519e
A few more test fixes
Mar 21, 2017
684c272
Missed a function
Mar 21, 2017
d426433
Removed vestigial byteStride references
Mar 21, 2017
a35e5f7
Some fixes from cesium changes
Mar 22, 2017
7492f57
Fixed cesium dependency list
Mar 22, 2017
ab6daee
Fixed some plurality issues
Apr 2, 2017
34d1c67
Add KHR_technique_webgl extensions if there are techniques
Apr 2, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Change Log
* Change Cesium `Geometry`'s and `VertexFormat`'s `binormal` attribute to bitangent.
* Fixed a bug in `combinePrimitives` where combining primitives can overflow uint16 for the resulting indices. [#230](https://github.com/AnalyticalGraphicsInc/gltf-pipeline/issues/230)
* Made `generateNormals` stage optional and added `smoothNormals` option for generating smooth normals if the model does not have normals. [#240](https://github.com/AnalyticalGraphicsInc/gltf-pipeline/pull/240)
* `updateVersion` stage for upgrades the glTF version of an asset from `1.0` to `2.0`. [#223](https://github.com/AnalyticalGraphicsInc/gltf-pipeline/pull/223)
* All pipeline stages now operate on glTF `2.0` assets.

### 0.1.0-alpha10 - 2017-01-10
* Added `tangentsBitangents` generation option
Expand Down
26 changes: 18 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,17 @@ function amdify(source, subDependencyMapping) {
paths.push(requireMapping[variable]);
}
}
var definePathsHeader = '\'' + paths.join('\',\n \'') + '\'';
var defineVariablesHeader = variables.join(',\n ');
var defineHeader = '/*global define*/\n' +
'define([\n' +
' ' + definePathsHeader + '\n' +
' ], function(\n' +
' ' + defineVariablesHeader + ') {\n ';
'define([], function() {\n ';
if (paths.length > 0) {
var definePathsHeader = '\'' + paths.join('\',\n \'') + '\'';
var defineVariablesHeader = variables.join(',\n ');
defineHeader = '/*global define*/\n' +
'define([\n' +
' ' + definePathsHeader + '\n' +
' ], function(\n' +
' ' + defineVariablesHeader + ') {\n ';
}
var defineFooter = '\n});\n';
if (defined(returnValue)) {
defineFooter = '\n return ' + returnValue + ';' + defineFooter;
Expand Down Expand Up @@ -273,17 +277,23 @@ gulp.task('build-cesium', function () {
var outputDir = 'dist/cesium';
var files = [
'addDefaults.js',
'addExtensionsRequired.js',
'addExtensionsUsed.js',
'addPipelineExtras.js',
'addToArray.js',
'byteLengthForComponentType.js',
'findAccessorMinMax.js',
'ForEach.js',
'getAccessorByteStride.js',
'getStatistics.js',
'getUniqueId.js',
'numberOfComponentsForType.js',
'parseBinaryGltf.js',
'processModelMaterialsCommon.js',
'techniqueParameterForSemantic.js'
'removePipelineExtras.js',
'removeExtensionsRequired.js',
'removeExtensionsUsed.js',
'techniqueParameterForSemantic.js',
'updateVersion.js'
];
var subDependencyMapping = {
cesium : {
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module.exports = {
AccessorReader : require('./lib/AccessorReader'),
addCesiumRTC : require('./lib/addCesiumRTC'),
addDefaults : require('./lib/addDefaults'),
addExtensionsRequired : require('./lib/addExtensionsRequired'),
addExtensionsUsed : require('./lib/addExtensionsUsed'),
addPipelineExtras : require('./lib/addPipelineExtras'),
bakeAmbientOcclusion : require('./lib/bakeAmbientOcclusion'),
Expand Down Expand Up @@ -41,6 +42,7 @@ module.exports = {
removeUnusedVertices : require('./lib/removeUnusedVertices'),
triangleAxisAlignedBoundingBoxOverlap : require('./lib/triangleAxisAlignedBoundingBoxOverlap'),
uninterleaveAndPackBuffers : require('./lib/uninterleaveAndPackBuffers'),
updateVersion : require('./lib/updateVersion'),
writeAccessor : require('./lib/writeAccessor'),
writeBinaryGltf : require('./lib/writeBinaryGltf'),
writeBufferComponent : require('./lib/writeBufferComponent'),
Expand Down
10 changes: 6 additions & 4 deletions lib/AccessorReader.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
'use strict';
var Cesium = require('cesium');
var defaultValue = Cesium.defaultValue;

var byteLengthForComponentType = require('./byteLengthForComponentType');
var getAccessorByteStride = require('./getAccessorByteStride');
var numberOfComponentsForType = require('./numberOfComponentsForType');
var readBufferComponent = require('./readBufferComponent');
var writeBufferComponent = require('./writeBufferComponent');

var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;

module.exports = AccessorReader;

/**
Expand All @@ -32,8 +33,9 @@ function AccessorReader(gltf, accessor) {
var buffer = buffers[bufferId];

this.accessor = accessor;
this.bufferView = bufferView;
this.byteOffset = accessor.byteOffset + bufferView.byteOffset;
this.byteStride = getAccessorByteStride(accessor);
this.byteStride = getAccessorByteStride(gltf, accessor);
this.componentType = accessor.componentType;
this.numberOfComponents = numberOfComponentsForType(accessor.type);
this.count = accessor.count;
Expand Down Expand Up @@ -85,7 +87,7 @@ AccessorReader.prototype.write = function(data, componentType, dataOffset) {
dataOffset = defaultValue(dataOffset, 0);
var componentByteLength = byteLengthForComponentType(componentType);
var byteStride = this.byteStride;
if (this.accessor.byteStride === 0 && componentType !== this.componentType) {
if ((!defined(this.bufferView.byteStride) || this.bufferView.byteStride === 0) && componentType !== this.componentType) {
byteStride = byteLengthForComponentType(componentType) * this.numberOfComponents;
}
for (var i = 0; i < this.numberOfComponents; i++) {
Expand Down
195 changes: 195 additions & 0 deletions lib/ForEach.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
'use strict';
var Cesium = require('cesium');

var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;

module.exports = ForEach;


/**
* Contains traversal functions for processing elements of the glTF hierarchy.
* @constructor
*/
function ForEach() {}

ForEach.object = function(arrayOfObjects, handler) {
if (defined(arrayOfObjects)) {
for (var i = 0; i < arrayOfObjects.length; i++) {
var object = arrayOfObjects[i];
var offset = defaultValue(handler(object, i), 0);
i += offset;
}
}
};

ForEach.topLevel = function(gltf, name, handler) {
var arrayOfObjects = gltf[name];
ForEach.object(arrayOfObjects, handler);
};

ForEach.accessor = function(gltf, handler) {
ForEach.topLevel(gltf, 'accessors', handler);
};

ForEach.accessorWithSemantic = function(gltf, semantic, handler) {
ForEach.mesh(gltf, function(mesh) {
ForEach.meshPrimitive(mesh, function(primitive) {
ForEach.meshPrimitiveAttribute(primitive, function(accessorId, attributeSemantic) {
if (attributeSemantic.indexOf(semantic) === 0) {
handler(accessorId, attributeSemantic, primitive);
}
});
});
});
};

ForEach.animation = function(gltf, handler) {
ForEach.topLevel(gltf, 'animations', handler);
};

ForEach.animationSampler = function(animation, handler) {
var samplers = animation.samplers;
if (defined(samplers)) {
ForEach.object(samplers, handler);
}
};

ForEach.buffer = function(gltf, handler) {
ForEach.topLevel(gltf, 'buffers', handler);
};

ForEach.bufferView = function(gltf, handler) {
ForEach.topLevel(gltf, 'bufferViews', handler);
};

ForEach.camera = function(gltf, handler) {
ForEach.topLevel(gltf, 'cameras', handler);
};

ForEach.image = function(gltf, handler) {
ForEach.topLevel(gltf, 'images', handler);
};

ForEach.material = function(gltf, handler) {
ForEach.topLevel(gltf, 'materials', handler);
};

ForEach.materialValue = function(material, handler) {
var values = material.values;
if (defined(values)) {
for (var name in values) {
if (values.hasOwnProperty(name)) {
handler(values[name], name);
}
}
}
};

ForEach.mesh = function(gltf, handler) {
ForEach.topLevel(gltf, 'meshes', handler);
};

ForEach.meshPrimitive = function(mesh, handler) {
var primitives = mesh.primitives;
if (defined(primitives)) {
var primitivesLength = primitives.length;
for (var i = 0; i < primitivesLength; i++) {
var primitive = primitives[i];
handler(primitive, i);
}
}
};

ForEach.meshPrimitiveAttribute = function(primitive, handler) {
var attributes = primitive.attributes;
if (defined(attributes)) {
for (var semantic in attributes) {
if (attributes.hasOwnProperty(semantic)) {
handler(attributes[semantic], semantic);
}
}
}
};

ForEach.node = function(gltf, handler) {
ForEach.topLevel(gltf, 'nodes', handler);
};

ForEach.nodeInTree = function(gltf, nodeIds, handler) {
var nodes = gltf.nodes;
if (defined(nodes)) {
for (var i = 0; i < nodeIds.length; i++) {
var nodeId = nodeIds[i];
var node = nodes[nodeId];
if (defined(node)) {
handler(node, nodeId);
var children = node.children;
if (defined(children)) {
ForEach.nodeInTree(gltf, children, handler);
}
}
}
}
};

ForEach.nodeInScene = function(gltf, scene, handler) {
var sceneNodeIds = scene.nodes;
if (defined(sceneNodeIds)) {
ForEach.nodeInTree(gltf, sceneNodeIds, handler);
}
};

ForEach.program = function(gltf, handler) {
ForEach.topLevel(gltf, 'programs', handler);
};

ForEach.sampler = function(gltf, handler) {
ForEach.topLevel(gltf, 'samplers', handler);
};

ForEach.scene = function(gltf, handler) {
ForEach.topLevel(gltf, 'scenes', handler);
};

ForEach.shader = function(gltf, handler) {
ForEach.topLevel(gltf, 'shaders', handler);
};

ForEach.skin = function(gltf, handler) {
ForEach.topLevel(gltf, 'skins', handler);
};

ForEach.techniqueAttribute = function(technique, handler) {
var attributes = technique.attributes;
if (defined(attributes)) {
for (var semantic in attributes) {
if (attributes.hasOwnProperty(semantic)) {
if (handler(attributes[semantic], semantic)) {
break;
}
}
}
}
};

ForEach.techniqueParameter = function(technique, handler) {
var parameters = technique.parameters;
if (defined(parameters)) {
for (var parameterName in parameters) {
if (parameters.hasOwnProperty(parameterName)) {
if (handler(parameters[parameterName], parameterName)) {
break;
}
}
}
}
};

ForEach.technique = function(gltf, handler) {
ForEach.topLevel(gltf, 'techniques', handler);
};

ForEach.texture = function(gltf, handler) {
ForEach.topLevel(gltf, 'textures', handler);
};
Loading