RenderMan API  23.0
pointcloud.h
Go to the documentation of this file.
1 /*
2 # ------------------------------------------------------------------------------
3 #
4 # Copyright (c) 1986-2019 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 
38 #ifndef _POINTCLOUD_
39 #define _POINTCLOUD_
40 
41 #include "prmanapi.h" // for PRMANAPI, int64_t
42 
43 typedef void* PtcPointCloud;
44 // PtcFilePos must be 64 bits on all platforms. (RtUint64 is defined
45 // in prmanapi.h)
46 typedef int64_t PtcFilePos; // a 64-bit signed integer on all platforms
47 
48 typedef struct PtcDataPoint
49 {
50  float position[3], normal[3];
51  float radius;
52  float* data;
53 } PtcDataPoint;
54 
55 typedef struct PtcTreeNode
56 {
57  int firstpoint; // index of first data point
58  int npoints; // number of data points in this octree node
59  float bbox[6]; // order: minx miny minz maxx maxy maxz
60  float* data;
61  PtcFilePos childpos[8];
62 } PtcTreeNode;
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 
68 /* Point cloud API version number */
69 #define RMAN_POINTCLOUD_API_VERSION 5
70 
71 /* Point cloud API */
72 
73 // Write
75  char* filename,
76  int nvars,
77  char** vartypes,
78  char** varnames,
79  float* world2eye,
80  float* world2ndc,
81  float* format);
82 
84  char* filename,
85  int npvars,
86  char** pvartypes,
87  char** pvarnames,
88  int ntvars,
89  char const** tvartypes,
90  char const** tvarnames,
91  float* world2eye,
92  float* world2ndc,
93  float* format);
94 
95 PRMANAPI extern int PtcWriteDataPoint(
96  PtcPointCloud pointcloud,
97  float* point,
98  float* normal,
99  float radius,
100  float* data);
101 
102 PRMANAPI extern int PtcWriteTreeNode(
103  PtcPointCloud pointcloud,
104  int firstpoint,
105  int npoints,
106  float bbox[6],
107  float* data,
108  PtcFilePos childpos[8],
109  PtcFilePos* filepos); // a result
110 
111 PRMANAPI extern void PtcFinishPointCloudFile(PtcPointCloud pointcloud);
112 
113 // Read
115  const char* filename,
116  int* nvars,
117  char** vartypes,
118  char** varnames); // superceded
119 
120 PRMANAPI extern PtcPointCloud PtcSafeOpenPointCloudFile(const char* filename);
121 
122 PRMANAPI extern int PtcGetPointCloudInfo(
123  PtcPointCloud pointcloud,
124  char const* request,
125  void* result);
126 
127 PRMANAPI extern void PtcReadBegin(PtcPointCloud pointcloud);
128 
129 PRMANAPI extern int PtcReadDataPoint(
130  PtcPointCloud pointcloud,
131  float* point,
132  float* normal,
133  float* radius,
134  float* data);
135 
136 PRMANAPI extern int PtcReadDataPoints(
137  PtcPointCloud pointcloud,
138  int firstpoint,
139  int npoints,
140  PtcDataPoint* pointlist);
141 
142 PRMANAPI extern int PtcReadTreeNode(
143  PtcPointCloud pointcloud,
144  PtcFilePos filepos,
145  int* firstpoint,
146  int* npoints,
147  float bbox[6],
148  float* data,
149  PtcFilePos childpos[8]);
150 
151 PRMANAPI extern int PtcReadTreeNodes(
152  PtcPointCloud pointcloud,
153  PtcFilePos filepos[8],
154  PtcTreeNode nodes[8]);
155 
157  PtcPointCloud pointcloud,
158  float* point,
159  float* normal,
160  float maxdist,
161  int numpoints,
162  float* data);
163 
164 PRMANAPI extern void PtcReadEnd(PtcPointCloud pointcloud);
165 
166 PRMANAPI extern void PtcClosePointCloudFile(PtcPointCloud pointcloud);
167 
168 #ifdef __cplusplus
169 }
170 #endif
171 
172 #endif /* _POINTCLOUD_ */
PRMANAPI PtcPointCloud PtcCreatePointCloudFile(char *filename, int nvars, char **vartypes, char **varnames, float *world2eye, float *world2ndc, float *format)
PRMANAPI void PtcReadEnd(PtcPointCloud pointcloud)
PRMANAPI void PtcFinishPointCloudFile(PtcPointCloud pointcloud)
PRMANAPI void PtcReadBegin(PtcPointCloud pointcloud)
#define PRMANAPI
Definition: prmanapi.h:111
float normal[3]
Definition: pointcloud.h:50
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:46
float * data
Definition: pointcloud.h:60
struct PtcDataPoint PtcDataPoint
int firstpoint
Definition: pointcloud.h:57
PRMANAPI int PtcReadDataPoints(PtcPointCloud pointcloud, int firstpoint, int npoints, PtcDataPoint *pointlist)
float * data
Definition: pointcloud.h:52
void * PtcPointCloud
Definition: pointcloud.h:43
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])
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 position[3]
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)
PRMANAPI int PtcGetNearestPointsData(PtcPointCloud pointcloud, float *point, float *normal, float maxdist, int numpoints, float *data)
struct PtcTreeNode PtcTreeNode
float radius
Definition: pointcloud.h:51
PRMANAPI PtcPointCloud PtcSafeOpenPointCloudFile(const char *filename)
PRMANAPI void PtcClosePointCloudFile(PtcPointCloud pointcloud)