Created
July 30, 2018 09:05
-
-
Save ilmoeuro/b224bfbf2f3f912c6944f4c90e13f5d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
divert(`-1') | |
define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')') | |
define(`_forloop', | |
`$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')') | |
divert`'dnl | |
define(`lastindex', `60')dnl | |
shader_type spatial; | |
render_mode blend_mul,depth_draw_opaque,cull_disabled,diffuse_burley,specular_schlick_ggx,world_vertex_coords; | |
uniform float grow; | |
forloop(`i', `1', lastindex, `dnl | |
uniform float obj`'i`'_size; | |
uniform float obj`'i`'_pos; | |
') | |
varying vec2 xz; | |
void vertex() { | |
xz = VERTEX.xz; | |
VERTEX+=NORMAL*grow; | |
} | |
void light() { | |
float mult = 1.0; | |
forloop(`i', `1', lastindex, `dnl | |
if (obj`'i`'_size > 0.0 && distance(xz, obj`'i`'_pos) < 0.5) { | |
mult = 0.3; | |
} | |
') | |
DIFFUSE_LIGHT = vec3(mult, mult, mult); | |
SPECULAR_LIGHT = vec3(mult, mult, mult); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment