0.0.3 • Published 8 months ago

osg-serializer-browser v0.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

osg-serializer-browser

osg-serializier-js is PureJS module for serializing .osgt and .osgb files.

The tool is still in development but I will be happy to your issues and contributions

UPDATE: Consider using wasm using OpenSceneGraph's most updated code (osg-wasm, openscenegraph-cross-platform-guide).

installation and usage

In terminal: npm install --save osg-serializer-browser

In code(node.js):

var filePath = './Samples/cessna.osgb'
osg.readFile(filePath, (err, osgObj) => {
    if (err) console.error(err);
    else console.log(osgObj);
    // start workin with 3d data
})

In code(browser):

<script src='./dist/osg.js'></script>
var buffer = require('buffer')
var filePath = './Samples/cessna.osgb'
fetch(filePath).then(res => { return res.arrayBuffer() }).then(abuf => {
    var buf = buffer.Buffer.from(abuf)
    var osgObj = osg.readBuffer(buf, filePath)
    console.log(osgObj);
})

// start workin with 3d data