1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
// Copyright 2009 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
#ifdef OSPRAY_ENABLE_VOLUMES
#pragma once
#include "Instance.ih"
#include "OSPCommon.ih"
#include "rkcommon/math/AffineSpace.ih"
#include "rkcommon/math/box.ih"
OSPRAY_BEGIN_ISPC_NAMESPACE
struct VolumetricModel;
// Volume hit structure ///////////////////////////////////////////////////////
struct VolumeInterval
{
VolumetricModel *volumetricModel;
Instance *instance;
range1f interval;
unsigned int primID;
unsigned int geomID;
unsigned int instID;
};
inline void initVolumeInterval(VolumeInterval &hit)
{
hit.volumetricModel = NULL;
hit.interval.lower = inf;
hit.interval.upper = -hit.interval.lower;
}
inline bool hasInterval(const VolumeInterval &vi)
{
return !isEmpty(vi.interval);
}
struct VolumeIntervals
{
unsigned int numVolumeIntervals;
uniform unsigned int numAllocated;
varying VolumeInterval *uniform intervals;
};
#ifndef OSPRAY_TARGET_SYCL
inline void allocVolumeIntervals(VolumeIntervals &intervals)
{
intervals.numVolumeIntervals = 0;
intervals.numAllocated = 0;
intervals.intervals = (varying VolumeInterval * uniform) pushTLS(0);
}
inline void freeVolumeIntervals(VolumeIntervals &intervals)
{
popTLS(intervals.intervals);
intervals.intervals = NULL;
}
#endif
struct RayQueryContextVolume
{
RTCRayQueryContext ectx;
varying VolumeIntervals *intervals;
};
inline void InitRayQueryContextVolume(RayQueryContextVolume *uniform context,
varying VolumeIntervals *uniform intervals)
{
rtcInitRayQueryContext(&context->ectx);
context->intervals = intervals;
}
OSPRAY_END_ISPC_NAMESPACE
#endif
|