RenderManAPI  24.0
pointcloud.h
Go to the documentation of this file.
1 /*
2 # ------------------------------------------------------------------------------
3 #
4 # Copyright (c) 2020 Pixar. All rights reserved.
5 #
6 # The information in this file (the "Software") is provided for the exclusive
7 # use of the software licensees of Pixar ("Licensees"). Licensees have the
8 # right to incorporate the Software into other products for use by other
9 # authorized software licensees of Pixar, without fee. Except as expressly
10 # permitted herein, the Software may not be disclosed to third parties, copied
11 # or duplicated in any form, in whole or in part, without the prior written
12 # permission of Pixar.
13 #
14 # The copyright notices in the Software and this entire statement, including the
15 # above license grant, this restriction and the following disclaimer, must be
16 # included in all copies of the Software, in whole or in part, and all permitted
17 # derivative works of the Software, unless such copies or derivative works are
18 # solely in the form of machine-executable object code generated by a source
19 # language processor.
20 #
21 # PIXAR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL PIXAR BE
23 # LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
24 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
25 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
26 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. IN NO CASE WILL
27 # PIXAR'S TOTAL LIABILITY FOR ALL DAMAGES ARISING OUT OF OR IN CONNECTION WITH
28 # THE USE OR PERFORMANCE OF THIS SOFTWARE EXCEED $50.
29 #
30 # Pixar
31 # 1200 Park Ave
32 # Emeryville CA 94608
33 #
34 # ------------------------------------------------------------------------------
35 */
36 
37 #ifndef _POINTCLOUD_
38 #define _POINTCLOUD_
39 
40 #include "prmanapi.h" // for PRMANAPI, int64_t
41 
42 typedef void* PtcPointCloud;
43 // PtcFilePos must be 64 bits on all platforms. (RtUint64 is defined
44 // in prmanapi.h)
45 typedef int64_t PtcFilePos; // a 64-bit signed integer on all platforms
46 
47 typedef struct PtcDataPoint
48 {
49  float position[3], normal[3];
50  float radius;
51  float* data;
52 } PtcDataPoint;
53 
54 typedef struct PtcTreeNode
55 {
56  int firstpoint; // index of first data point
57  int npoints; // number of data points in this octree node
58  float bbox[6]; // order: minx miny minz maxx maxy maxz
59  float* data;
61 } PtcTreeNode;
62 
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66 
67 /* Point cloud API version number */
68 #define RMAN_POINTCLOUD_API_VERSION 5
69 
70 /* Point cloud API */
71 
72 // Write
74  char* filename,
75  int nvars,
76  char** vartypes,
77  char** varnames,
78  float* world2eye,
79  float* world2ndc,
80  float* format);
81 
83  char* filename,
84  int npvars,
85  char** pvartypes,
86  char** pvarnames,
87  int ntvars,
88  char const** tvartypes,
89  char const** tvarnames,
90  float* world2eye,
91  float* world2ndc,
92  float* format);
93 
94 PRMANAPI extern int PtcWriteDataPoint(
95  PtcPointCloud pointcloud,
96  float* point,
97  float* normal,
98  float radius,
99  float* data);
100 
101 PRMANAPI extern int PtcWriteTreeNode(
102  PtcPointCloud pointcloud,
103  int firstpoint,
104  int npoints,
105  float bbox[6],
106  float* data,
107  PtcFilePos childpos[8],
108  PtcFilePos* filepos); // a result
109 
110 PRMANAPI extern void PtcFinishPointCloudFile(PtcPointCloud pointcloud);
111 
112 // Read
114  const char* filename,
115  int* nvars,
116  char** vartypes,
117  char** varnames); // superceded
118 
119 PRMANAPI extern PtcPointCloud PtcSafeOpenPointCloudFile(const char* filename);
120 
121 PRMANAPI extern int PtcGetPointCloudInfo(
122  PtcPointCloud pointcloud,
123  char const* request,
124  void* result);
125 
126 PRMANAPI extern void PtcReadBegin(PtcPointCloud pointcloud);
127 
128 PRMANAPI extern int PtcReadDataPoint(
129  PtcPointCloud pointcloud,
130  float* point,
131  float* normal,
132  float* radius,
133  float* data);
134 
135 PRMANAPI extern int PtcReadDataPoints(
136  PtcPointCloud pointcloud,
137  int firstpoint,
138  int npoints,
139  PtcDataPoint* pointlist);
140 
141 PRMANAPI extern int PtcReadTreeNode(
142  PtcPointCloud pointcloud,
143  PtcFilePos filepos,
144  int* firstpoint,
145  int* npoints,
146  float bbox[6],
147  float* data,
148  PtcFilePos childpos[8]);
149 
150 PRMANAPI extern int PtcReadTreeNodes(
151  PtcPointCloud pointcloud,
152  PtcFilePos filepos[8],
153  PtcTreeNode nodes[8]);
154 
156  PtcPointCloud pointcloud,
157  float* point,
158  float* normal,
159  float maxdist,
160  int numpoints,
161  float* data);
162 
163 PRMANAPI extern void PtcReadEnd(PtcPointCloud pointcloud);
164 
165 PRMANAPI extern void PtcClosePointCloudFile(PtcPointCloud pointcloud);
166 
167 #ifdef __cplusplus
168 }
169 #endif
170 
171 #endif /* _POINTCLOUD_ */
PRMANAPI PtcPointCloud PtcCreatePointCloudFile(char *filename, int nvars, char **vartypes, char **varnames, float *world2eye, float *world2ndc, float *format)
float bbox[6]
Definition: pointcloud.h:58
float normal[3]
Definition: pointcloud.h:49
PRMANAPI void PtcReadEnd(PtcPointCloud pointcloud)
PRMANAPI void PtcFinishPointCloudFile(PtcPointCloud pointcloud)
PRMANAPI void PtcReadBegin(PtcPointCloud pointcloud)
#define PRMANAPI
Definition: prmanapi.h:124
PRMANAPI int PtcWriteTreeNode(PtcPointCloud pointcloud, int firstpoint, int npoints, float bbox[6], float *data, PtcFilePos childpos[8], PtcFilePos *filepos)
int64_t PtcFilePos
Definition: pointcloud.h:45
int firstpoint
Definition: pointcloud.h:56
float * data
Definition: pointcloud.h:59
struct PtcDataPoint PtcDataPoint
PtcFilePos childpos[8]
Definition: pointcloud.h:60
PRMANAPI int PtcReadDataPoints(PtcPointCloud pointcloud, int firstpoint, int npoints, PtcDataPoint *pointlist)
void * PtcPointCloud
Definition: pointcloud.h:42
Definition: pointcloud.h:47
PRMANAPI int PtcGetPointCloudInfo(PtcPointCloud pointcloud, char const *request, void *result)
PRMANAPI PtcPointCloud PtcOpenPointCloudFile(const char *filename, int *nvars, char **vartypes, char **varnames)
PRMANAPI int PtcReadTreeNode(PtcPointCloud pointcloud, PtcFilePos filepos, int *firstpoint, int *npoints, float bbox[6], float *data, PtcFilePos childpos[8])
float * data
Definition: pointcloud.h:51
PRMANAPI PtcPointCloud PtcCreateOrgPointCloudFile(char *filename, int npvars, char **pvartypes, char **pvarnames, int ntvars, char const **tvartypes, char const **tvarnames, float *world2eye, float *world2ndc, float *format)
float radius
Definition: pointcloud.h:50
PRMANAPI int PtcWriteDataPoint(PtcPointCloud pointcloud, float *point, float *normal, float radius, float *data)
PRMANAPI int PtcReadTreeNodes(PtcPointCloud pointcloud, PtcFilePos filepos[8], PtcTreeNode nodes[8])
PRMANAPI int PtcReadDataPoint(PtcPointCloud pointcloud, float *point, float *normal, float *radius, float *data)
float position[3]
Definition: pointcloud.h:49
int npoints
Definition: pointcloud.h:57
PRMANAPI int PtcGetNearestPointsData(PtcPointCloud pointcloud, float *point, float *normal, float maxdist, int numpoints, float *data)
struct PtcTreeNode PtcTreeNode
PRMANAPI PtcPointCloud PtcSafeOpenPointCloudFile(const char *filename)
PRMANAPI void PtcClosePointCloudFile(PtcPointCloud pointcloud)
Definition: pointcloud.h:54