47 float initial_time = scene->
r.
cfra + scene->r.subframe;
51 inst_.set_time(initial_time);
75 if (!is_velocity_type || (!partsys_is_visible && !object_is_visible)) {
84 if (partsys_is_visible) {
88 ob, hair_handle.
object_key, resource_handle, hair_handle.
recalc, &md, &particle_sys);
93 if (object_is_visible) {
100 inst_.set_time(time);
143 if (!has_motion && !has_deform) {
175 auto add_cb = [&]() {
207 if (data.pos_buf ==
nullptr) {
213 if (step_ ==
STEP_CURRENT && has_motion ==
true && has_deform ==
false) {
218 has_motion = (obmat_curr != obmat_prev);
221 has_motion = (obmat_curr != obmat_prev || obmat_curr != obmat_next);
226 if (!has_motion && !has_deform) {
227 std::cout <<
"Detected no motion on " << ob->
id.
name << std::endl;
230 std::cout <<
"Geometry Motion on " << ob->
id.
name << std::endl;
233 std::cout <<
"Object Motion on " << ob->
id.
name << std::endl;
237 if (!has_motion && !has_deform) {
267 if (!geom.pos_buf || geom.len == 0) {
271 if (
format->stride == 16) {
274 geom.ofs *
sizeof(
float4),
276 geom.len *
sizeof(
float4));
280 copy_ps.
bind_ssbo(
"in_buf", geom.pos_buf);
286 copy_ps.
dispatch(
int3(group_len_x / verts_per_thread, 1, 1));
297 vel.geo.
len[step_] = geom.
len;
298 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);
352 if (item.value.obj.resource_id ==
uint32_t(-1)) {
353 deleted_obj.
append(item.key);
356 max_resource_id_ =
max_uu(max_resource_id_, item.value.obj.resource_id);
360 for (
auto &key : deleted_obj) {
375 vel.geo.do_deform = pos_buf !=
nullptr &&
385 vel.obj.resource_id =
uint(-1);
396bool VelocityModule::object_has_velocity(
const Object *ob)
409 const bool object_moves =
true;
414bool VelocityModule::object_is_deform(
const Object *ob)
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.
#define DRW_shgroup_uniform_block_ref(shgroup, name, ubo)
#define DRW_shgroup_storage_block_ref(shgroup, name, ssbo)
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)
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object instance
void append(const T &value)
void submit(PassSimple &pass, View &view)
void resize(int64_t new_size)
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)
const CameraData & data_get() const
eViewLayerEEVEEPassType enabled_passes_get() const
A running instance of the engine.
MotionBlurModule motion_blur
bool postfx_enabled() const
GPUShader * static_shader_get(eShaderType shader_type)
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
void bind_resources(DRWShadingGroup *grp)
bool step_object_sync(Object *ob, ObjectKey &object_key, ResourceHandle resource_handle, int recalc=0, ModifierData *modifier_data=nullptr, ParticleSystem *particle_sys=nullptr)
void step_sync(eVelocityStep step, float time)
Map< uint64_t, VelocityGeometryData > geometry_map
blender::gpu::VertBuf * DRW_cache_object_pos_vertbuf_get(Object *ob)
blender::gpu::VertBuf * DRW_hair_pos_buffer_get(Object *object, ParticleSystem *psys, ModifierData *md)
blender::draw::ObjectRef DRW_object_ref_get(Object *object)
bool DRW_object_is_renderable(const Object *ob)
int DRW_object_visibility_in_active_context(const Object *ob)
void DRW_render_object_iter(void *vedata, RenderEngine *engine, Depsgraph *depsgraph, void(*callback)(void *vedata, Object *ob, RenderEngine *engine, Depsgraph *depsgraph))
#define VERTEX_COPY_GROUP_SIZE
gpu::VertBuf * curves_pos_buffer_get(Scene *scene, Object *object)
void hair_update(Manager &manager)
void curves_update(Manager &manager)
gpu::VertBuf * hair_pos_buffer_get(Scene *scene, Object *object, ParticleSystem *psys, ModifierData *md)
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(void *instance, Object *ob, RenderEngine *, Depsgraph *)
void foreach_hair_particle_handle(Object *ob, ObjectHandle ob_handle, HairHandleCallback callback)
T step(const T &edge, const T &value)
VecBase< int32_t, 3 > int3
unsigned __int64 uint64_t
struct RigidBodyOb * rigidbody_object
uint resource_index() const