Changeset 1941


Ignore:
Timestamp:
Sep 21, 2012, 11:03:54 PM (5 years ago)
Author:
sam
Message:

core: port gradient shader to GL ES platforms.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gradient.lolfx

    r1928 r1941  
    4141{
    4242    vec4 col = pass_Color;
     43#if defined GL_ES
     44    int dx = int(mod(gl_FragCoord.x, 4.0));
     45    int dy = int(mod(gl_FragCoord.y, 4.0));
     46    /* Cluster */
     47    float t;
     48    if (dx == 0)
     49    {
     50        if (dy == 0) t = cluster[0][0]; else if (dy == 1) t = cluster[0][1]; else if (dy == 2) t = cluster[0][2]; else t = cluster[0][3];
     51    }
     52    else if (dx == 1)
     53    {
     54        if (dy == 0) t = cluster[1][0]; else if (dy == 1) t = cluster[1][1]; else if (dy == 2) t = cluster[1][2]; else t = cluster[1][3];
     55    }
     56    else if (dx == 2)
     57    {
     58        if (dy == 0) t = cluster[2][0]; else if (dy == 1) t = cluster[2][1]; else if (dy == 2) t = cluster[2][2]; else t = cluster[2][3];
     59    }
     60    else
     61    {
     62        if (dy == 0) t = cluster[3][0]; else if (dy == 1) t = cluster[3][1]; else if (dy == 2) t = cluster[3][2]; else t = cluster[3][3];
     63    }
     64#else
    4365    float t = cluster[int(mod(gl_FragCoord.x, 4.0))]
    4466                     [int(mod(gl_FragCoord.y, 4.0))];
     67#endif
    4568    t = (t + 0.5) / 17.0;
    4669    col.x += fract(t - col.x) - t;
Note: See TracChangeset for help on using the changeset viewer.