Ray Definition and the Include Folder

Ray Definition and the Include Folder

I am attempting to use Embree as an external library to my application that needs to do some ray tracing. I have downloaded v2.0 via git, and I noticed there is an include folder. However, the definition of the Ray struct appears to be missing from this folder. Is the intent to use the definition from common/ray.h? If I attempt to include common/ray.h into my application I get build errors related to SSE instructions. I have tried adding compile flags for SSE in my application's cmake file, but I was not having much luck (my cmake-fu is a little weak).

Any insight into the intended use of these files would be much appreciated.



5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Daniel,

if you want to use the single ray kernels directly you should include common/ray.h. What kind of build errors do you get?



Thanks for the response. The build errors I get are related to undeclared functions such as _mm_moveldup_ps, _mm_movehdup_ps, _mm_movedup_pd, etc. My compiler output can be found here: http://www.pasteall.org/44939 .

My compiler is gcc 4.8.1. Currently my cmake file adds the whole embree folder as an include directory, and adds embree as a link target. I suspect I need to do something to find these SSE functions? I have tried running the build_gcc command from my own cmake file, but it did not seem to help with the errors.



The ray.h file is not in the include folder of the API as it uses the Embree short vector library to define the ray. To use the API, best define in your application a ray structure using your short vector library of choice that has exactly the same binary layout. Then do some casts when passing that ray to Embree.


My app is also not SSE aware so I added a bit to the embree.h api to export the intersection interface, but still hide the SSE code. I understand what Sven said about type casting between structures with the same layout, but I am not a fan of doing this for a couple of reasons. The int align member in the rtc vector struct already makes me a bit uneasy. I would rather use int32_t to make sure it is 32 bits on all compilers.

For the moment I only added an RTCRay struct and the 'void rtcGeometryIntersect1(const RTCIntersector1* intersector, RTCRay *rtcRay)’ method.

The modified embree.h and embree.cpp files are attached. Without doing this one has to include the Ray class and along with it the SSE code in other embree headers as Daniel pointed out.




Downloadtext/x-c++src embree.cpp10.33 KB
Downloadtext/x-chdr embree.h8.7 KB

Leave a Comment

Please sign in to add a comment. Not a member? Join today