30 PassMain particle_ps_ = {
"particle_ps_"};
35 PassSimple edit_particle_ps_ = {
"edit_particle_ps_"};
39 bool show_weight_ =
false;
40 bool show_point_inner_ =
false;
41 bool show_point_tip_ =
false;
62 auto &pass = particle_ps_;
67 state.clipping_plane_count);
68 res.select_bind(pass);
70 auto &sub = pass.sub(
"Dots");
71 sub.shader_set(res.shaders->particle_dot.get());
72 sub.bind_texture(
"weight_tx", res.weight_ramp_tx);
76 auto &sub = pass.sub(
"Shapes");
77 sub.shader_set(res.shaders->particle_shape.get());
78 sub.bind_texture(
"weight_tx", res.weight_ramp_tx);
82 auto &sub = pass.sub(
"Hair");
83 sub.shader_set(res.shaders->particle_hair.get());
84 sub.push_constant(
"color_type",
state.v3d->shading.wire_color_type);
85 sub.push_constant(
"is_transform", is_transform);
91 auto &pass = edit_particle_ps_;
96 state.clipping_plane_count);
97 res.select_bind(pass);
99 auto &sub = pass.sub(
"Dots");
100 sub.shader_set(res.shaders->particle_edit_vert.get());
101 sub.bind_texture(
"weight_tx", res.weight_ramp_tx);
102 sub.push_constant(
"use_weight",
false);
103 sub.push_constant(
"use_grease_pencil",
false);
104 edit_vert_ps_ = ⊂
107 auto &sub = pass.sub(
"Edges");
108 sub.shader_set(res.shaders->particle_edit_edge.get());
109 sub.bind_texture(
"weight_tx", res.weight_ramp_tx);
110 sub.push_constant(
"use_weight", show_weight_);
111 sub.push_constant(
"use_grease_pencil",
false);
112 edit_edge_ps_ = ⊂
135 Object *object_eval = ob_ref.object;
139 if (edit ==
nullptr) {
144 auto find_active_evaluated_psys =
150 return particle_systems_eval.get(psys_index);
159 if (psys ==
nullptr) {
160 printf(
"Error getting evaluated particle system for edit.\n");
164 Object *ob = ob_ref.object;
167 ob_ref.particles_matrix());
171 edit_edge_ps_->draw(geom, handle);
173 if (show_point_inner_) {
175 edit_vert_ps_->draw(geom, handle);
177 if (show_point_tip_) {
179 edit_vert_ps_->draw(geom, handle);
192 Object *ob = ob_ref.object;
202 handle = manager.resource_handle_for_psys(ob_ref, ob_ref.particles_matrix());
213 blender::gpu::Batch *geom =
nullptr;
222 hair_ps_->push_constant(
"use_coloring",
true);
223 hair_ps_->draw(geom, handle, res.select_id(ob_ref).get());
239 dot_ps_->draw(geom, handle, res.select_id(ob_ref).get());
243 set_color(*shape_ps_);
245 shape_ps_->draw_expand(geom,
GPU_PRIM_LINES, 3, 1, handle, res.select_id(ob_ref).get());
249 set_color(*shape_ps_);
251 shape_ps_->draw_expand(geom,
256 res.select_id(ob_ref).get());
260 set_color(*shape_ps_);
262 shape_ps_->draw_expand(geom,
GPU_PRIM_LINES, 3, 1, handle, res.select_id(ob_ref).get());
274 manager.generate_commands(particle_ps_,
view);
284 manager.submit_only(particle_ps_,
view);
294 manager.submit(edit_particle_ps_,
view);
General operations, lookup, etc. for materials.
Material * BKE_object_material_get_eval(Object *ob, short act)
T * DEG_get_original(T *id)
PTCacheEdit * PE_get_current_from_psys(ParticleSystem *psys)
ParticleEditSettings * PE_settings(Scene *scene)
PTCacheEdit * PE_create_current(Depsgraph *depsgraph, Scene *scene, Object *ob)
void GPU_framebuffer_bind(blender::gpu::FrameBuffer *fb)
detail::PassBase< command::DrawMultiBuf > Sub
void object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state) final
void edit_object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &, const State &state) final
void draw(Framebuffer &framebuffer, Manager &manager, View &view) final
void begin_sync(Resources &res, const State &state) final
void pre_draw(Manager &manager, View &view) final
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
bool DRW_object_is_visible_psys_in_active_context(const Object *object, const ParticleSystem *psys)
#define DRW_CLIPPING_UBO_SLOT
#define OVERLAY_GLOBALS_SLOT
@ DRW_STATE_DEPTH_LESS_EQUAL
gpu::Batch * DRW_cache_particles_get_edit_inner_points(Object *object, ParticleSystem *psys, PTCacheEdit *edit)
detail::Pass< command::DrawCommandBuf > PassSimple
detail::Pass< command::DrawMultiBuf > PassMain
gpu::Batch * DRW_cache_particles_get_dots(Object *object, ParticleSystem *psys)
gpu::Batch * DRW_cache_particles_get_edit_tip_points(Object *object, ParticleSystem *psys, PTCacheEdit *edit)
gpu::Batch * DRW_cache_particles_get_hair(Object *object, ParticleSystem *psys, ModifierData *md)
gpu::Batch * DRW_cache_particles_get_edit_strands(Object *object, ParticleSystem *psys, PTCacheEdit *edit, bool use_weight)
VecBase< float, 4 > float4
ListBaseWrapperTemplate< ListBase, T > ListBaseWrapper
VecBase< float, 3 > float3
#define PARTICLE_SHAPE_CIRCLE_RESOLUTION