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/VertexEffectPinch.java
69 69
    {
70 70
    addEffect(EffectName.PINCH,
71 71

  
72
        "vec2 center = vUniforms[effect+1].yz; \n"
73
      + "vec2 ps = center-v.xy; \n"
72
        "vec3 center = vUniforms[effect+1].yzw; \n"
73
      + "vec3 ps = center-v.xyz; \n"
74 74
      + "float h = vUniforms[effect].x; \n"
75 75
      + "float t = degree(vUniforms[effect+2],center,ps) * (1.0-h)/max(1.0,h); \n"
76 76
      + "float angle = vUniforms[effect].y; \n"
77 77
      + "vec2 dir = vec2(sin(angle),-cos(angle)); \n"
78
      + "v.xy += t*dot(ps,dir)*dir;"
78
      + "v.xy += t*dot(ps.xy,dir)*dir;"
79 79
      );
80 80
    }
81 81

  
......
109 109
    super(EffectName.PINCH);
110 110
    mPinch  = pinch;
111 111
    mCenter = center;
112
    mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE);
112
    mRegion = new Static4D(0,0,0, Float.MAX_VALUE);
113 113
    }
114 114
  }

Also available in: Unified diff