Git Product home page Git Product logo

Comments (4)

fdahle avatar fdahle commented on July 19, 2024

I have done it in my current CityJSON-worker. If you want I can share my code with you.

It's unfortunately not that easy, as it is not possible to transfer Meshes/geometries over an web-worker. However I find a solution that works using BufferGeometry.

from ninja.

liberostelios avatar liberostelios commented on July 19, 2024

Thanks @fdahle, that's sounds really interesting! I've been thinking about decoupling the parsing of CityJSON from the viewer anyway, so I would be interested to see how you implemented it.

from ninja.

fdahle avatar fdahle commented on July 19, 2024

As already mentioned the most important part is that Webworkers cannot work with meshes/geometries, as these are not simple objects. So currently I'm converting my normal geometries into a BufferGeometry (Later I want to create BufferGeometries directly):

var bufferGeom = new THREE.BufferGeometry().fromGeometry(geom);

In order to not have such a high communication between the Worker and the MainThread I'm currently storing multiple BufferGeometries in a List and return this List to the Worker.

In my main thread I can directly use this bufferGeometry to create a mesh:

var mesh = new THREE.Mesh(bufferGeom, material);

This has furthermore the advantage of making the whole scene smaller, because as far I understood also the regular geometries use bufferGeometries internally.

If you have any questions or need the whole code example just write :)

from ninja.

liberostelios avatar liberostelios commented on July 19, 2024

Fixed with latest release (v0.4.0).

from ninja.

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.