简体   繁体   English

C ++中的光线投射库是否简单且开源?

[英]Is there a raycasting library in C++ that is simple and open source?

I'm looking for a library that will let me cast a ray into a scene model (it happens to be a terrain model in our case) and return the point of intersection in the scene. 我正在寻找一个可以让我将光线投射到场景模型中的图书馆(在我们的例子中恰好是地形模型)并返回场景中的交点。 It does not have to be super-efficient (although I'd rather it not be super-inefficient). 它不一定非常有效(尽管我认为它不是超低效的)。 Ideally it would not have dependencies on other libraries (like OpenGL). 理想情况下,它不会依赖于其他库(如OpenGL)。 I'm really looking for something that has just the functionality I need and no more. 我真的在寻找具有我需要的功能的东西,而不是更多。

Does anyone have any suggestions? 有没有人有什么建议?

Unless there are other requirements you haven't revealed, use CGAL 's AABB tree 's support for ray intersections ( example ). 除非您还没有透露其他要求,否则请使用CGALAABB树支持光线交叉( 例如 )。

(Please, don't even think about using this if you're actually trying to do terrain rendering though... there are far more efficient algorithms for ray-casting height fields for the purpose of producing images eg so-called voxel algorithms ). (请不要考虑使用这个,如果你实际上尝试进行地形渲染......虽然有更高效的射线投射高度场算法用于生成图像,例如所谓的体素算法 ) 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM