3 Commits
Author SHA1 Message Date
Daniel Simon 6c6ebd9530 Update rtcore_scene.h (#555)
Add missing forward declaration for RTCGeometry in rtcore_scene.h
2026-07-09 09:21:11 +02:00
Daniel Simon 1372ca0865 Add missing RTC_NAMESPACE definition to rtcore_config
`rtcore_config.h.in does` not define `RTC_NAMESPACE` when `EMBREE_API_NAMESPACE` is not defined when it should be defined but empty. This can cause a problem with forward declarations like the following:
```c++
RTC_NAMESPACE_BEGIN
typedef struct RTCSceneTy* RTCScene;
RTC_NAMESPACE_END

void my_function(RTC_NAMESPACE::RTCScene scene);
```
2025-08-07 10:10:00 +02:00
Daniel Simon 819aedb442 Added alignment definitions to RTCHitNt and RTCRayNt
Added alignment definitions to RTCHitNt and RTCRayNt templates so they match the C definitions provided. As the alignment calculation is nasty without requiring the alignof keyword, or constexpr functions, this could instead be hidden behind a macro. Maybe RTC_ALIGN_SOA_AT_LEAST(N, MIN)?

The code is equivalent to:
```
constexpr std::size_t AlignSOAAtLeast(unsigned N, std::size_t min_alignment) noexcept {
    if (std::has_single_bit<unsigned>(N)) {
        return std::max<std::size_t>(min_alignment, N * alignof(float));
    } else {
        return min_alignment;
    }
}
```
Checking this works is as simple as adding a few static assertions:
```
static_assert(alignof(embree::RTCRayNt<1>) == alignof(embree::RTCRay));
static_assert(alignof(embree::RTCRayNt<4>) == alignof(embree::RTCRay4));
static_assert(alignof(embree::RTCRayNt<8>) == alignof(embree::RTCRay8));
static_assert(alignof(embree::RTCRayNt<16>) == alignof(embree::RTCRay16));
```
2024-04-30 15:19:20 -04:00