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:
authorMike Erwin <significant.bit@gmail.com>2017-02-28 10:18:52 +0300
committerMike Erwin <significant.bit@gmail.com>2017-02-28 10:18:52 +0300
commit8a76049e84c79c6267c3c51fe32145f0ebf7805c (patch)
tree4adbfad5728d98aeb64bebec5a8cb3a69086844f /source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl
parente7d57628c955c1843c70c8fc5023f5d8954847bd (diff)
rename built-in point shaders, SMOOTH --> AA
Updated shader names and code that uses them. All of these shaders produce round points that are anti-aliased and blended against the background. These were initially named SMOOTH because they replace glEnable(GL_POINT_SMOOTH). But SMOOTH in shader-land refers to vertex attribute interpolation (like glShadeModel(GL_SMOOTH)). Using SMOOTH to mean two things is confusing, so we now use AA to mean "the point is anti-aliased".
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl
new file mode 100644
index 00000000000..d05920002ed
--- /dev/null
+++ b/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl
@@ -0,0 +1,29 @@
+
+uniform mat4 ModelViewProjectionMatrix;
+uniform float size;
+uniform float outlineWidth;
+
+#if __VERSION__ == 120
+ attribute vec3 pos;
+ varying vec4 radii;
+#else
+ in vec3 pos;
+ out vec4 radii;
+#endif
+
+void main() {
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+ gl_PointSize = size;
+
+ // calculate concentric radii in pixels
+ float radius = 0.5 * size;
+
+ // start at the outside and progress toward the center
+ radii[0] = radius;
+ radii[1] = radius - 1.0;
+ radii[2] = radius - outlineWidth;
+ radii[3] = radius - outlineWidth - 1.0;
+
+ // convert to PointCoord units
+ radii /= size;
+}