Comments (4)
It should be possible to implement it, and by the way feel free to submit a PR for review. The issue though is that this requires some sort of knowledge of the build algorithm, in the sense that the notion of "progress" is really not going to be super accurate (it's -- for the most part -- a recursive process and you may not know the cost of building the subtree until you actually do it).
That said, a reasonable assumption that the cost of a subtree of size N is somewhat proportional to N log(N)
might make sense. There's still the problem that the mini-tree builder runs in parallel so you have to take care of sending the progress information only once (or at least send it in an ordered fashion somehow). Maybe an atomic number is enough, so that you can start building the BVH, then check the progress at regular intervals by looking at the value held by that atomic.
So all in all it's a pretty complicated implementation for a small feature that, although nice to have, is not strictly necessary. I'll keep that in mind when doing further development work on the library though, if I can find the time for it.
from bvh.
Thanks for the response! Personally I'd be more interested in the ability to cancel anyway, the progress callback would just be nice-to-have.
In my case I have scenes where building the BVH can take several minutes and if the user closes the program during that, they currently have to wait until the BVH building is complete.
I haven't looked too closely at the source code for bvh, but I'll try and see if I can whip up a PR for that in the near future.
from bvh.
For this specific use case, I don't think you need the ability to cancel the build per se. I would imagine that through OS services you can send a kill signal to the process that builds the BVH, without having to wait for the threads to join. If you want to kill your own process on Linux, use kill(getpid(), sig)
or raise(sig)
(where sig
is the signal to send, SIGTERM
or SIGKILL
).
from bvh.
If you don't want to kill the current process but want to continue executing the program, you could use a subprocess to build the BVH as a work around. This would allow you to kill it before it terminates. The downside is that you'll have to communicate via files or pipes. The serialization API allows you to do that, by sending a stream of bytes over, instead of writing to a file on disk.
from bvh.
Related Issues (20)
- Identifiers near and far in bvh.h cause issues when precompiled headers are used HOT 3
- config.min_leaf_size > 1 Leads to assertion failure HOT 1
- What is the use case? is it slower than embree? HOT 1
- Consider adding to vcpkg HOT 1
- Ability to re-use BVH allocations? HOT 1
- Adding and Removing elements HOT 1
- Optimize node index serialization HOT 1
- Clarify what primitive data leaf nodes actually store HOT 1
- Potential bug in traversal functions HOT 1
- Possible stale pointer usage in extract_bvh()? HOT 4
- Sweep SAH builder HOT 4
- ReinsertionOptimizer sometimes gets stuck in an infinite loop HOT 16
- Updating node positions and sizes? HOT 3
- Python bindings available? HOT 3
- Fail to build C API with clang HOT 1
- warning C4267: conversion from 'size_t' to 'unsigned int', possible loss of data HOT 1
- box collision detection HOT 1
- Minor nitpick about FMA doc / comment HOT 1
- Using in a gpu context ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bvh.