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 = [&]() {
181 if (inst_.is_viewport()) {
191 if (inst_.is_viewport()) {
210 if (!
data.has_data()) {
216 if (step_ ==
STEP_CURRENT && has_motion ==
true && has_deform ==
false) {
219 if (inst_.is_viewport()) {
220 has_motion = (obmat_curr != obmat_prev);
224 has_motion = (obmat_curr != obmat_prev || obmat_curr != obmat_next);
229 if (!has_motion && !has_deform) {
230 std::cout <<
"Detected no motion on " << ob->
id.
name << std::endl;
233 std::cout <<
"Geometry Motion on " << ob->
id.
name << std::endl;
236 std::cout <<
"Object Motion on " << ob->
id.
name << std::endl;
240 if (!has_motion && !has_deform) {
274 if (!pos_buf || geom.len == 0) {
278 if (
format->stride == 16) {
281 geom.ofs *
sizeof(
float4),
283 geom.len *
sizeof(
float4));
293 copy_ps.
dispatch(
int3(group_len_x / verts_per_thread, 1, 1));
298 inst_.manager->submit(copy_ps);
306 vel.geo.len[step_] = geom.
len;
307 vel.geo.ofs[step_] = geom.
ofs;
325 vel.obj.ofs[step_a] = vel.obj.ofs[step_b];
326 vel.obj.ofs[step_b] =
uint(-1);
327 vel.geo.ofs[step_a] = vel.geo.ofs[step_b];
328 vel.geo.len[step_a] = vel.geo.len[step_b];
329 vel.geo.ofs[step_b] =
uint(-1);
330 vel.geo.len[step_b] =
uint(-1);
334 if (inst_.is_viewport()) {
362 uint32_t max_resource_id_ = 0u;
365 if (item.value.obj.resource_id == uint32_t(-1)) {
366 deleted_obj.
append(item.key);
369 max_resource_id_ =
max_uu(max_resource_id_, item.value.obj.resource_id);
373 for (
auto &key : deleted_obj) {
383 if (inst_.is_viewport()) {
389 vel.geo.do_deform = pos_buf !=
nullptr &&
399 vel.obj.resource_id =
uint(-1);
410bool VelocityModule::object_has_velocity(
const Object *ob)
423 const bool object_moves =
true;
428bool VelocityModule::object_is_deform(
const Object *ob)
442 if (inst_.is_viewport()) {
453 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(GPUStorageBuf *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)
void dispatch(int group_len)
void barrier(eGPUBarrier type)
void state_set(DRWState state, int clip_plane_count=0)
void push_constant(const char *name, const float &data)
void bind_ssbo(const char *name, GPUStorageBuf *buffer)
void shader_set(GPUShader *shader)
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 step_object_sync(ObjectKey &object_key, const ObjectRef &object_ref, int recalc, ResourceHandle resource_handle, ModifierData *modifier_data=nullptr, ParticleSystem *particle_sys=nullptr)
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
void step_sync(eVelocityStep step, float time)
Map< uint64_t, VelocityGeometryData > geometry_map
blender::gpu::VertBuf * DRW_hair_pos_buffer_get(Object *object, ParticleSystem *psys, ModifierData *md)
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
gpu::VertBuf * curves_pos_buffer_get(Scene *scene, Object *object)
detail::Pass< command::DrawCommandBuf > PassSimple
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)
gpu::VertBuf * DRW_curves_pos_buffer_get(Object *object)
static void step_object_sync_render(Instance &inst, ObjectRef &ob_ref)
void foreach_hair_particle_handle(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
uint resource_index() const