#pragma language glsl3
#ifdef VERTEX

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

#endif
 
#ifdef PIXEL
uniform float z;
uniform int dir;
uniform sampler3D volume;

vec4 effect(vec4 color, sampler2D dummy, vec2 textureCoords, vec2 screenCoords) {
  vec3 pos = vec3(textureCoords,z);
  int d = dir;
  vec4 samp;
  if (dir==1 || dir==4){
    samp = texture(volume,vec3(pos.z,pos.y,1-pos.x));
  }else if(dir==2 || dir==5){
    samp = texture(volume,vec3(pos.x,pos.z,pos.y));
  }else{
    samp = texture(volume,vec3(pos.x,pos.y,pos.z));
  }

  return samp;
}
#endif

