Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlie Jolly <charlie>2019-12-07 15:35:07 +0300
committerCharlie Jolly <mistajolly@gmail.com>2019-12-07 15:52:42 +0300
commit958d0d4236b1cfa600a7f36f6bdc51fdd0d98a97 (patch)
tree567a1e3209e6302dd784c054b858a8b5fb92bc9f /source/blender/gpu/shaders/material/gpu_shader_material_clamp.glsl
parent0406eb110332a863811d7fb6228f9a7ca514e022 (diff)
Shader Nodes: Add Interpolation modes to Map Range node
Modes: Linear interpolation (default), stepped linear, smoothstep and smootherstep. This also includes an additional option for the **Clamp node** to switch between **Min Max** (default) and **Range** mode. This was needed to allow clamping when **To Max** is less than **To Min**. Reviewed By: JacquesLucke, brecht Differential Revision: https://developer.blender.org/D5827
Diffstat (limited to 'source/blender/gpu/shaders/material/gpu_shader_material_clamp.glsl')
-rw-r--r--source/blender/gpu/shaders/material/gpu_shader_material_clamp.glsl5
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/material/gpu_shader_material_clamp.glsl b/source/blender/gpu/shaders/material/gpu_shader_material_clamp.glsl
index b8842064b6f..b196aed690f 100644
--- a/source/blender/gpu/shaders/material/gpu_shader_material_clamp.glsl
+++ b/source/blender/gpu/shaders/material/gpu_shader_material_clamp.glsl
@@ -2,3 +2,8 @@ void clamp_value(float value, float min, float max, out float result)
{
result = clamp(value, min, max);
}
+
+void clamp_range(float value, float min, float max, out float result)
+{
+ result = (max > min) ? clamp(value, min, max) : clamp(value, max, min);
+}