Blender V5.0
blender::draw::overlay::Fluids Class Reference

#include <overlay_fluid.hh>

Inherits blender::draw::overlay::Overlay.

Public Member Functions

 Fluids (const SelectionType selection_type)
void begin_sync (Resources &res, const State &state) final
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

Detailed Description

Draw fluid simulation overlays (water, smoke).

Definition at line 23 of file overlay_fluid.hh.

Constructor & Destructor Documentation

◆ Fluids()

blender::draw::overlay::Fluids::Fluids ( const SelectionType selection_type)
inline

Definition at line 40 of file overlay_fluid.hh.

Member Function Documentation

◆ begin_sync()

void blender::draw::overlay::Fluids::begin_sync ( Resources & ,
const State &  )
inlinefinalvirtual

Synchronization creates and fill render passes based on context state and scene state.

It runs for every scene update, so keep computation overhead low. If it is triggered, everything in the scene is considered updated. Note that this only concerns the render passes, the mesh batch caches are updated on a per object-data basis.

IMPORTANT: Synchronization must be view agnostic. That is, not rely on view position, projection matrix or frame-buffer size to do conditional pass creation. This is because, by design, syncing can happen once and rendered multiple time (multi view rendering, stereo rendering, orbiting view ...). Conditional pass creation, must be done in the drawing callbacks, but they should remain the exception. Also there will be no access to object data at this point. Creates passes used for object sync and enabling / disabling internal overlay types (e.g. vertices, edges, faces in edit mode). Runs once at the start of the sync cycle. Should also contain passes setup for overlays that are not per object overlays (e.g. Grid).

This method must be implemented.

Implements blender::draw::overlay::Overlay.

Definition at line 42 of file overlay_fluid.hh.

References blender::draw::View::default_get(), blender::math::dominant_axis(), DRW_STATE_DEPTH_LESS_EQUAL, DRW_STATE_WRITE_COLOR, DRW_STATE_WRITE_DEPTH, state, blender::draw::View::viewinv(), and blender::MatBase< T, NumCol, NumRow, Alignment >::z_axis().

◆ draw_line()

void blender::draw::overlay::Fluids::draw_line ( Framebuffer & framebuffer,
Manager & manager,
View & view )
inlinefinalvirtual

Reimplemented from blender::draw::overlay::Overlay.

Definition at line 245 of file overlay_fluid.hh.

References GPU_framebuffer_bind(), and view.

◆ end_sync()

void blender::draw::overlay::Fluids::end_sync ( Resources & ,
const State &  )
inlinefinalvirtual

Finalize passes or buffers used for object sync. Runs once at the start of the sync cycle.

Reimplemented from blender::draw::overlay::Overlay.

Definition at line 236 of file overlay_fluid.hh.

References DRW_CLIPPING_UBO_SLOT, and OVERLAY_GLOBALS_SLOT.

◆ object_sync()

void blender::draw::overlay::Fluids::object_sync ( Manager & ,
const ObjectRef & ,
Resources & ,
const State &  )
inlinefinalvirtual

Fills passes or buffers for each object. Runs for each individual object state. IMPORTANT: Can run only once for instances using the same state (ObjectRef might contains instancing data).

Reimplemented from blender::draw::overlay::Overlay.

Definition at line 79 of file overlay_fluid.hh.

References ATTR_FALLTHROUGH, FluidDomainSettings::axis_slice_method, AXIS_SLICE_SINGLE, blender::draw::detail::PassBase< DrawCommandBufType >::bind_texture(), BKE_modifiers_findby_type(), BLI_assert, FluidDomainSettings::cache_frame_end, FluidDomainSettings::cache_frame_start, FluidDomainSettings::cell_size, FluidDomainSettings::coba_field, FluidModifierData::domain, blender::draw::detail::PassBase< DrawCommandBufType >::draw_procedural(), FluidDomainSettings::draw_velocity, DRW_fluid_ensure_flags(), DRW_fluid_ensure_range_field(), DRW_smoke_ensure_velocity(), eModifierType_Fluid, FluidDomainSettings::fluid, FLUID_DISPLAY_INTERP_CLOSEST, FLUID_DOMAIN_FIELD_FLAGS, FLUID_DOMAIN_VECTOR_FIELD_FORCE, FLUID_GRIDLINE_COLOR_TYPE_FLAGS, FLUID_GRIDLINE_COLOR_TYPE_NONE, FLUID_GRIDLINE_COLOR_TYPE_RANGE, blender::math::from_loc_scale(), blender::draw::select::ID::get(), GPU_PRIM_LINES, FluidDomainSettings::gridlines_cell_filter, FluidDomainSettings::gridlines_color_field, FluidDomainSettings::gridlines_lower_bound, FluidDomainSettings::gridlines_range_color, FluidDomainSettings::gridlines_upper_bound, FluidDomainSettings::interp_method, blender::draw::overlay::is_from_dupli_or_set(), blender::math::min(), FluidDomainSettings::p0, blender::draw::detail::PassBase< DrawCommandBufType >::push_constant(), blender::math::reduce_mul(), FluidDomainSettings::res, FluidDomainSettings::res_min, FluidDomainSettings::show_gridlines, FluidDomainSettings::slice_depth, state, FluidDomainSettings::tex_flags, FluidDomainSettings::tex_range_field, FluidDomainSettings::tex_velocity_x, FluidDomainSettings::tex_velocity_y, FluidDomainSettings::tex_velocity_z, blender::math::translate(), FluidDomainSettings::use_coba, VECTOR_DRAW_MAC, FluidDomainSettings::vector_draw_mac_components, VECTOR_DRAW_MAC_X, VECTOR_DRAW_MAC_Y, VECTOR_DRAW_MAC_Z, VECTOR_DRAW_NEEDLE, VECTOR_DRAW_STREAMLINE, FluidDomainSettings::vector_draw_type, FluidDomainSettings::vector_field, FluidDomainSettings::vector_scale, and FluidDomainSettings::vector_scale_with_magnitude.

Referenced by blender::draw::overlay::Instance::object_sync().


The documentation for this class was generated from the following file: