Merge branch 'blender-v3.2-release'

# Conflicts:
#	source/blender/draw/engines/eevee/shaders/volumetric_vert.glsl
This commit is contained in:
Clément Foucault
2022-06-07 18:32:34 +02:00
4 changed files with 26 additions and 6 deletions

View File

@@ -77,3 +77,13 @@ vec3 coordinate_incoming(vec3 P)
{
return vec3(0.0);
}
float attr_load_temperature_post(float attr)
{
return attr;
}
vec4 attr_load_color_post(vec4 attr)
{
return attr;
}

View File

@@ -93,7 +93,7 @@ void DRW_curves_free(void);
/**
* Add attributes bindings of volume grids to an existing shading group.
* No draw call is added so the caller can decide how to use the data.
* \return nullptr if there is something to draw.
* \return nullptr if there is nothing to draw.
*/
struct DRWShadingGroup *DRW_shgroup_volume_create_sub(struct Scene *scene,
struct Object *ob,

View File

@@ -129,12 +129,14 @@ static DRWShadingGroup *drw_volume_object_grids_init(Object *ob,
volume_infos.temperature_bias = 0.0f;
/* Bind volume grid textures. */
int grid_id = 0;
int grid_id = 0, grids_len = 0;
LISTBASE_FOREACH (GPUMaterialAttribute *, attr, attrs) {
const VolumeGrid *volume_grid = BKE_volume_grid_find_for_read(volume, attr->name);
const DRWVolumeGrid *drw_grid = (volume_grid) ?
DRW_volume_batch_cache_get_grid(volume, volume_grid) :
nullptr;
/* Count number of valid attributes. */
grids_len += int(volume_grid != nullptr);
/* Handle 3 cases here:
* - Grid exists and texture was loaded -> use texture.
@@ -145,7 +147,13 @@ static DRWShadingGroup *drw_volume_object_grids_init(Object *ob,
grid_default_texture(attr->default_value);
DRW_shgroup_uniform_texture(grp, attr->input_name, grid_tex);
copy_m4_m4(volume_infos.grids_xform[grid_id++].ptr(), drw_grid->object_to_texture);
copy_m4_m4(volume_infos.grids_xform[grid_id++].ptr(),
(drw_grid) ? drw_grid->object_to_texture : g_data.dummy_grid_mat);
}
/* Render nothing if there is no attribute for the shader to render.
* This also avoids an assert caused by the bounding box being zero in size. */
if (grids_len == 0) {
return nullptr;
}
volume_infos.push_update();

View File

@@ -1,6 +1,8 @@
void camera(out vec3 outview, out float outdepth, out float outdist)
{
outdepth = abs(transform_point(ViewMatrix, g_data.P).z);
outdist = distance(g_data.P, cameraPos);
outview = normalize(g_data.P - cameraPos);
vec3 vP = transform_point(ViewMatrix, g_data.P);
vP.z = -vP.z;
outdepth = abs(vP.z);
outdist = length(vP);
outview = normalize(vP);
}