Merge branch 'blender-v2.82-release'
This commit is contained in:
@@ -409,26 +409,18 @@ def app_template_paths(subdir=None):
|
|||||||
:return: app template paths.
|
:return: app template paths.
|
||||||
:rtype: generator
|
:rtype: generator
|
||||||
"""
|
"""
|
||||||
# Note: keep in sync with: Blender's BKE_appdir_app_template_any
|
subdir_args = (subdir,) if subdir is not None else ()
|
||||||
|
# Note: keep in sync with: Blender's 'BKE_appdir_app_template_any'.
|
||||||
subdir_tuple = (subdir,) if subdir is not None else ()
|
# Uses 'BLENDER_USER_SCRIPTS', 'BLENDER_SYSTEM_SCRIPTS'
|
||||||
|
# ... in this case 'system' accounts for 'local' too.
|
||||||
# Avoid adding 'bl_app_templates_system' twice.
|
scripts_system, scripts_user = _bpy_script_paths()
|
||||||
# Either we have a portable build or an installed system build.
|
for resource_fn, module_name in (
|
||||||
for resource_type, module_name in (
|
(_user_resource, "bl_app_templates_user"),
|
||||||
('USER', "bl_app_templates_user"),
|
(system_resource, "bl_app_templates_system"),
|
||||||
('LOCAL', "bl_app_templates_system"),
|
|
||||||
('SYSTEM', "bl_app_templates_system"),
|
|
||||||
):
|
):
|
||||||
path = resource_path(resource_type)
|
path = resource_fn('SCRIPTS', _os.path.join("startup", module_name, *subdir_args))
|
||||||
if path:
|
if path and _os.path.isdir(path):
|
||||||
path = _os.path.join(
|
yield path
|
||||||
*(path, "scripts", "startup", module_name, *subdir_tuple))
|
|
||||||
if _os.path.isdir(path):
|
|
||||||
yield path
|
|
||||||
# Only load LOCAL or SYSTEM (never both).
|
|
||||||
if resource_type == 'LOCAL':
|
|
||||||
break
|
|
||||||
|
|
||||||
|
|
||||||
def preset_paths(subdir):
|
def preset_paths(subdir):
|
||||||
|
@@ -401,6 +401,14 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float size[3];
|
||||||
|
mat4_to_size(size, ob->obmat);
|
||||||
|
/* Check if any of the axes have 0 length. (see T69070) */
|
||||||
|
const float epsilon = 1e-8f;
|
||||||
|
if ((size[0] < epsilon) || (size[1] < epsilon) || (size[2] < epsilon)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct GPUMaterial *mat = EEVEE_material_mesh_volume_get(scene, ma);
|
struct GPUMaterial *mat = EEVEE_material_mesh_volume_get(scene, ma);
|
||||||
eGPUMaterialStatus status = GPU_material_status(mat);
|
eGPUMaterialStatus status = GPU_material_status(mat);
|
||||||
|
|
||||||
|
@@ -1,8 +1,41 @@
|
|||||||
void curves_vec(float fac, vec3 vec, sampler1DArray curvemap, float layer, out vec3 outvec)
|
/* ext is vec4(in_x, in_dy, out_x, out_dy). */
|
||||||
|
float curve_extrapolate(float x, float y, vec4 ext)
|
||||||
{
|
{
|
||||||
vec4 co = vec4(vec * 0.5 + 0.5, layer);
|
if (x < 0.0) {
|
||||||
|
return y + x * ext.y;
|
||||||
|
}
|
||||||
|
else if (x > 1.0) {
|
||||||
|
return y + (x - 1.0) * ext.w;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define RANGE_RESCALE(x, min, range) ((x - min) * range)
|
||||||
|
|
||||||
|
void curves_vec(float fac,
|
||||||
|
vec3 vec,
|
||||||
|
sampler1DArray curvemap,
|
||||||
|
float layer,
|
||||||
|
vec3 range,
|
||||||
|
vec4 ext_x,
|
||||||
|
vec4 ext_y,
|
||||||
|
vec4 ext_z,
|
||||||
|
out vec3 outvec)
|
||||||
|
{
|
||||||
|
vec4 co = vec4(vec, layer);
|
||||||
|
|
||||||
|
vec3 xyz_min = vec3(ext_x.x, ext_y.x, ext_z.x);
|
||||||
|
co.xyz = RANGE_RESCALE(co.xyz, xyz_min, range);
|
||||||
|
|
||||||
outvec.x = texture(curvemap, co.xw).x;
|
outvec.x = texture(curvemap, co.xw).x;
|
||||||
outvec.y = texture(curvemap, co.yw).y;
|
outvec.y = texture(curvemap, co.yw).y;
|
||||||
outvec.z = texture(curvemap, co.zw).z;
|
outvec.z = texture(curvemap, co.zw).z;
|
||||||
|
|
||||||
|
outvec.x = curve_extrapolate(co.x, outvec.r, ext_x);
|
||||||
|
outvec.y = curve_extrapolate(co.y, outvec.g, ext_y);
|
||||||
|
outvec.z = curve_extrapolate(co.z, outvec.b, ext_z);
|
||||||
|
|
||||||
outvec = mix(vec, outvec, fac);
|
outvec = mix(vec, outvec, fac);
|
||||||
}
|
}
|
||||||
|
@@ -64,10 +64,44 @@ static int gpu_shader_curve_vec(GPUMaterial *mat,
|
|||||||
float *array, layer;
|
float *array, layer;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
BKE_curvemapping_table_RGBA(node->storage, &array, &size);
|
CurveMapping *cumap = node->storage;
|
||||||
|
|
||||||
|
BKE_curvemapping_table_RGBA(cumap, &array, &size);
|
||||||
GPUNodeLink *tex = GPU_color_band(mat, size, array, &layer);
|
GPUNodeLink *tex = GPU_color_band(mat, size, array, &layer);
|
||||||
|
|
||||||
return GPU_stack_link(mat, node, "curves_vec", in, out, tex, GPU_constant(&layer));
|
float ext_xyz[3][4];
|
||||||
|
float range_xyz[3];
|
||||||
|
|
||||||
|
for (int a = 0; a < 3; a++) {
|
||||||
|
const CurveMap *cm = &cumap->cm[a];
|
||||||
|
ext_xyz[a][0] = cm->mintable;
|
||||||
|
ext_xyz[a][2] = cm->maxtable;
|
||||||
|
range_xyz[a] = 1.0f / max_ff(1e-8f, cm->maxtable - cm->mintable);
|
||||||
|
/* Compute extrapolation gradients. */
|
||||||
|
if ((cumap->flag & CUMA_EXTEND_EXTRAPOLATE) != 0) {
|
||||||
|
ext_xyz[a][1] = (cm->ext_in[0] != 0.0f) ? (cm->ext_in[1] / (cm->ext_in[0] * range_xyz[a])) :
|
||||||
|
1e8f;
|
||||||
|
ext_xyz[a][3] = (cm->ext_out[0] != 0.0f) ?
|
||||||
|
(cm->ext_out[1] / (cm->ext_out[0] * range_xyz[a])) :
|
||||||
|
1e8f;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ext_xyz[a][1] = 0.0f;
|
||||||
|
ext_xyz[a][3] = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GPU_stack_link(mat,
|
||||||
|
node,
|
||||||
|
"curves_vec",
|
||||||
|
in,
|
||||||
|
out,
|
||||||
|
tex,
|
||||||
|
GPU_constant(&layer),
|
||||||
|
GPU_uniform(range_xyz),
|
||||||
|
GPU_uniform(ext_xyz[0]),
|
||||||
|
GPU_uniform(ext_xyz[1]),
|
||||||
|
GPU_uniform(ext_xyz[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_node_type_sh_curve_vec(void)
|
void register_node_type_sh_curve_vec(void)
|
||||||
|
Reference in New Issue
Block a user