HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
rtcore_scene.h
Go to the documentation of this file.
1 // Copyright 2009-2021 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
3 
4 #pragma once
5 
6 #include "rtcore_device.h"
7 
9 
10 /* Forward declarations for ray structures */
11 struct RTCRayHit;
12 struct RTCRayHit4;
13 struct RTCRayHit8;
14 struct RTCRayHit16;
15 struct RTCRayHitNp;
16 
17 /* Scene flags */
19 {
25 };
26 
27 /* Creates a new scene. */
29 
30 /* Returns the device the scene got created in. The reference count of
31  * the device is incremented by this function. */
33 
34 /* Retains the scene (increments the reference count). */
35 RTC_API void rtcRetainScene(RTCScene scene);
36 
37 /* Releases the scene (decrements the reference count). */
38 RTC_API void rtcReleaseScene(RTCScene scene);
39 
40 
41 /* Attaches the geometry to a scene. */
42 RTC_API unsigned int rtcAttachGeometry(RTCScene scene, RTCGeometry geometry);
43 
44 /* Attaches the geometry to a scene using the specified geometry ID. */
45 RTC_API void rtcAttachGeometryByID(RTCScene scene, RTCGeometry geometry, unsigned int geomID);
46 
47 /* Detaches the geometry from the scene. */
48 RTC_API void rtcDetachGeometry(RTCScene scene, unsigned int geomID);
49 
50 /* Gets a geometry handle from the scene. */
51 RTC_API RTCGeometry rtcGetGeometry(RTCScene scene, unsigned int geomID);
52 
53 
54 /* Commits the scene. */
55 RTC_API void rtcCommitScene(RTCScene scene);
56 
57 /* Commits the scene from multiple threads. */
59 
60 
61 /* Progress monitor callback function */
62 typedef bool (*RTCProgressMonitorFunction)(void* ptr, double n);
63 
64 /* Sets the progress monitor callback function of the scene. */
66 
67 /* Sets the build quality of the scene. */
69 
70 /* Sets the scene flags. */
72 
73 /* Returns the scene flags. */
75 
76 /* Returns the axis-aligned bounds of the scene. */
77 RTC_API void rtcGetSceneBounds(RTCScene scene, struct RTCBounds* bounds_o);
78 
79 /* Returns the linear axis-aligned bounds of the scene. */
80 RTC_API void rtcGetSceneLinearBounds(RTCScene scene, struct RTCLinearBounds* bounds_o);
81 
82 
83 /* Perform a closest point query of the scene. */
84 RTC_API bool rtcPointQuery(RTCScene scene, struct RTCPointQuery* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void* userPtr);
85 
86 /* Perform a closest point query with a packet of 4 points with the scene. */
87 RTC_API bool rtcPointQuery4(const int* valid, RTCScene scene, struct RTCPointQuery4* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void** userPtr);
88 
89 /* Perform a closest point query with a packet of 4 points with the scene. */
90 RTC_API bool rtcPointQuery8(const int* valid, RTCScene scene, struct RTCPointQuery8* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void** userPtr);
91 
92 /* Perform a closest point query with a packet of 4 points with the scene. */
93 RTC_API bool rtcPointQuery16(const int* valid, RTCScene scene, struct RTCPointQuery16* query, struct RTCPointQueryContext* context, RTCPointQueryFunction queryFunc, void** userPtr);
94 
95 /* Intersects a single ray with the scene. */
96 RTC_API void rtcIntersect1(RTCScene scene, struct RTCIntersectContext* context, struct RTCRayHit* rayhit);
97 
98 /* Intersects a packet of 4 rays with the scene. */
99 RTC_API void rtcIntersect4(const int* valid, RTCScene scene, struct RTCIntersectContext* context, struct RTCRayHit4* rayhit);
100 
101 /* Intersects a packet of 8 rays with the scene. */
102 RTC_API void rtcIntersect8(const int* valid, RTCScene scene, struct RTCIntersectContext* context, struct RTCRayHit8* rayhit);
103 
104 /* Intersects a packet of 16 rays with the scene. */
105 RTC_API void rtcIntersect16(const int* valid, RTCScene scene, struct RTCIntersectContext* context, struct RTCRayHit16* rayhit);
106 
107 /* Intersects a stream of M rays with the scene. */
108 RTC_API void rtcIntersect1M(RTCScene scene, struct RTCIntersectContext* context, struct RTCRayHit* rayhit, unsigned int M, size_t byteStride);
109 
110 /* Intersects a stream of pointers to M rays with the scene. */
111 RTC_API void rtcIntersect1Mp(RTCScene scene, struct RTCIntersectContext* context, struct RTCRayHit** rayhit, unsigned int M);
112 
113 /* Intersects a stream of M ray packets of size N in SOA format with the scene. */
114 RTC_API void rtcIntersectNM(RTCScene scene, struct RTCIntersectContext* context, struct RTCRayHitN* rayhit, unsigned int N, unsigned int M, size_t byteStride);
115 
116 /* Intersects a stream of M ray packets of size N in SOA format with the scene. */
117 RTC_API void rtcIntersectNp(RTCScene scene, struct RTCIntersectContext* context, const struct RTCRayHitNp* rayhit, unsigned int N);
118 
119 /* Tests a single ray for occlusion with the scene. */
120 RTC_API void rtcOccluded1(RTCScene scene, struct RTCIntersectContext* context, struct RTCRay* ray);
121 
122 /* Tests a packet of 4 rays for occlusion occluded with the scene. */
123 RTC_API void rtcOccluded4(const int* valid, RTCScene scene, struct RTCIntersectContext* context, struct RTCRay4* ray);
124 
125 /* Tests a packet of 8 rays for occlusion with the scene. */
126 RTC_API void rtcOccluded8(const int* valid, RTCScene scene, struct RTCIntersectContext* context, struct RTCRay8* ray);
127 
128 /* Tests a packet of 16 rays for occlusion with the scene. */
129 RTC_API void rtcOccluded16(const int* valid, RTCScene scene, struct RTCIntersectContext* context, struct RTCRay16* ray);
130 
131 /* Tests a stream of M rays for occlusion with the scene. */
132 RTC_API void rtcOccluded1M(RTCScene scene, struct RTCIntersectContext* context, struct RTCRay* ray, unsigned int M, size_t byteStride);
133 
134 /* Tests a stream of pointers to M rays for occlusion with the scene. */
135 RTC_API void rtcOccluded1Mp(RTCScene scene, struct RTCIntersectContext* context, struct RTCRay** ray, unsigned int M);
136 
137 /* Tests a stream of M ray packets of size N in SOA format for occlusion with the scene. */
138 RTC_API void rtcOccludedNM(RTCScene scene, struct RTCIntersectContext* context, struct RTCRayN* ray, unsigned int N, unsigned int M, size_t byteStride);
139 
140 /* Tests a stream of M ray packets of size N in SOA format for occlusion with the scene. */
141 RTC_API void rtcOccludedNp(RTCScene scene, struct RTCIntersectContext* context, const struct RTCRayNp* ray, unsigned int N);
142 
143 /*! collision callback */
144 struct RTCCollision { unsigned int geomID0; unsigned int primID0; unsigned int geomID1; unsigned int primID1; };
145 typedef void (*RTCCollideFunc) (void* userPtr, struct RTCCollision* collisions, unsigned int num_collisions);
146 
147 /*! Performs collision detection of two scenes */
148 RTC_API void rtcCollide (RTCScene scene0, RTCScene scene1, RTCCollideFunc callback, void* userPtr);
149 
150 #if defined(__cplusplus)
151 
152 /* Helper for easily combining scene flags */
153 inline RTCSceneFlags operator|(RTCSceneFlags a, RTCSceneFlags b) {
154  return (RTCSceneFlags)((size_t)a | (size_t)b);
155 }
156 
157 #endif
158 
160 
RTC_API void rtcCommitScene(RTCScene scene)
RTC_API void rtcGetSceneLinearBounds(RTCScene scene, struct RTCLinearBounds *bounds_o)
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
RTC_API bool rtcPointQuery4(const int *valid, RTCScene scene, struct RTCPointQuery4 *query, struct RTCPointQueryContext *context, RTCPointQueryFunction queryFunc, void **userPtr)
RTC_API void rtcOccluded8(const int *valid, RTCScene scene, struct RTCIntersectContext *context, struct RTCRay8 *ray)
RTC_API unsigned int rtcAttachGeometry(RTCScene scene, RTCGeometry geometry)
void
Definition: png.h:1083
RTC_API void rtcOccluded1Mp(RTCScene scene, struct RTCIntersectContext *context, struct RTCRay **ray, unsigned int M)
RTC_API void rtcSetSceneFlags(RTCScene scene, enum RTCSceneFlags flags)
RTC_API void rtcOccludedNp(RTCScene scene, struct RTCIntersectContext *context, const struct RTCRayNp *ray, unsigned int N)
unsigned int geomID0
Definition: rtcore_scene.h:144
RTC_API void rtcAttachGeometryByID(RTCScene scene, RTCGeometry geometry, unsigned int geomID)
void(* RTCCollideFunc)(void *userPtr, struct RTCCollision *collisions, unsigned int num_collisions)
Definition: rtcore_scene.h:145
RTC_API void rtcIntersect1M(RTCScene scene, struct RTCIntersectContext *context, struct RTCRayHit *rayhit, unsigned int M, size_t byteStride)
RTC_API void rtcOccluded1M(RTCScene scene, struct RTCIntersectContext *context, struct RTCRay *ray, unsigned int M, size_t byteStride)
RTC_API RTCDevice rtcGetSceneDevice(RTCScene hscene)
RTC_API void rtcSetSceneProgressMonitorFunction(RTCScene scene, RTCProgressMonitorFunction progress, void *ptr)
#define RTC_API
Definition: rtcore_config.h:55
typedefRTC_NAMESPACE_BEGIN struct RTCDeviceTy * RTCDevice
Definition: rtcore_device.h:11
RTC_API bool rtcPointQuery(RTCScene scene, struct RTCPointQuery *query, struct RTCPointQueryContext *context, RTCPointQueryFunction queryFunc, void *userPtr)
RTCBuildQuality
unsigned int primID1
Definition: rtcore_scene.h:144
RTC_API void rtcIntersect1(RTCScene scene, struct RTCIntersectContext *context, struct RTCRayHit *rayhit)
RTC_API enum RTCSceneFlags rtcGetSceneFlags(RTCScene scene)
RTC_API void rtcReleaseScene(RTCScene scene)
struct RTCGeometryTy * RTCGeometry
RTC_API void rtcGetSceneBounds(RTCScene scene, struct RTCBounds *bounds_o)
RTC_API RTCScene rtcNewScene(RTCDevice device)
RTC_API void rtcOccludedNM(RTCScene scene, struct RTCIntersectContext *context, struct RTCRayN *ray, unsigned int N, unsigned int M, size_t byteStride)
RTC_API void rtcIntersect16(const int *valid, RTCScene scene, struct RTCIntersectContext *context, struct RTCRayHit16 *rayhit)
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:1222
RTC_API bool rtcPointQuery8(const int *valid, RTCScene scene, struct RTCPointQuery8 *query, struct RTCPointQueryContext *context, RTCPointQueryFunction queryFunc, void **userPtr)
RTC_API void rtcCollide(RTCScene scene0, RTCScene scene1, RTCCollideFunc callback, void *userPtr)
RTC_API void rtcIntersect4(const int *valid, RTCScene scene, struct RTCIntersectContext *context, struct RTCRayHit4 *rayhit)
GLbitfield flags
Definition: glcorearb.h:1596
RTC_API void rtcIntersectNM(RTCScene scene, struct RTCIntersectContext *context, struct RTCRayHitN *rayhit, unsigned int N, unsigned int M, size_t byteStride)
unsigned int geomID1
Definition: rtcore_scene.h:144
GLdouble n
Definition: glcorearb.h:2008
RTC_API void rtcOccluded4(const int *valid, RTCScene scene, struct RTCIntersectContext *context, struct RTCRay4 *ray)
#define RTC_NAMESPACE_END
Definition: rtcore_config.h:23
struct RTCRayNp ray
Definition: rtcore_ray.h:211
RTC_API void rtcSetSceneBuildQuality(RTCScene scene, enum RTCBuildQuality quality)
RTC_API void rtcOccluded16(const int *valid, RTCScene scene, struct RTCIntersectContext *context, struct RTCRay16 *ray)
typedefRTC_NAMESPACE_BEGIN struct RTCSceneTy * RTCScene
auto ptr(T p) -> const void *
Definition: format.h:2448
GA_API const UT_StringHolder N
unsigned int primID0
Definition: rtcore_scene.h:144
bool(* RTCProgressMonitorFunction)(void *ptr, double n)
Definition: rtcore_scene.h:62
RTC_API bool rtcPointQuery16(const int *valid, RTCScene scene, struct RTCPointQuery16 *query, struct RTCPointQueryContext *context, RTCPointQueryFunction queryFunc, void **userPtr)
RTC_API void rtcRetainScene(RTCScene scene)
RTC_API void rtcJoinCommitScene(RTCScene scene)
RTC_API void rtcIntersect8(const int *valid, RTCScene scene, struct RTCIntersectContext *context, struct RTCRayHit8 *rayhit)
RTC_API void rtcIntersect1Mp(RTCScene scene, struct RTCIntersectContext *context, struct RTCRayHit **rayhit, unsigned int M)
RTC_API void rtcIntersectNp(RTCScene scene, struct RTCIntersectContext *context, const struct RTCRayHitNp *rayhit, unsigned int N)
RTCSceneFlags
Definition: rtcore_scene.h:18
bool(* RTCPointQueryFunction)(struct RTCPointQueryFunctionArguments *args)
GLenum query
Definition: glew.h:5734
RTC_API void rtcDetachGeometry(RTCScene scene, unsigned int geomID)
#define RTC_NAMESPACE_BEGIN
Definition: rtcore_config.h:22
RTC_API void rtcOccluded1(RTCScene scene, struct RTCIntersectContext *context, struct RTCRay *ray)
RTC_API RTCGeometry rtcGetGeometry(RTCScene scene, unsigned int geomID)