Blender  V3.3
alembic_read.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2021-2022 Blender Foundation */
3 
4 #pragma once
5 
6 #ifdef WITH_ALEMBIC
7 
8 # include <Alembic/AbcCoreFactory/All.h>
9 # include <Alembic/AbcGeom/All.h>
10 
11 # include "util/vector.h"
12 
14 
15 class AlembicProcedural;
17 class Progress;
18 struct CachedData;
19 
20 /* Maps a FaceSet whose name matches that of a Shader to the index of said shader in the Geometry's
21  * used_shaders list. */
22 struct FaceSetShaderIndexPair {
23  Alembic::AbcGeom::IFaceSet face_set;
24  int shader_index;
25 };
26 
27 /* Data of an IPolyMeshSchema that we need to read. */
28 struct PolyMeshSchemaData {
29  Alembic::AbcGeom::TimeSamplingPtr time_sampling;
30  size_t num_samples;
31  Alembic::AbcGeom::MeshTopologyVariance topology_variance;
32 
33  Alembic::AbcGeom::IP3fArrayProperty positions;
34  Alembic::AbcGeom::IInt32ArrayProperty face_indices;
35  Alembic::AbcGeom::IInt32ArrayProperty face_counts;
36 
37  Alembic::AbcGeom::IN3fGeomParam normals;
38 
39  vector<FaceSetShaderIndexPair> shader_face_sets;
40 
41  // Unsupported for now.
42  Alembic::AbcGeom::IV3fArrayProperty velocities;
43 };
44 
45 void read_geometry_data(AlembicProcedural *proc,
46  CachedData &cached_data,
47  const PolyMeshSchemaData &data,
48  Progress &progress);
49 
50 /* Data of an ISubDSchema that we need to read. */
51 struct SubDSchemaData {
52  Alembic::AbcGeom::TimeSamplingPtr time_sampling;
53  size_t num_samples;
54  Alembic::AbcGeom::MeshTopologyVariance topology_variance;
55 
56  Alembic::AbcGeom::IInt32ArrayProperty face_counts;
57  Alembic::AbcGeom::IInt32ArrayProperty face_indices;
58  Alembic::AbcGeom::IP3fArrayProperty positions;
59 
60  Alembic::AbcGeom::IInt32ArrayProperty crease_indices;
61  Alembic::AbcGeom::IInt32ArrayProperty crease_lengths;
62  Alembic::AbcGeom::IFloatArrayProperty crease_sharpnesses;
63 
64  vector<FaceSetShaderIndexPair> shader_face_sets;
65 
66  Alembic::AbcGeom::IInt32ArrayProperty corner_indices;
67  Alembic::AbcGeom::IFloatArrayProperty corner_sharpnesses;
68 
69  // Those are unsupported for now.
70  Alembic::AbcGeom::IInt32Property face_varying_interpolate_boundary;
71  Alembic::AbcGeom::IInt32Property face_varying_propagate_corners;
72  Alembic::AbcGeom::IInt32Property interpolate_boundary;
73  Alembic::AbcGeom::IInt32ArrayProperty holes;
74  Alembic::AbcGeom::IStringProperty subdivision_scheme;
75  Alembic::AbcGeom::IV3fArrayProperty velocities;
76 };
77 
78 void read_geometry_data(AlembicProcedural *proc,
79  CachedData &cached_data,
80  const SubDSchemaData &data,
81  Progress &progress);
82 
83 /* Data of a ICurvesSchema that we need to read. */
84 struct CurvesSchemaData {
85  Alembic::AbcGeom::TimeSamplingPtr time_sampling;
86  size_t num_samples;
87  Alembic::AbcGeom::MeshTopologyVariance topology_variance;
88 
89  Alembic::AbcGeom::IP3fArrayProperty positions;
90 
91  Alembic::AbcGeom::IInt32ArrayProperty num_vertices;
92 
93  float default_radius;
94  float radius_scale;
95 
96  // Those are unsupported for now.
97  Alembic::AbcGeom::IV3fArrayProperty velocities;
98  // if this property is invalid then the weight for every point is 1
99  Alembic::AbcGeom::IFloatArrayProperty position_weights;
100  Alembic::AbcGeom::IN3fGeomParam normals;
101  Alembic::AbcGeom::IFloatGeomParam widths;
102  Alembic::AbcGeom::IUcharArrayProperty orders;
103  Alembic::AbcGeom::IFloatArrayProperty knots;
104 
105  // TODO(@kevindietrich): type, basis, wrap
106 };
107 
108 void read_geometry_data(AlembicProcedural *proc,
109  CachedData &cached_data,
110  const CurvesSchemaData &data,
111  Progress &progress);
112 
113 /* Data of a ICurvesSchema that we need to read. */
114 struct PointsSchemaData {
115  Alembic::AbcGeom::TimeSamplingPtr time_sampling;
116  size_t num_samples;
117 
118  float default_radius;
119  float radius_scale;
120 
121  Alembic::AbcGeom::IP3fArrayProperty positions;
122  Alembic::AbcGeom::IInt32ArrayProperty num_points;
123  Alembic::AbcGeom::IFloatGeomParam radiuses;
124  // Those are unsupported for now.
125  Alembic::AbcGeom::IV3fArrayProperty velocities;
126 };
127 
128 void read_geometry_data(AlembicProcedural *proc,
129  CachedData &cached_data,
130  const PointsSchemaData &data,
131  Progress &progress);
132 
133 void read_attributes(AlembicProcedural *proc,
134  CachedData &cache,
135  const Alembic::AbcGeom::ICompoundProperty &arb_geom_params,
136  const Alembic::AbcGeom::IV2fGeomParam &default_uvs_param,
137  const AttributeRequestSet &requested_attributes,
138  Progress &progress);
139 
141 
142 #endif
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
ccl_gpu_kernel_postfix ccl_global float int int int int ccl_global const float int int int int int int int int int int int int num_samples
MutableSpan< float3 > positions
MutableSpan< float3 > normals