-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathQuickClustersSampler.h
72 lines (53 loc) · 1.48 KB
/
QuickClustersSampler.h
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
#pragma once
#include <model/QuickClustersModel.h>
#include <Gridlet.h>
#include "Sampler.h"
namespace exa {
struct QCLeafGeom {
enum { ELEMENTS_PER_BOX = 1, };
int *indexBuffer;
vec4f *vertexBuffer;
float *maxOpacities;
uint32_t numElements;
};
class QuickClustersSampler : public Sampler {
public:
typedef std::shared_ptr<QuickClustersSampler> SP;
// Launch params associated with sampler
struct LP {
OptixTraversableHandle sampleBVH;
#ifdef EXA_STITCH_MIRROR_EXAJET
affine3f mirrorInvTransform;
#endif
};
bool build(OWLContext owl, Model::SP model);
void computeMaxOpacities(OWLContext owl, OWLBuffer colorMap, range1f xfRange);
std::vector<OWLVarDecl> getLPVariables();
void setLPs(OWLParams lp);
std::string className() { return "QuickClustersSampler"; }
QuickClustersModel::SP model = nullptr;
OWLBuffer indexBuffer;
OWLBuffer vertexBuffer;
private:
OWLModule module;
struct {
OWLGeomType geomType;
OWLGroup blas;
} leafGeom;
OWLGroup tlas;
OWLBuffer umeshMaxOpacities{ 0 };
};
#ifdef __CUDA_ARCH__
inline __device__
Sample sample(const QuickClustersSampler::LP &lp,
const SpatialDomain &domain,
const vec3f pos)
{
Sample prd{-1,-1,0.f};
SamplingRay ray(pos,vec3f(1.f),0.f,0.f);
owl::traceRay(lp.sampleBVH,ray,prd,
OPTIX_RAY_FLAG_DISABLE_ANYHIT);
return prd;
}
#endif
}