Giter Site home page Giter Site logo

Comments (9)

lilleyse avatar lilleyse commented on May 20, 2024

Hi, I made some changes to the file reader, can you run the latest code and tell me if it works for you?

from obj2gltf.

hamogu avatar hamogu commented on May 20, 2024

Now I get

melkor:/melkor/d1/guenther/projects/threejs/OBJ2GLTF> node bin/obj2gltf.js ../obj/test5.obj ../obj/test5.gltf

buffer.js:803
  this.parent.writeFloatLE(value, this.offset + offset, !!noAssert);
              ^
TypeError: value not a number
    at Buffer.writeFloatLE (buffer.js:803:15)
    at createGltf (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/gltf.js:69:16)
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/convert.js:37:9
    at LineStream.<anonymous> (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/lib/obj.js:224:9)
    at LineStream.emit (events.js:117:20)
    at _stream_readable.js:944:16
    at process._tickCallback (node.js:448:13)

from obj2gltf.

hamogu avatar hamogu commented on May 20, 2024

I've tried a different OBJ file and found this:

/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/findAccessorMinMax.js:17
    var min = new Array(numberOfComponents).fill(Number.POSITIVE_INFINITY);
                                            ^
TypeError: Object  has no method 'fill'
    at findAccessorMinMax (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/findAccessorMinMax.js:17:45)
    at accessorDefaults (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/addDefaults.js:24:30)
    at addDefaults (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/addDefaults.js:561:5)
    at processJSONWithExtras (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/gltfPipeline.js:57:5)
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/gltfPipeline.js:115:9
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/loadGltfUris.js:36:9
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/async/lib/async.js:52:16
    at done (/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/async/lib/async.js:246:17)
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/async/lib/async.js:44:16
    at /melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/loadGltfUris.js:119:17

I'll past the OBJ file here so you can try it out yourself:

mtllib /melkor/d1/guenther/projects/threejs/obj/test3.mtl

v 10 10 10
v 20 20 20
v 0 0 0 
v 0 -51.2692 269.668

g grp1
usemtl mtl1
l 1 2 3 4 
f 1
f 2
f 3
f 4

from obj2gltf.

hamogu avatar hamogu commented on May 20, 2024

Thank you so much for your quick responses!

from obj2gltf.

lilleyse avatar lilleyse commented on May 20, 2024

For the example you posted we don't support line segments like l 1 2 3 4 right now. Rearranging your example a bit works, but it may not be exactly what you want:

mtllib /melkor/d1/guenther/projects/threejs/obj/test3.mtl

v 10 10 10
v 20 20 20
v 0 0 0 
v 0 -51.2692 269.668

g grp1
usemtl mtl1
f 1 2 3 4

Can you also send over your other obj?

/melkor/d1/guenther/projects/threejs/OBJ2GLTF/node_modules/gltf-pipeline/lib/findAccessorMinMax.js:17
var min = new Array(numberOfComponents).fill(Number.POSITIVE_INFINITY);
^
TypeError: Object has no method 'fill'

What version of Node do you have installed? Updating may fix that problem.

from obj2gltf.

hamogu avatar hamogu commented on May 20, 2024

The other file is a lot bigger (> 15 MB), and it also contains line line segments, so that's probably a related error.
I'm visualizing a ray-trace simulation for a scientific instrument and rays are lines, so I cannot really do without lines. I'll try to work directly with the OBJ format for now, but I'll keep your converter in mind and come back to it later if I have the opportunity!

melkor:/melkor/d1/guenther/projects/threejs/OBJ2GLTF> node --version
v0.10.42
(I'm using CentOS and that's the version I get through my package manager.)

from obj2gltf.

lilleyse avatar lilleyse commented on May 20, 2024

Ok, thanks for all the info. Adding support for line segments shouldn't be too bad and I'll update this issue when it's ready.

from obj2gltf.

zhanfenghai avatar zhanfenghai commented on May 20, 2024

@lilleyse hi,i got the same error. i tried to read a file like xx.html.
here is my code
image

from obj2gltf.

lilleyse avatar lilleyse commented on May 20, 2024

obj2gltf isn't using the readline package anymore, you should investigate with them instead. You could also check out the byline package which seems to be very solid so far.

from obj2gltf.

Related Issues (20)

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.