Project

General

Profile

« Previous | Next » 

Revision b24e4719

Added by Leszek Koltunski over 5 years ago

Make the Fragment effects truly 3D: change their 4D 'region' into a 3D 'center' (a point in 3D) and 3D 'region' (which is now a set of 3 radii defining an ellipsoid around the center)

Also corresponding changes to the applications.

View differences:

src/main/res/raw/main_fragment_shader.glsl
47 47
#if NUM_FRAGMENT>0
48 48
uniform int fNumEffects;                // total number of fragment effects
49 49
uniform int fName[NUM_FRAGMENT];        // their namess.
50
uniform vec4 fUniforms[2*NUM_FRAGMENT]; // i-th effect is 2 consecutive vec4's: [2*i], [2*i+1]. First vec4 is the Interpolated values,
51
                                        // next describes the Region, i.e. area over which the effect is active.
50
uniform vec4 fUniforms[3*NUM_FRAGMENT]; // i-th effect is 3 consecutive vec4's: [3*i], [3*i+1], [3*i+2].
51
                                        // The first vec4 is the Interpolated values,
52
                                        // second vec4: first float - cache, next 3: Center, the third - the Region.
52 53
#endif    // NUM_FRAGMENT>0
53 54

  
54 55
#ifdef OIT
......
110 111
  vec4 color = texture(u_Texture,v_TexCoordinate);
111 112

  
112 113
#if NUM_FRAGMENT>0
113
  vec2 diff;
114
  vec3 diff;
114 115
  float degree;
115 116
  int effect=0;
116 117

  
117 118
  for(int i=0; i<fNumEffects; i++)
118 119
    {
119
    diff   = (v_Position.xy - fUniforms[effect+1].xy)/fUniforms[effect+1].zw;
120
    diff   = (v_Position - fUniforms[effect+1].yzw)/fUniforms[effect+2].xyz;
120 121
    degree = max(0.0,1.0-dot(diff,diff));
121 122

  
122 123
    // ENABLED EFFECTS WILL BE INSERTED HERE
123 124

  
124
    effect+=2;
125
    effect+=3;
125 126
    }
126 127
#endif
127 128

  

Also available in: Unified diff