#pragma language glsl3
#ifdef VERTEX

vec4 position(mat4 transformProjection, vec4 vertexPosition) {
  return transformProjection*vertexPosition;
}

#endif
 
#ifdef PIXEL

uniform float z;

uniform sampler3D volume1;
uniform sampler3D volume2;
uniform sampler3D volume3;
uniform sampler3D volume4;
uniform sampler3D volume5;
uniform sampler3D volume6;

vec4 effect(vec4 color, sampler2D dummy, vec2 textureCoords, vec2 screenCoords) {
  vec3 pos = vec3(textureCoords,z);

  vec4 samp = texture(volume1,pos) +
              texture(volume2,pos) +
              texture(volume3,pos) +
              texture(volume4,pos) +
              texture(volume5,pos) +
              texture(volume6,pos) ;

  return vec4(samp.rgb/samp.a,min(1,samp.a));
}
#endif

