43 if (!inst_.is_viewport() && !inst_.is_baking() &&
45 !inst_.motion_blur.postfx_enabled())
48 const Scene *scene = inst_.scene;
53 inst_.set_time(initial_time);
74 if (!is_velocity_type || (!partsys_is_visible && !object_is_visible)) {
82 if (partsys_is_visible) {
87 hair_handle.
object_key, ob_ref, hair_handle.
recalc, resource_handle, &md, &particle_sys);
92 if (object_is_visible) {
100 inst_.set_time(time);
108 step_object_sync_render(inst_, ob_ref);
118 step_time[step_] = inst_.scene->r.cfra + inst_.scene->r.subframe;
140 if (!has_motion && !has_deform) {
165 if (inst_.is_viewport()) {
178 auto add_cb = [&]() {
200 if (!
data.has_data()) {
206 if (step_ ==
STEP_CURRENT && has_motion ==
true && has_deform ==
false) {
209 if (inst_.is_viewport()) {
210 has_motion = (obmat_curr != obmat_prev);
214 has_motion = (obmat_curr != obmat_prev || obmat_curr != obmat_next);
219 if (!has_motion && !has_deform) {
220 std::cout <<
"Detected no motion on " << ob->
id.
name << std::endl;
223 std::cout <<
"Geometry Motion on " << ob->
id.
name << std::endl;
226 std::cout <<
"Object Motion on " << ob->
id.
name << std::endl;
230 if (!has_motion && !has_deform) {
264 if (!pos_buf || geom.len == 0) {
268 if (
format->stride == 16) {
271 geom.ofs *
sizeof(
float4),
273 geom.len *
sizeof(
float4));
283 copy_ps.
dispatch(
int3(group_len_x / verts_per_thread, 1, 1));
288 inst_.manager->submit(copy_ps);
296 vel.geo.len[step_] = geom.
len;
297 vel.geo.ofs[step_] = geom.
ofs;
315 vel.obj.ofs[step_a] = vel.obj.ofs[step_b];
316 vel.obj.ofs[step_b] =
uint(-1);
317 vel.geo.ofs[step_a] = vel.geo.ofs[step_b];
318 vel.geo.len[step_a] = vel.geo.len[step_b];
319 vel.geo.ofs[step_b] =
uint(-1);
320 vel.geo.len[step_b] =
uint(-1);
324 if (inst_.is_viewport()) {
352 uint32_t max_resource_id_ = 0u;
355 if (item.value.obj.resource_id == uint32_t(-1)) {
356 deleted_obj.
append(item.key);
359 max_resource_id_ =
max_uu(max_resource_id_, item.value.obj.resource_id);
363 for (
auto &key : deleted_obj) {
373 if (inst_.is_viewport()) {
379 vel.geo.do_deform = pos_buf !=
nullptr &&
389 vel.obj.resource_id =
uint(-1);
400bool VelocityModule::object_has_velocity(
const Object *ob)
413 const bool object_moves =
true;
418bool VelocityModule::object_is_deform(
const Object *ob)
432 if (inst_.is_viewport()) {
443 if (inst_.is_viewport()) {
General operations, lookup, etc. for blender objects.
int BKE_object_is_deform_modified(Scene *scene, Object *ob)
bool BKE_object_moves_in_time(const Object *object, bool recurse_parent)
MINLINE uint ceil_to_multiple_u(uint a, uint b)
MINLINE uint divide_ceil_u(uint a, uint b)
MINLINE uint max_uu(uint a, uint b)
MINLINE int max_ii(int a, int b)
@ EEVEE_RENDER_PASS_VECTOR
Types and defines for representing Rigid Body entities.
void DRW_submission_end()
void DRW_submission_start()
int GPU_max_work_group_count(int index)
@ GPU_BARRIER_SHADER_STORAGE
void GPU_storagebuf_copy_sub_from_vertbuf(blender::gpu::StorageBuf *ssbo, blender::gpu::VertBuf *src, uint dst_offset, uint src_offset, uint copy_size)
Copy a part of a vertex buffer to a storage buffer.
const GPUVertFormat * GPU_vertbuf_get_format(const blender::gpu::VertBuf *verts)
uint GPU_vertbuf_get_vertex_len(const blender::gpu::VertBuf *verts)
BMesh const char void * data
unsigned long long int uint64_t
void append(const T &value)
uint resource_index() const
void shader_set(gpu::Shader *shader)
void dispatch(int group_len)
void state_set(DRWState state, int clip_plane_count=0)
void barrier(GPUBarrier type)
void push_constant(const char *name, const float &data)
void bind_ssbo(const char *name, gpu::StorageBuf *buffer)
A running instance of the engine.
ObjectHandle & sync_object(const ObjectRef &ob_ref)
float step_time_delta_get(eVelocityStep start, eVelocityStep end) const
Map< ObjectKey, VelocityObjectData > velocity_map
std::array< CameraDataBuf *, 3 > camera_steps
bool camera_changed_projection() const
std::array< VelocityObjectBuf *, 3 > object_steps
void geometry_steps_fill()
VelocityIndexBuf indirection_buf
bool camera_has_motion() const
std::array< VelocityGeometryBuf *, 3 > geometry_steps
bool step_object_sync(ObjectKey &object_key, const ObjectRef &object_ref, int recalc, ResourceHandleRange resource_handle, ModifierData *modifier_data=nullptr, ParticleSystem *particle_sys=nullptr)
void step_sync(eVelocityStep step, float time)
Map< uint64_t, VelocityGeometryData > geometry_map
void DRW_render_object_iter(RenderEngine *engine, Depsgraph *depsgraph, std::function< void(blender::draw::ObjectRef &, RenderEngine *, Depsgraph *)> callback)
bool DRW_object_is_renderable(const Object *ob)
int DRW_object_visibility_in_active_context(const Object *ob)
#define VERTEX_COPY_GROUP_SIZE
detail::Pass< command::DrawCommandBuf > PassSimple
gpu::VertBuf * curves_pos_buffer_get(Object *object)
gpu::VertBuf * hair_pos_buffer_get(Scene *scene, Object *object, ParticleSystem *psys, ModifierData *md)
gpu::Batch * DRW_cache_mesh_surface_get(Object *ob)
gpu::VertBuf * DRW_pointcloud_position_and_radius_buffer_get(Object *ob)
static void step_object_sync_render(Instance &inst, ObjectRef &ob_ref)
void foreach_hair_particle_handle(Instance &inst, ObjectRef &ob_ref, ObjectHandle ob_handle, HairHandleCallback callback)
T step(const T &edge, const T &value)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 3 > int3
struct RigidBodyOb * rigidbody_object