Revision 0f10a0b6
Added by Leszek Koltunski about 4 years ago
src/main/java/org/distorted/library/effect/VertexEffectSwirl.java | ||
---|---|---|
72 | 72 |
"vec3 center = vUniforms[effect+1].yzw; \n" |
73 | 73 |
+ "vec3 PS = center-v.xyz; \n" |
74 | 74 |
+ "vec4 SO = vUniforms[effect+2]; \n" |
75 |
+ "float d1_circle = degree_region(SO,PS); \n" |
|
76 |
+ "float d1_object = degree_object(center,PS); \n" |
|
75 |
+ "float deg1 = degree(SO,PS); \n" |
|
77 | 76 |
+ "float alpha = vUniforms[effect].x; \n" |
78 | 77 |
+ "float sinA = sin(alpha); \n" |
79 | 78 |
+ "float cosA = cos(alpha); \n" |
80 | 79 |
|
81 | 80 |
+ "vec3 PS2 = vec3( PS.x*cosA+PS.y*sinA,-PS.x*sinA+PS.y*cosA, PS.z ); \n" // vector PS rotated by A radians clockwise around center. |
82 |
+ "vec4 SG = (1.0-d1_circle)*SO; \n" // coordinates of the dilated circle P is going to get rotated around
|
|
83 |
+ "float d2 = max(0.0,degree(SG,center,PS2)); \n" // make it a max(0,deg) because otherwise when center=left edge of the
|
|
81 |
+ "vec4 SG = (1.0-deg1)*SO; \n" // coordinates of the dilated circle P is going to get rotated around
|
|
82 |
+ "float d2 = max(0.0,degree(SG,PS2)); \n" // make it a max(0,deg) because otherwise when center=left edge of the
|
|
84 | 83 |
// object some points end up with d2<0 and they disappear off view. |
85 |
+ "v.xy += min(d1_circle,d1_object)*(PS.xy - PS2.xy/(1.0-d2)); \n" // if d2=1 (i.e P=center) we should have P unchanged. How to do it?
|
|
84 |
+ "v.xy += deg1 * (PS.xy - PS2.xy/(1.0-d2)); \n" // if d2=1 (i.e P=center) we should have P unchanged. How to do it?
|
|
86 | 85 |
); |
87 | 86 |
} |
88 | 87 |
|
Also available in: Unified diff
A lot of changes.
1) main vertex shader: remove support for degree_object. This functionality will hopefully come back when we introduce other than circular regions.
2) MeshBase: remove the need to set a Bounding box (this is the point of the whole thing - we wanted to get rid of this so that the advances in MeshJoined will be easier)
3) Set ground for removing the MeshBase.setStretch / getStretch (another thing needed to advance MeshJoined )
4) since we removed the Bounding box, we need to change the DEFORN effect to have 1 additional parameter, the 'radius' which takes over the function of the bounding box in the vertex shader.
5) since the'res no bounding box, simplify the postprocessing Halo (remove EffectQueueMatrix.magnify() )
6) adjust applications.
After this we will hopefully be ready to introduce MeshBase.preApply(VertexEffect), i.e. bending several simple Meshes with any VertexEffect - including the freshly-introduced PseudoMatrix-Vertex effects like VertexEffectScale - and then combining them into one MeshJoined.