Giter Site home page Giter Site logo

gltf-bounding-box's People

Contributors

flozz avatar jbghoul avatar jbghoul-wanadev avatar leonicolle avatar riccardogiorato avatar risq avatar tiredfalcon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gltf-bounding-box's Issues

If I replace the gltf file, it won't work

According to the code, I found that when URI was not coded in base64, it could not continue to work.
the err:
gltf-bounding-box\dist\index.js:17335 if (!buffer.uri.startsWith("data:")) {

Cannot read property 'slice' of null when computing bounding box

I am using this to compute the bounding box of a gltf file, but an error happens. Here is the stack trace:

TypeError: Cannot read property 'slice' of null
    at Object._loadBufferView (.../gltf-bounding-box/dist/webpack:/src/gltf-reader.js:92:19)
    at Object._loadAccessor (.../gltf-bounding-box/dist/webpack:/src/gltf-reader.js:48:31)
    at .../gltf-bounding-box/dist/webpack:/src/gltf-reader.js:25:47
    at Array.forEach (<anonymous>)
    at loadPositions (.../gltf-bounding-box/dist/webpack:/src/gltf-reader.js:21:21)
    at .../gltf-bounding-box/dist/webpack:/src/gltf2-bounding-box.js:46:51
    at Array.reduce (<anonymous>)
    at Object.getMeshesTransformMatrices (.../gltf-bounding-box/dist/webpack:/src/gltf2-bounding-box.js:39:8)
    at Object.computeBoundings (.../gltf-bounding-box/dist/webpack:/src/gltf2-bounding-box.js:8:28)
    at Object.computeBoundings (.../gltf-bounding-box/dist/webpack:/src/index.js:23:33)

I am using node 8.15.0 on macOS 10.13.4

Transformations are not applied if they are not in the matrix field

If a gltf file contains transformations in the fields scaling, rotation, and translation, these are not considered in the computation.

This happens because in the function getParentNodesMatrices, only the field matrix is checked.
However, the GLTF specifications says that also three other fields are present (for T, R, and S), which can contain the transformations separately.

[BUG] Integer division causes center to be rounded even if precision is set

In the files gltf1-bounding-box.js and gltf2-bounding-box.js the center is computed as:

center: {
    x: precise.round((boundings.max[0] + boundings.min[0]) / 2, precision + 1),
    y: precise.round((boundings.max[2] + boundings.min[2]) / 2, precision + 1),
    z: precise.round((boundings.max[1] + boundings.min[1]) / 2, precision + 1),
},

However, the division by 2 is integer division and causes the number argument of precise.round to always be an integer.

To correct this bug, I believe it is enough to divide by 2.0 instead.

Should I make a PR for this?

Support du GLB2

  • Supporter le glTF 2 ;
  • Supporter le format binaire en extrayant le JSON à l'intérieur.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.