[Bf-blender-cvs] [ed417d796be] fluid-mantaflow: Mantaflow: Update other /intern packages
Sebastián Barschkis
noreply at git.blender.org
Sat Apr 6 22:12:57 CEST 2019
Commit: ed417d796be168b0468af4f634907ab848d7b6c0
Author: Sebastián Barschkis
Date: Sun Oct 28 15:56:59 2018 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rBed417d796be168b0468af4f634907ab848d7b6c0
Mantaflow: Update other /intern packages
Disabled old smoke code and added new speed vector code to cycles
===================================================================
M intern/CMakeLists.txt
M intern/cycles/blender/blender_mesh.cpp
M intern/cycles/blender/blender_session.cpp
M intern/smoke/CMakeLists.txt
===================================================================
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index c7f0f414fb1..a91558d3260 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -48,10 +48,6 @@ if(WITH_MOD_FLUID)
add_subdirectory(elbeem)
endif()
-if(WITH_MOD_SMOKE)
- add_subdirectory(smoke)
-endif()
-
if(WITH_IK_SOLVER)
add_subdirectory(iksolver)
endif()
@@ -77,6 +73,10 @@ if(WIN32)
add_subdirectory(utfconv)
endif()
+if(WITH_MOD_MANTA)
+ add_subdirectory(mantaflow)
+endif()
+
if(WITH_OPENVDB)
add_subdirectory(openvdb)
endif()
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index b97c250adf6..2b07a0ed572 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -938,6 +938,43 @@ static void create_subd_mesh(Scene *scene,
/* Sync */
+static void sync_mesh_manta_motion(BL::Object& b_ob, Scene *scene, Mesh *mesh)
+{
+ if(scene->need_motion() == Scene::MOTION_NONE)
+ return;
+
+ BL::SmokeDomainSettings b_smoke_domain = object_smoke_domain_find(b_ob);
+
+ if(!b_smoke_domain)
+ return;
+
+ /* If the mesh has modifiers following the fluid domain we can't export motion. */
+ if(b_smoke_domain.mesh_vertices.length() != mesh->verts.size())
+ return;
+
+ /* Find or add attribute */
+ float3 *P = &mesh->verts[0];
+ Attribute *attr_mP = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
+
+ if(!attr_mP) {
+ attr_mP = mesh->attributes.add(ATTR_STD_MOTION_VERTEX_POSITION);
+ }
+
+ /* Only export previous and next frame, we don't have any in between data. */
+ float motion_times[2] = {-1.0f, 1.0f};
+ for(int step = 0; step < 2; step++) {
+ float relative_time = motion_times[step] * scene->motion_shutter_time() * 0.5f;
+ float3 *mP = attr_mP->data_float3() + step*mesh->verts.size();
+
+ BL::SmokeDomainSettings::mesh_vertices_iterator svi;
+ int i = 0;
+
+ for(b_smoke_domain.mesh_vertices.begin(svi); svi != b_smoke_domain.mesh_vertices.end(); ++svi, ++i) {
+ mP[i] = P[i] + get_float3(svi->velocity()) * relative_time;
+ }
+ }
+}
+
static void sync_mesh_fluid_motion(BL::Object& b_ob, Scene *scene, Mesh *mesh)
{
if(scene->need_motion() == Scene::MOTION_NONE)
@@ -1102,6 +1139,9 @@ Mesh *BlenderSync::sync_mesh(BL::Depsgraph& b_depsgraph,
}
mesh->geometry_flags = requested_geometry_flags;
+ /* mesh fluid motion mantaflow */
+ sync_mesh_manta_motion(b_ob, scene, mesh);
+
/* fluid motion */
sync_mesh_fluid_motion(b_ob, scene, mesh);
@@ -1152,6 +1192,11 @@ void BlenderSync::sync_mesh_motion(BL::Depsgraph& b_depsgraph,
* would need a more extensive check to see which objects are animated */
BL::Mesh b_mesh(PointerRNA_NULL);
+ /* manta motion is exported immediate with mesh, skip here */
+ BL::SmokeDomainSettings b_smoke_domain = object_smoke_domain_find(b_ob);
+ if(b_smoke_domain)
+ return;
+
/* fluid motion is exported immediate with mesh, skip here */
BL::DomainFluidSettings b_fluid_domain = object_fluid_domain_find(b_ob);
if(b_fluid_domain)
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 4ac0e1f21c1..326b5786d18 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -1086,7 +1086,7 @@ void BlenderSession::builtin_image_info(const string &builtin_name,
return;
int3 resolution = get_int3(b_domain.domain_resolution());
- int amplify = (b_domain.use_high_resolution())? b_domain.amplify() + 1: 1;
+ int amplify = (b_domain.use_noise())? b_domain.noise_scale() : 1;
/* Velocity and heat data is always low-resolution. */
if(builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY) ||
@@ -1247,7 +1247,7 @@ bool BlenderSession::builtin_image_float_pixels(const string &builtin_name,
}
int3 resolution = get_int3(b_domain.domain_resolution());
- int length, amplify = (b_domain.use_high_resolution())? b_domain.amplify() + 1: 1;
+ int length, amplify = (b_domain.use_noise()) ? b_domain.noise_scale() : 1;
/* Velocity and heat data is always low-resolution. */
if(builtin_name == Attribute::standard_name(ATTR_STD_VOLUME_VELOCITY) ||
diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt
index a95d8281974..7faa9a4c508 100644
--- a/intern/smoke/CMakeLists.txt
+++ b/intern/smoke/CMakeLists.txt
@@ -98,4 +98,5 @@ if(WITH_FFTW3)
)
endif()
-blender_add_lib(bf_intern_smoke "${SRC}" "${INC}" "${INC_SYS}")
+# (sebbas): intern/smoke deprecated
+#blender_add_lib(bf_intern_smoke "${SRC}" "${INC}" "${INC_SYS}")
More information about the Bf-blender-cvs
mailing list