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:
authorCampbell Barton <ideasman42@gmail.com>2017-10-09 12:49:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-10-09 12:49:27 +0300
commita5b4b0f21c1ae8c96e4fea9abdcfac2fab1cf300 (patch)
tree0658d8bdfb8ec03652aa04f82ee8a4d243ec6370 /source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl
parentd68f698cf0321477c0734474150eb4bc43c4e85f (diff)
parentabcda06934aba054de8540b66b13c2bbc5f8f515 (diff)
Merge branch '28' into custom-manipulatorscustom-manipulators
Diffstat (limited to 'source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl')
-rw-r--r--source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl b/source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl
new file mode 100644
index 00000000000..b47b3ee1cf4
--- /dev/null
+++ b/source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl
@@ -0,0 +1,28 @@
+
+in vec3 pos;
+in vec3 nor;
+
+uniform mat4 ViewProjectionMatrix;
+
+uniform float sphere_size;
+uniform ivec3 grid_resolution;
+uniform vec3 corner;
+uniform vec3 increment_x;
+uniform vec3 increment_y;
+uniform vec3 increment_z;
+
+void main()
+{
+ vec3 ls_cell_location;
+ /* Keep in sync with update_irradiance_probe */
+ ls_cell_location.z = float(gl_InstanceID % grid_resolution.z);
+ ls_cell_location.y = float((gl_InstanceID / grid_resolution.z) % grid_resolution.y);
+ ls_cell_location.x = float(gl_InstanceID / (grid_resolution.z * grid_resolution.y));
+
+ vec3 ws_cell_location = corner +
+ (increment_x * ls_cell_location.x +
+ increment_y * ls_cell_location.y +
+ increment_z * ls_cell_location.z);
+
+ gl_Position = ViewProjectionMatrix * vec4(pos * 0.02 * sphere_size + ws_cell_location, 1.0);
+} \ No newline at end of file