37 int dominant_axis = -1;
49 auto &pass = fluid_ps_;
52 state.clipping_plane_count);
53 res.select_bind(pass);
57 velocity_needle_ps_ = &fluid_ps_.sub(
"Velocity Needles");
58 velocity_needle_ps_->shader_set(res.shaders->fluid_velocity_needle.get());
60 velocity_mac_ps_ = &fluid_ps_.sub(
"Velocity Mac");
61 velocity_mac_ps_->shader_set(res.shaders->fluid_velocity_mac.get());
63 velocity_streamline_ps_ = &fluid_ps_.sub(
"Velocity Line");
64 velocity_streamline_ps_->shader_set(res.shaders->fluid_velocity_streamline.get());
66 grid_lines_flags_ps_ = &fluid_ps_.sub(
"Velocity Mac");
67 grid_lines_flags_ps_->shader_set(res.shaders->fluid_grid_lines_flags.get());
69 grid_lines_flat_ps_ = &fluid_ps_.sub(
"Velocity Needles");
70 grid_lines_flat_ps_->shader_set(res.shaders->fluid_grid_lines_flat.get());
72 grid_lines_range_ps_ = &fluid_ps_.sub(
"Velocity Line");
73 grid_lines_range_ps_->shader_set(res.shaders->fluid_grid_lines_range.get());
84 Object *ob = ob_ref.object;
101 if (fds ==
nullptr) {
107 const bool is_active_frame_in_cache_range = is_active_frame_after_cache_start &&
108 is_active_frame_before_cache_end;
109 if (!is_active_frame_in_cache_range) {
122 voxel_cube_mat = ob->object_to_world() * voxel_cube_mat;
125 cube_buf_.append({voxel_cube_mat,
color, 1.0f}, sel_id);
129 if (fds->
fluid ==
nullptr) {
133 int slice_axis = slide_axis_get(*fds);
136 int lines_per_voxel = -1;
141 sub_pass = velocity_streamline_ps_;
145 sub_pass = velocity_needle_ps_;
149 sub_pass = velocity_mac_ps_;
155 if (slice_axis != -1) {
157 total_lines /= fds->
res[slice_axis];
189 if (show_gridlines) {
196 sub_pass = grid_lines_flags_ps_;
204 sub_pass = grid_lines_range_ps_;
216 sub_pass = grid_lines_flat_ps_;
230 int lines_per_voxel = 4;
238 fluid_ps_.shader_set(res.shaders->extra_shape.get());
242 cube_buf_.end_sync(fluid_ps_, res.shapes.cube.get());
248 manager.submit(fluid_ps_,
view);
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
@ FLUID_GRIDLINE_COLOR_TYPE_FLAGS
@ FLUID_GRIDLINE_COLOR_TYPE_RANGE
@ FLUID_GRIDLINE_COLOR_TYPE_NONE
@ FLUID_DOMAIN_FIELD_FLAGS
@ FLUID_DISPLAY_INTERP_CLOSEST
@ FLUID_DOMAIN_VECTOR_FIELD_FORCE
void GPU_framebuffer_bind(blender::gpu::FrameBuffer *fb)
static View & default_get()
const float4x4 & viewinv(int view_id=0) const
void bind_texture(const char *name, gpu::Texture *texture, GPUSamplerState state=sampler_auto)
void draw_procedural(GPUPrimType primitive, uint instance_len, uint vertex_len, uint vertex_first=-1, ResourceIndexRange res_index={}, uint custom_id=0)
void push_constant(const char *name, const float &data)
detail::PassBase< command::DrawCommandBuf > Sub
void begin_sync(Resources &res, const State &state) final
Fluids(const SelectionType selection_type)
void object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state) final
void end_sync(Resources &res, const State &) final
void draw_line(Framebuffer &framebuffer, Manager &manager, View &view) final
void DRW_fluid_ensure_flags(FluidModifierData *fmd)
void DRW_fluid_ensure_range_field(FluidModifierData *fmd)
void DRW_smoke_ensure_velocity(FluidModifierData *fmd)
#define DRW_CLIPPING_UBO_SLOT
#define OVERLAY_GLOBALS_SLOT
@ DRW_STATE_DEPTH_LESS_EQUAL
select::SelectionType SelectionType
static bool is_from_dupli_or_set(const Object *ob)
detail::Pass< command::DrawCommandBuf > PassSimple
MatT from_loc_scale(const typename MatT::loc_type &location, const VecBase< typename MatT::base_type, ScaleDim > &scale)
T min(const T &a, const T &b)
MatBase< T, NumCol, NumRow > translate(const MatBase< T, NumCol, NumRow > &mat, const VectorT &translation)
T reduce_mul(const VecBase< T, Size > &a)
int dominant_axis(const VecBase< T, 3 > &a)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 3 > int3
VecBase< float, 3 > float3
float gridlines_upper_bound
float gridlines_lower_bound
GPUTexture * tex_velocity_z
GPUTexture * tex_velocity_y
GPUTexture * tex_range_field
char gridlines_cell_filter
float gridlines_range_color[4]
char vector_scale_with_magnitude
GPUTexture * tex_velocity_x
char vector_draw_mac_components
char gridlines_color_field
struct FluidDomainSettings * domain