Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/cycles/scene/alembic_read.cpp')
-rw-r--r--intern/cycles/scene/alembic_read.cpp38
1 files changed, 36 insertions, 2 deletions
diff --git a/intern/cycles/scene/alembic_read.cpp b/intern/cycles/scene/alembic_read.cpp
index 07874b7528e..33908dff6e5 100644
--- a/intern/cycles/scene/alembic_read.cpp
+++ b/intern/cycles/scene/alembic_read.cpp
@@ -478,7 +478,9 @@ static void add_subd_polygons(CachedData &cached_data, const SubDSchemaData &dat
cached_data.uv_loops.add_data(uv_loops, time);
}
-static void add_subd_creases(CachedData &cached_data, const SubDSchemaData &data, chrono_t time)
+static void add_subd_edge_creases(CachedData &cached_data,
+ const SubDSchemaData &data,
+ chrono_t time)
{
if (!(data.crease_indices.valid() && data.crease_indices.valid() &&
data.crease_sharpnesses.valid())) {
@@ -517,6 +519,37 @@ static void add_subd_creases(CachedData &cached_data, const SubDSchemaData &data
}
}
+static void add_subd_vertex_creases(CachedData &cached_data,
+ const SubDSchemaData &data,
+ chrono_t time)
+{
+ if (!(data.corner_indices.valid() && data.crease_sharpnesses.valid())) {
+ return;
+ }
+
+ const ISampleSelector iss = ISampleSelector(time);
+ const Int32ArraySamplePtr creases_indices = data.crease_indices.getValue(iss);
+ const FloatArraySamplePtr creases_sharpnesses = data.crease_sharpnesses.getValue(iss);
+
+ if (!(creases_indices && creases_sharpnesses) ||
+ creases_indices->size() != creases_sharpnesses->size()) {
+ return;
+ }
+
+ array<float> sharpnesses;
+ sharpnesses.reserve(creases_indices->size());
+ array<int> indices;
+ indices.reserve(creases_indices->size());
+
+ for (size_t i = 0; i < creases_indices->size(); i++) {
+ indices.push_back_reserved((*creases_indices)[i]);
+ sharpnesses.push_back_reserved((*creases_sharpnesses)[i]);
+ }
+
+ cached_data.subd_vertex_crease_indices.add_data(indices, time);
+ cached_data.subd_vertex_crease_weights.add_data(sharpnesses, time);
+}
+
static void read_subd_geometry(CachedData &cached_data, const SubDSchemaData &data, chrono_t time)
{
const ISampleSelector iss = ISampleSelector(time);
@@ -525,7 +558,8 @@ static void read_subd_geometry(CachedData &cached_data, const SubDSchemaData &da
if (data.topology_variance != kHomogenousTopology || cached_data.shader.size() == 0) {
add_subd_polygons(cached_data, data, time);
- add_subd_creases(cached_data, data, time);
+ add_subd_edge_creases(cached_data, data, time);
+ add_subd_vertex_creases(cached_data, data, time);
}
}