Revision 9a901a4e
Added by Leszek Koltunski 24 days ago
src/main/java/org/distorted/library/effect/VertexEffectDeform.kt | ||
---|---|---|
95 | 95 |
/////////////////////////////////////////////////////////////////////////////////////////// |
96 | 96 |
// 2020-05-03: replaced vec3 'u_Bounding' with a uniform 'vUniforms[effect].w' (i.e. mRadius) |
97 | 97 |
/////////////////////////////////////////////////////////////////////////////////////////// |
98 |
fun code(): String |
|
98 |
@JvmStatic fun code(): String
|
|
99 | 99 |
{ |
100 | 100 |
return (""" |
101 | 101 |
const vec3 ONE = vec3(1.0,1.0,1.0); |
src/main/java/org/distorted/library/effect/VertexEffectDisappear.kt | ||
---|---|---|
29 | 29 |
companion object |
30 | 30 |
{ |
31 | 31 |
private val NAME = EffectName.DISAPPEAR |
32 |
fun code(): String = "v = vec3(0.0, 0.0, 0.0);" |
|
32 |
@JvmStatic fun code(): String = "v = vec3(0.0, 0.0, 0.0);"
|
|
33 | 33 |
@JvmStatic fun enable() = addEffect(NAME, code()) |
34 | 34 |
} |
35 | 35 |
|
src/main/java/org/distorted/library/effect/VertexEffectDistort.kt | ||
---|---|---|
111 | 111 |
// which makes Vrot = (a+n.y*c , b-n.y*c , v*n) where |
112 | 112 |
// a = vx*nz-vz*nx , b = vy*nz-vz*ny , c = (vx*ny-vy*nx)/(1+nz) (unless n=(0,0,-1)) |
113 | 113 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
114 |
fun code(): String |
|
114 |
@JvmStatic fun code(): String
|
|
115 | 115 |
{ |
116 | 116 |
return (""" vec3 ps = vUniforms[effect+1].yzw - v; |
117 | 117 |
vec3 force = vUniforms[effect].xyz; |
src/main/java/org/distorted/library/effect/VertexEffectMove.kt | ||
---|---|---|
33 | 33 |
companion object |
34 | 34 |
{ |
35 | 35 |
private val NAME = EffectName.VERTEX_MOVE |
36 |
fun code(): String = "v += vUniforms[effect].xyz;" |
|
36 |
@JvmStatic fun code(): String = "v += vUniforms[effect].xyz;"
|
|
37 | 37 |
@JvmStatic fun enable() = addEffect(NAME, code()) |
38 | 38 |
} |
39 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/library/effect/VertexEffectPinch.kt | ||
---|---|---|
49 | 49 |
// when h>1 we are pushing points away from S: P' = P + (1/h-1)*dist(line to P) |
50 | 50 |
// (where 'line' above passes through the center point and goes along the vector) |
51 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////// |
52 |
fun code(): String |
|
52 |
@JvmStatic fun code(): String
|
|
53 | 53 |
{ |
54 | 54 |
return (""" |
55 | 55 |
vec3 ps = vUniforms[effect+1].yzw -v; |
src/main/java/org/distorted/library/effect/VertexEffectPipe.kt | ||
---|---|---|
43 | 43 |
// line defined by 'center' and 'vect' (so 'ps' is very small) |
44 | 44 |
// Then by means of some miracle we have |
45 | 45 |
// dot_ps>0, (sign_ps-1.0)==0.0 and dot_ps-(sign_ps-1.0) == 0.0 !! so n_ps - undef. |
46 |
fun code(): String |
|
46 |
@JvmStatic fun code(): String
|
|
47 | 47 |
{ |
48 | 48 |
return (""" |
49 | 49 |
vec3 pc = vUniforms[effect+1].yzw - v; |
src/main/java/org/distorted/library/effect/VertexEffectQuaternion.kt | ||
---|---|---|
37 | 37 |
private val NAME = EffectName.VERTEX_QUATERNION |
38 | 38 |
|
39 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
40 |
fun code(): String |
|
40 |
@JvmStatic fun code(): String
|
|
41 | 41 |
{ |
42 | 42 |
return (""" |
43 | 43 |
float qx = vUniforms[effect].x; |
src/main/java/org/distorted/library/effect/VertexEffectRotate.kt | ||
---|---|---|
39 | 39 |
private val NAME = EffectName.VERTEX_ROTATE |
40 | 40 |
|
41 | 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 |
fun code(): String |
|
42 |
@JvmStatic fun code(): String
|
|
43 | 43 |
{ |
44 | 44 |
return (""" |
45 | 45 |
float angle = vUniforms[effect].x*3.14159265/360.0; |
src/main/java/org/distorted/library/effect/VertexEffectScale.kt | ||
---|---|---|
36 | 36 |
private val NAME = EffectName.VERTEX_SCALE |
37 | 37 |
|
38 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
39 |
fun code(): String |
|
39 |
@JvmStatic fun code(): String
|
|
40 | 40 |
{ |
41 | 41 |
return """ |
42 | 42 |
v *= vUniforms[effect].xyz; |
src/main/java/org/distorted/library/effect/VertexEffectShear.kt | ||
---|---|---|
37 | 37 |
|
38 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////// |
39 | 39 |
// For explanation (esp. about the way we modify vectors n and i) see MatrixEffectShear. |
40 |
fun code(): String |
|
40 |
@JvmStatic fun code(): String
|
|
41 | 41 |
{ |
42 | 42 |
return (""" |
43 | 43 |
float sx = vUniforms[effect].x; |
src/main/java/org/distorted/library/effect/VertexEffectSink.kt | ||
---|---|---|
45 | 45 |
// Changed to the four complicated lines because the previous Sink effect fails to fully inflate the |
46 | 46 |
// Masterball. |
47 | 47 |
// Current function inflates and deflates much more as H is at the extremes (close to 0 and inf) |
48 |
fun code(): String |
|
48 |
@JvmStatic fun code(): String
|
|
49 | 49 |
{ |
50 | 50 |
return (""" |
51 | 51 |
vec3 ps = vUniforms[effect+1].yzw - v; |
src/main/java/org/distorted/library/effect/VertexEffectSwirl.kt | ||
---|---|---|
48 | 48 |
// This effect rotates the current vertex V by vInterpolated.x radians clockwise around the circle dilated |
49 | 49 |
// by (1-d) around the center of the effect S. |
50 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
51 |
fun code(): String |
|
51 |
@JvmStatic fun code(): String
|
|
52 | 52 |
{ |
53 | 53 |
return (""" |
54 | 54 |
vec3 center = vUniforms[effect+1].yzw; |
src/main/java/org/distorted/library/effect/VertexEffectWave.kt | ||
---|---|---|
106 | 106 |
// |
107 | 107 |
// Generally speaking I'd keep to amplitude < length, as the opposite case has some other problems as well. |
108 | 108 |
/////////////////////////////////////////////////////////////////////////////////////////// |
109 |
fun code(): String |
|
109 |
@JvmStatic fun code(): String
|
|
110 | 110 |
{ |
111 | 111 |
return (""" |
112 | 112 |
vec3 center = vUniforms[effect+1].yzw; |
Also available in: Unified diff
fix for the issue that VertexEffects couldn't be pre-applied to meshes.