Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 1.71 KB | None | 0 0
  1. ANAGLYPH_JAPAN(
  2.         R.drawable.mini,
  3.         filter = AnaglyphFilter(greenFactor = 0.7f),
  4.         colorRes = R.color.pack_none
  5. ),
  6. ANAGLYPH_TOKYO(
  7.         R.drawable.mini,
  8.         filter = AnaglyphFilter(redFactor = 0.7f),
  9.         colorRes = R.color.pack_none
  10. ),
  11. ANAGLYPH_NOGANO(
  12.         R.drawable.mini,
  13.         filter = AnaglyphFilter(blueFactor = 0.7f),
  14.         colorRes = R.color.pack_none
  15. ),
  16. ANAGLYPH_KYOTO(
  17.         R.drawable.mini,
  18.         filter = AnaglyphFilter(redFactor = 0.7f, blueFactor = 0.7f),
  19.         colorRes = R.color.pack_none
  20. ),
  21. ANAGLYPH_FUJI(
  22.         R.drawable.mini,
  23.         filter = AnaglyphFilter(greenFactor = 0.5f, blueFactor = 0.5f),
  24.         colorRes = R.color.pack_none
  25. )
  26.  
  27.  
  28. private const val VERTEX_SHADER = """
  29.    attribute vec4 aPosition;
  30.    attribute vec4 aTextureCoord;
  31.    varying highp vec2 gbCoordinate;
  32.    varying highp vec2 rCoordinate;
  33.  
  34.    uniform float imageWidthFactor;
  35.    uniform float imageHeightFactor;
  36.  
  37.    void main() {
  38.        gl_Position = aPosition;
  39.        mediump vec2 offset = vec2( -imageWidthFactor, imageHeightFactor);
  40.        gbCoordinate = aTextureCoord.xy;
  41.        rCoordinate = aTextureCoord.xy + offset;
  42.    }
  43. """
  44.  
  45. private val FRAGMENT_SHADER = """
  46.    precision highp float;
  47.    uniform lowp sampler2D sTexture;
  48.    uniform mediump float redFactor;
  49.    uniform mediump float greenFactor;
  50.    uniform mediump float blueFactor;
  51.    varying highp vec2 gbCoordinate;
  52.    varying highp vec2 rCoordinate;
  53.  
  54.    void main() {
  55.        gl_FragColor = vec4(texture2D(sTexture, rCoordinate).r * redFactor, texture2D(sTexture, gbCoordinate).g * greenFactor, texture2D(sTexture, gbCoordinate).b * blueFactor, 1.0);
  56.    }
  57. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement