-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
- Loading branch information
Rob Taglang
committed
Apr 28, 2017
1 parent
ce48e5f
commit 1406b32
Showing
123 changed files
with
7,883 additions
and
8,831 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
Oops, something went wrong.