Skip to content

Instantly share code, notes, and snippets.

View zellski's full-sized avatar

Pär Winzell zellski

  • Montpelier, VT
  • 10:45 (UTC -04:00)
View GitHub Profile
#!/usr/bin/env bash
#
HOME="/Users/zell/TextureWork"
(( BASH_VERSINFO[0] >= 4 )) || {
echo "This script requires Bash 4.*"
exit 1
}

The Buffer supplies the BufferView with a single cohesive chunk of binary data. The BufferView supplies the Accessor with a sequence of bytes -- this can be contiguous or interleaved. The Accessor turns the sequence of bytes into a sequence of components -- bytes, shorts, ints, floats -- and combines the components into actual elements, such as a three-element vector or a 4x4-element matrix.

The Accessor ultimately serves up its typed, structured content to Mesh Primitive, Animation and Skin objects, and that is where we will actually maintain the state. This means accessors, bufferViews and buffers are all derived entities, constructed during glTF generation.

For animations and skins, BufferView allocation should be straight-forward; we might choose to make one per accessor or some amount of combination (e.g. per-animation, per-animation-frame). The accessor instantiation, too, should be pretty basic; there is no interleaving to worry about.

The mesh primitives, however, are a

@zellski
zellski / gltf_utils.js
Created November 10, 2017 03:21
RebindingScene & RebindingSkinnedMesh
/**
* An object that rebinds its skinned meshes when cloned.
*/
export class RebindingScene extends THREE.Scene {
constructor() {
super();
}
copy(source :THREE.Scene, recursive :?boolean) :THREE.Object3D {
super.copy(source, recursive);
var nodes = {};