Project

General

Profile

« Previous | Next » 

Revision 4aa38649

Added by Leszek Koltunski over 5 years ago

Redefine the Vertex Region from (x,y,r,unused) to (x,y,z,r). This takes into account the 'Z', which makes it possible to warp only one side of a 3D Mesh like Sphere.

Also corresponding changes in applications.

View differences:

src/main/java/org/distorted/library/effect/VertexEffectWave.java
127 127
    {
128 128
    addEffect(EffectName.WAVE,
129 129

  
130
        "vec2 center     = vUniforms[effect+1].yz; \n"
130
        "vec3 center     = vUniforms[effect+1].yzw; \n"
131 131
      + "float amplitude = vUniforms[effect  ].x; \n"
132 132
      + "float length    = vUniforms[effect  ].y; \n"
133 133

  
134
      + "vec2 ps = center - v.xy; \n"
134
      + "vec3 ps = center - v.xyz; \n"
135 135
      + "float deg = amplitude*degree_region(vUniforms[effect+2],ps); \n"
136 136

  
137 137
      + "if( deg != 0.0 && length != 0.0 ) \n"
......
170 170

  
171 171
      +     "vec3 normal = cross(sx,sy); \n"
172 172

  
173
      +     "if( normal.z<=0.0 ) \n"                   // Why this bizarre shit rather than the straightforward
173
      +     "if( normal.z<=0.0 ) \n"                   // Why this bizarre thing rather than the straightforward
174 174
      +       "{ \n"                                   //
175 175
      +       "normal.x= 0.0; \n"                      // if( normal.z>0.0 )
176 176
      +       "normal.y= 0.0; \n"                      //   {
......
179 179
                                                       //   n.z = (n.z*normal.z);
180 180
                                                       //   }
181 181
      +     "n.x = (n.x*normal.z + n.z*normal.x); \n"  //
182
      +     "n.y = (n.y*normal.z + n.z*normal.y); \n"  // ? Because if we do the above, my shitty Nexus4 crashes
182
      +     "n.y = (n.y*normal.z + n.z*normal.y); \n"  // ? Because if we do the above, my Nexus4 crashes
183 183
      +     "n.z = (n.z*normal.z); \n"                 // during shader compilation!
184 184
      +     "} \n"
185 185
      +   "}"
......
235 235
    super(EffectName.WAVE);
236 236
    mWave   = wave;
237 237
    mCenter = center;
238
    mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE);
238
    mRegion = new Static4D(0,0,0, Float.MAX_VALUE);
239 239
    }
240 240
  }

Also available in: Unified diff