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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-05-08 18:11:42 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-05-09 11:34:45 +0300
commit49fc1d0f54010b19c7c2ae5f7692fac62c617e5a (patch)
tree3f844dab5e535a708c441cf2c5e064f5cee33d5e /source/blender/draw/modes/shaders
parentafdc5c148bc16191be612a0a7770ee167196c039 (diff)
Draw manager: Initial implementation of particle edit mode
Gets edit more from the current object and displays it as a path. this is how both hair and particle edit modes are supposed to work. This only covers path itself, it doesn't do anything like keys visualization or selection. However, it's already possible to comb and such. Only implements particle mode. There are also some settings to do soft body and cloth. No idea yet what that all is about. Copy-on-write is not supported either, this is due to some edit mode ownership problems which are to be addressed from dependency graph side. Shading is dead-simple: uses tangent as a color. This is where i hope to get some help from Clément.
Diffstat (limited to 'source/blender/draw/modes/shaders')
-rw-r--r--source/blender/draw/modes/shaders/particle_strand_frag.glsl12
-rw-r--r--source/blender/draw/modes/shaders/particle_vert.glsl34
2 files changed, 46 insertions, 0 deletions
diff --git a/source/blender/draw/modes/shaders/particle_strand_frag.glsl b/source/blender/draw/modes/shaders/particle_strand_frag.glsl
new file mode 100644
index 00000000000..7053ca43ae7
--- /dev/null
+++ b/source/blender/draw/modes/shaders/particle_strand_frag.glsl
@@ -0,0 +1,12 @@
+uniform mat4 ProjectionMatrix;
+
+in vec3 tangent;
+in vec3 viewPosition;
+flat in float colRand;
+out vec4 fragColor;
+
+void main()
+{
+ fragColor.rgb = tangent;
+ fragColor.a = 1.0;
+}
diff --git a/source/blender/draw/modes/shaders/particle_vert.glsl b/source/blender/draw/modes/shaders/particle_vert.glsl
new file mode 100644
index 00000000000..d4c35d14182
--- /dev/null
+++ b/source/blender/draw/modes/shaders/particle_vert.glsl
@@ -0,0 +1,34 @@
+
+uniform mat4 ModelViewProjectionMatrix;
+uniform mat3 NormalMatrix;
+uniform mat4 ModelViewMatrix;
+
+in vec3 pos;
+in vec3 nor;
+in int ind;
+out vec3 tangent;
+out vec3 viewPosition;
+flat out float colRand;
+
+float rand(int s)
+{
+ int seed = s * 1023423;
+
+ seed = (seed ^ 61) ^ (seed >> 16);
+ seed *= 9;
+ seed = seed ^ (seed >> 4);
+ seed *= 0x27d4eb2d;
+ seed = seed ^ (seed >> 15);
+
+ float value = float(seed);
+ value *= 1.0 / 42596.0;
+ return fract(value);
+}
+
+void main()
+{
+ gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
+ tangent = normalize(NormalMatrix * nor);
+ viewPosition = (ModelViewMatrix * vec4(pos, 1.0)).xyz;
+ colRand = rand(ind);
+}