RanCN / osg-serializer-js

Pure JavaScript module for reading (and writing, hopefully) .osgb & .osgt files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

osg-serializer-browser

基于osg-serializier-js改造,前后端通用的osgbosgt文件解析模块,内置es6版本。

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

欢迎关注微信公众号【三维网格3D】,了解大规模Osgb倾斜摄影模型加载原理介绍 微信公众号【三维网格3D】

About

Pure JavaScript module for reading (and writing, hopefully) .osgb & .osgt files


Languages

Language:JavaScript 99.8%Language:HTML 0.2%