34 int dominant_axis = -1;
46 auto &pass = fluid_ps_;
49 state.clipping_plane_count);
54 velocity_needle_ps_ = &fluid_ps_.
sub(
"Velocity Needles");
57 velocity_mac_ps_ = &fluid_ps_.
sub(
"Velocity Mac");
60 velocity_streamline_ps_ = &fluid_ps_.
sub(
"Velocity Line");
63 grid_lines_flags_ps_ = &fluid_ps_.
sub(
"Velocity Mac");
66 grid_lines_flat_ps_ = &fluid_ps_.
sub(
"Velocity Needles");
69 grid_lines_range_ps_ = &fluid_ps_.
sub(
"Velocity Line");
101 const bool is_active_frame_in_cache_range = is_active_frame_after_cache_start &&
102 is_active_frame_before_cache_end;
103 if (!is_active_frame_in_cache_range) {
116 voxel_cube_mat = ob->object_to_world() * voxel_cube_mat;
119 cube_buf_.
append({voxel_cube_mat, color, 1.0f}, sel_id);
123 if (fds->
fluid ==
nullptr) {
127 int slice_axis = slide_axis_get(*fds);
129 const bool draw_velocity = (fds->
draw_velocity && is_active_frame_after_cache_start);
131 int lines_per_voxel = -1;
136 sub_pass = velocity_streamline_ps_;
140 sub_pass = velocity_needle_ps_;
144 sub_pass = velocity_mac_ps_;
150 if (slice_axis != -1) {
152 total_lines /= fds->
res[slice_axis];
183 if (show_gridlines) {
190 sub_pass = grid_lines_flags_ps_;
198 sub_pass = grid_lines_range_ps_;
210 sub_pass = grid_lines_flat_ps_;
224 int lines_per_voxel = 4;
241 manager.
submit(fluid_ps_, view);
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
@ FLUID_DOMAIN_FIELD_FLAGS
@ FLUID_DISPLAY_INTERP_CLOSEST
@ FLUID_GRIDLINE_COLOR_TYPE_FLAGS
@ FLUID_GRIDLINE_COLOR_TYPE_RANGE
@ FLUID_GRIDLINE_COLOR_TYPE_NONE
@ FLUID_DOMAIN_VECTOR_FIELD_FORCE
static void View(GHOST_IWindow *window, bool stereo, int eye=0)
void GPU_framebuffer_bind(GPUFrameBuffer *framebuffer)
ResourceHandle unique_handle(const ObjectRef &ref)
void submit(PassSimple &pass, View &view)
void bind_texture(const char *name, GPUTexture *texture, GPUSamplerState state=sampler_auto)
void draw_procedural(GPUPrimType primitive, uint instance_len, uint vertex_len, uint vertex_first=-1, ResourceHandle handle={0}, uint custom_id=0)
PassBase< DrawCommandBufType > & sub(const char *name)
void bind_ubo(const char *name, GPUUniformBuf *buffer)
void push_constant(const char *name, const float &data)
void shader_set(GPUShader *shader)
void object_sync(Manager &manager, const ObjectRef &ob_ref, Resources &res, const State &state)
void draw(Framebuffer &framebuffer, Manager &manager, View &view)
Fluids(const SelectionType selection_type)
void end_sync(Resources &res, ShapeCache &shapes, const State &)
void begin_sync(Resources &res, const State &state)
ShaderPtr fluid_velocity_needle
ShaderPtr fluid_grid_lines_flat
ShaderPtr fluid_grid_lines_flags
ShaderPtr fluid_velocity_mac
ShaderPtr fluid_grid_lines_range
ShaderPtr fluid_velocity_streamline
void DRW_fluid_ensure_flags(FluidModifierData *fmd)
void DRW_fluid_ensure_range_field(FluidModifierData *fmd)
void DRW_smoke_ensure_velocity(FluidModifierData *fmd)
const DRWView * DRW_view_default_get()
@ DRW_STATE_DEPTH_LESS_EQUAL
MatT from_loc_scale(const typename MatT::loc_type &location, const VecBase< typename MatT::base_type, ScaleDim > &scale)
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)
VecBase< float, 4 > float4
VecBase< int32_t, 3 > int3
VecBase< float, 3 > float3
float gridlines_upper_bound
float gridlines_lower_bound
struct GPUTexture * tex_range_field
struct GPUTexture * tex_velocity_x
struct GPUTexture * tex_velocity_y
char gridlines_cell_filter
struct GPUTexture * tex_velocity_z
struct GPUTexture * tex_flags
float gridlines_range_color[4]
char vector_scale_with_magnitude
char vector_draw_mac_components
char gridlines_color_field
struct FluidDomainSettings * domain
const float4 & object_wire_color(const ObjectRef &ob_ref, ThemeColorID theme_id) const
GPUUniformBuf * globals_buf
void end_sync(PassSimple::Sub &pass, gpu::Batch *shape)
void append(const InstanceDataT &data, select::ID select_id)
void select_bind(PassSimple &pass)
const ID select_id(const ObjectRef &ob_ref, uint sub_object_id=0)