41 if (volume_grid ==
nullptr) {
46 if (grid ==
nullptr) {
86 manager, resources, sub_ps, ob_ref, scene_state.
sample, slice_count, world_size);
101 if (!settings.
fluid) {
105 bool can_load =
false;
108 can_load = settings.
tex_field !=
nullptr;
150 if (!show_flags && !show_pressure && !show_phi) {
183 manager, resources, sub_ps, ob_ref, scene_state.
sample, slice_count, world_size);
200void VolumePass::draw_slice_ps(
Manager &manager,
216 float step_length = std::max(1e-16f, dimensions[axis] * 0.05f);
226void VolumePass::draw_volume_ps(Manager &manager,
227 SceneResources &resources,
237 int max_slice = std::max({
UNPACK3(slice_count)});
238 float step_length =
math::length((1.0f / slice_count) * world_size);
241 ps.push_constant(
"samples_len", max_slice);
242 ps.push_constant(
"step_length", step_length);
243 ps.push_constant(
"noise_ofs",
float(noise_offset));
245 ps.draw(resources.volume_cube_batch, manager.resource_handle(ob_ref));
void BKE_object_dimensions_get(const Object *ob, float r_vec[3])
const blender::bke::VolumeGridData * BKE_volume_grid_active_get_for_read(const Volume *volume)
bool BKE_volume_load(const Volume *volume, const Main *bmain)
Volume data-block rendering and viewport drawing utilities.
float BKE_volume_density_scale(const Volume *volume, const float matrix[4][4])
MINLINE int axis_dominant_v3_single(const float vec[3])
void BLI_halton_1d(unsigned int prime, double offset, int n, double *r)
@ FLUID_DOMAIN_FIELD_PHI_OUT
@ FLUID_DOMAIN_FIELD_PHI_OBSTACLE
@ FLUID_DOMAIN_FIELD_FLAGS
@ FLUID_DOMAIN_FIELD_PRESSURE
@ FLUID_DOMAIN_FIELD_PHI_IN
@ FLUID_DOMAIN_ACTIVE_COLORS
@ FLUID_DOMAIN_ACTIVE_COLOR_SET
#define GPU_ATTACHMENT_TEXTURE(_texture)
#define GPU_ATTACHMENT_NONE
@ GPU_TEXTURE_USAGE_SHADER_READ
void GPU_texture_get_mipmap_size(GPUTexture *texture, int mip_level, int *r_size)
void submit(PassSimple &pass, View &view)
ResourceHandleRange resource_handle(const ObjectRef &ref, float inflate_bounds=0.0f)
GPUTexture * stencil_view(bool cube_as_array=false)
static View & default_get()
const float4x4 & viewinv(int view_id=0) const
void bind_texture(const char *name, GPUTexture *texture, GPUSamplerState state=sampler_auto)
void draw(gpu::Batch *batch, uint instance_len=-1, uint vertex_len=-1, uint vertex_first=-1, ResourceHandleRange handle={0}, uint custom_id=0)
void state_set(DRWState state, int clip_plane_count=0)
void push_constant(const char *name, const float &data)
void shader_set(GPUShader *shader)
detail::PassBase< command::DrawMultiBuf > Sub
static ShaderCache & get()
void sync(SceneResources &resources)
void object_sync_volume(Manager &manager, SceneResources &resources, const SceneState &scene_state, ObjectRef &ob_ref, float3 color)
void draw(Manager &manager, View &view, SceneResources &resources)
void object_sync_modifier(Manager &manager, SceneResources &resources, const SceneState &scene_state, ObjectRef &ob_ref, ModifierData *md)
void DRW_smoke_ensure_coba_field(FluidModifierData *fmd)
void DRW_smoke_ensure(FluidModifierData *fmd, int highres)
Mesh & DRW_object_get_data_for_drawing(const Object &object)
@ DRW_STATE_BLEND_ALPHA_PREMUL
DRWVolumeGrid * DRW_volume_batch_cache_get_grid(Volume *volume, const bke::VolumeGridData *volume_grid)
T length(const VecBase< T, Size > &a)
VecBase< T, 3 > to_scale(const MatBase< T, NumCol, NumRow > &mat)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 3 > int3
VecBase< float, 3 > float3
struct GPUTexture * tex_density
struct GPUTexture * tex_color
struct GPUTexture * tex_field
struct GPUTexture * tex_shadow
struct GPUTexture * tex_coba
struct GPUTexture * tex_flame
struct GPUTexture * tex_flame_coba
float4x4 texture_to_object
float4x4 object_to_texture
UniformBuffer< WorldData > world_buf
gpu::Batch * volume_cube_batch