Skip to content

Commit

Permalink
use Buffer.from
Browse files Browse the repository at this point in the history
  • Loading branch information
likangning93 committed Apr 6, 2017
1 parent 4eaf497 commit fd4ae6a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/getBinaryGltf.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function updateBinaryObject(gltf, objects, name, pipelineExtras, state) {
state.currentBinaryView++;
}

var objectSource = new Buffer(object.extras._pipeline.source);
var objectSource = Buffer.from(object.extras._pipeline.source);
var bufferViewId = 'binary_bufferView' + state.currentBinaryView;
KHR_binary_glTF.bufferView = bufferViewId; //Create bufferview
bufferViews[bufferViewId] = {
Expand Down Expand Up @@ -120,7 +120,7 @@ function getBinaryGltf(gltf, embed, embedImage) {

// Create padded binary scene buffer and calculate total length
var sceneString = JSON.stringify(gltf);
var sceneBuffer = Buffer.alloc(Buffer.byteLength(sceneString), sceneString);
var sceneBuffer = Buffer.from(sceneString);
var sceneLength = sceneBuffer.length;
var paddingLength = 4 - (sceneLength % 4); // pad out to 4 bytes as per glb specification
sceneLength += paddingLength;
Expand Down

0 comments on commit fd4ae6a

Please sign in to comment.