mirror of https://github.com/CesiumGS/obj2gltf.git
Remove string size limitation
This commit is contained in:
parent
b458856904
commit
75c8dc6163
|
@ -5,6 +5,7 @@ Change Log
|
||||||
|
|
||||||
* Breaking changes
|
* Breaking changes
|
||||||
* The `--materialsCommon` flag has been removed. Use `--unlit` instead which uses the `KHR_materials_unlit` extension. [#152](https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/152)
|
* The `--materialsCommon` flag has been removed. Use `--unlit` instead which uses the `KHR_materials_unlit` extension. [#152](https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/152)
|
||||||
|
* No longer throws an error always if the glTF buffer is greater than 192 MB. The string node size limitation increased in Node 9.0.0. See https://bugs.chromium.org/p/v8/issues/detail?id=6148#c10.
|
||||||
|
|
||||||
### 2.3.2 2018-11-02
|
### 2.3.2 2018-11-02
|
||||||
|
|
||||||
|
|
|
@ -145,12 +145,12 @@ function writeEmbeddedBuffer(gltf) {
|
||||||
var buffer = gltf.buffers[0];
|
var buffer = gltf.buffers[0];
|
||||||
var source = buffer.extras._obj2gltf.source;
|
var source = buffer.extras._obj2gltf.source;
|
||||||
|
|
||||||
// Buffers larger than ~192MB cannot be base64 encoded due to a NodeJS limitation. Source: https://github.com/nodejs/node/issues/4266
|
try {
|
||||||
if (source.length > 201326580) {
|
buffer.uri = 'data:application/octet-stream;base64,' + source.toString('base64');
|
||||||
|
} catch(error) {
|
||||||
|
// In some versions of Node a buffer larger than ~192MB cannot be base64 encoded due to string size limitations. Source: https://stackoverflow.com/posts/47781288/revisions
|
||||||
throw new RuntimeError('Buffer is too large to embed in the glTF. Use the --separate flag instead.');
|
throw new RuntimeError('Buffer is too large to embed in the glTF. Use the --separate flag instead.');
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.uri = 'data:application/octet-stream;base64,' + source.toString('base64');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeEmbeddedTextures(gltf) {
|
function writeEmbeddedTextures(gltf) {
|
||||||
|
|
Loading…
Reference in New Issue