Project

General

Profile

« Previous | Next » 

Revision 264eda72

Added by Leszek Koltunski 2 days ago

fix errors loading Effect.code() and calling stuff via reflection. Remove java.lang.reflect!

View differences:

src/main/java/org/distorted/library/effect/Effect.kt
21 21
package org.distorted.library.effect
22 22

  
23 23
import org.distorted.library.effectqueue.EffectQueue
24
import org.distorted.library.main.DistortedLibrary
25 24
import org.distorted.library.main.InternalStackFrameList
26 25
import org.distorted.library.message.EffectListener
27
import java.lang.reflect.Method
28 26

  
29 27
///////////////////////////////////////////////////////////////////////////////////////////////////
30 28
/**
......
84 82
         */
85 83
        fun enableEffects(type: EffectType)
86 84
        {
87
            var method: Method?
88

  
89 85
            for (name in EffectName.entries)
90
            {
91
                if (name.type==type)
92
                {
93
                    val cls = name.effectClass
94

  
95
                    try
96
                    {
97
                        method = cls.getMethod("enable") // getMethod and NOT getDeclaredMethod because enable() is public
98
                    }
99
                    catch (ex: NoSuchMethodException)
100
                    {
101
                        DistortedLibrary.logMessage("Effect: exception getting method: "+ex.message)
102
                        method = null
103
                    }
104

  
105
                    try
106
                    {
107
                        method?.invoke(null)
108
                    }
109
                    catch (ex: Exception)
110
                    {
111
                        DistortedLibrary.logMessage("Effect: exception invoking method: "+ex.message)
112
                    }
113
                }
114
            }
86
                if (name.type==type) name.enable?.invoke()
115 87
        }
116 88
    }
117 89

  
src/main/java/org/distorted/library/effect/EffectName.kt
37 37
 * This is used by the EffectQueue classes to decide if the final form of the Effect is NULL - and
38 38
 * thus if it can safely be removed from Effect Queues without affecting the visual in any way.
39 39
 */
40
enum class EffectName( t: EffectType, u: FloatArray, d: Int, r: Int, c: Int, e: Class<out Effect>)
40
enum class EffectName( t: EffectType, u: FloatArray, d: Int, r: Int, c: Int, e: (()->String)?, s: (()->Unit)?, n: (()->Unit)?)
41 41
{
42
    // EFFECT NAME /////// EFFECT TYPE ////////// EFFECT UNITY //////////// DIM REGION CENTER // CLASS
43
    ROTATE           (EffectType.MATRIX,      floatArrayOf(0.0f),             4, 0, 3, MatrixEffectRotate::class.java),
44
    QUATERNION       (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 0, 3, MatrixEffectQuaternion::class.java),
45
    MOVE             (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 0, MatrixEffectMove::class.java),
46
    SCALE            (EffectType.MATRIX,      floatArrayOf(1.0f, 1.0f, 1.0f), 3, 0, 0, MatrixEffectScale::class.java),
47
    SHEAR            (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 3, MatrixEffectShear::class.java),
42
    // EFFECT NAME /////// EFFECT TYPE ////////// EFFECT UNITY //////////// DIM REGION CENTER //// code() //// destroyStatics() //// enable()
43
    ROTATE           (EffectType.MATRIX,      floatArrayOf(0.0f),             4, 0, 3, null,null,null),
44
    QUATERNION       (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 0, 3, null,null,null),
45
    MOVE             (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 0, null,null,null),
46
    SCALE            (EffectType.MATRIX,      floatArrayOf(1.0f, 1.0f, 1.0f), 3, 0, 0, null,null,null),
47
    SHEAR            (EffectType.MATRIX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 3, null,null,null),
48 48

  
49
    DISTORT          (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 4, 3, VertexEffectDistort::class.java),
50
    DEFORM           (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 4, 3, VertexEffectDeform::class.java),
51
    SINK             (EffectType.VERTEX,      floatArrayOf(1.0f),             1, 4, 3, VertexEffectSink::class.java),
52
    PINCH            (EffectType.VERTEX,      floatArrayOf(1.0f),             3, 4, 3, VertexEffectPinch::class.java),
53
    SWIRL            (EffectType.VERTEX,      floatArrayOf(0.0f),             1, 4, 3, VertexEffectSwirl::class.java),
54
    WAVE             (EffectType.VERTEX,      floatArrayOf(0.0f),             5, 4, 3, VertexEffectWave::class.java),
55
    DISAPPEAR        (EffectType.VERTEX,      floatArrayOf(),                 0, 0, 0, VertexEffectDisappear::class.java),
56
    PIPE             (EffectType.VERTEX,      floatArrayOf(1f, 0f),           5, 0, 3, VertexEffectPipe::class.java),
49
    DISTORT          (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 4, 3, { VertexEffectDistort.code()      }, null, { VertexEffectDistort.enable()      }),
50
    DEFORM           (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 4, 3, { VertexEffectDeform.code()       }, null, { VertexEffectDeform.enable()       }),
51
    SINK             (EffectType.VERTEX,      floatArrayOf(1.0f),             1, 4, 3, { VertexEffectSink.code()         }, null, { VertexEffectSink.enable()         }),
52
    PINCH            (EffectType.VERTEX,      floatArrayOf(1.0f),             3, 4, 3, { VertexEffectPinch.code()        }, null, { VertexEffectPinch.enable()        }),
53
    SWIRL            (EffectType.VERTEX,      floatArrayOf(0.0f),             1, 4, 3, { VertexEffectSwirl.code()        }, null, { VertexEffectSwirl.enable()        }),
54
    WAVE             (EffectType.VERTEX,      floatArrayOf(0.0f),             5, 4, 3, { VertexEffectWave.code()         }, null, { VertexEffectWave.enable()         }),
55
    DISAPPEAR        (EffectType.VERTEX,      floatArrayOf(),                 0, 0, 0, { VertexEffectDisappear.code()    }, null, { VertexEffectDisappear.enable()    }),
56
    PIPE             (EffectType.VERTEX,      floatArrayOf(1f, 0f),           5, 0, 3, { VertexEffectPipe.code()         }, null, { VertexEffectPipe.enable()         }),
57 57

  
58
    VERTEX_MOVE      (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 0, VertexEffectMove::class.java),
59
    VERTEX_QUATERNION(EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 0, 3, VertexEffectQuaternion::class.java),
60
    VERTEX_ROTATE    (EffectType.VERTEX,      floatArrayOf(0.0f),             4, 0, 3, VertexEffectRotate::class.java),
61
    VERTEX_SCALE     (EffectType.VERTEX,      floatArrayOf(1.0f, 1.0f, 1.0f), 3, 0, 0, VertexEffectScale::class.java),
62
    VERTEX_SHEAR     (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 3, VertexEffectShear::class.java),
58
    VERTEX_MOVE      (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 0, { VertexEffectMove.code()         }, null, { VertexEffectMove.enable()         }),
59
    VERTEX_QUATERNION(EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 4, 0, 3, { VertexEffectQuaternion.code()   }, null, { VertexEffectQuaternion.enable()   }),
60
    VERTEX_ROTATE    (EffectType.VERTEX,      floatArrayOf(0.0f),             4, 0, 3, { VertexEffectRotate.code()       }, null, { VertexEffectRotate.enable()       }),
61
    VERTEX_SCALE     (EffectType.VERTEX,      floatArrayOf(1.0f, 1.0f, 1.0f), 3, 0, 0, { VertexEffectScale.code()        }, null, { VertexEffectScale.enable()        }),
62
    VERTEX_SHEAR     (EffectType.VERTEX,      floatArrayOf(0.0f, 0.0f, 0.0f), 3, 0, 3, { VertexEffectShear.code()        }, null, { VertexEffectShear.enable()        }),
63 63

  
64
    ALPHA            (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectAlpha::class.java),
65
    SMOOTH_ALPHA     (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectAlpha::class.java),
66
    CHROMA           (EffectType.FRAGMENT,    floatArrayOf(0.0f),             4, 3, 3, FragmentEffectChroma::class.java),
67
    SMOOTH_CHROMA    (EffectType.FRAGMENT,    floatArrayOf(0.0f),             4, 3, 3, FragmentEffectChroma::class.java),
68
    BRIGHTNESS       (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectBrightness::class.java),
69
    SMOOTH_BRIGHTNESS(EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectBrightness::class.java),
70
    SATURATION       (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectSaturation::class.java),
71
    SMOOTH_SATURATION(EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectSaturation::class.java),
72
    CONTRAST         (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectContrast::class.java),
73
    SMOOTH_CONTRAST  (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, FragmentEffectContrast::class.java),
64
    ALPHA            (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectAlpha.code()      }, null, { FragmentEffectAlpha.enable()      }),
65
    SMOOTH_ALPHA     (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectAlpha.code()      }, null, { FragmentEffectAlpha.enable()      }),
66
    CHROMA           (EffectType.FRAGMENT,    floatArrayOf(0.0f),             4, 3, 3, { FragmentEffectChroma.code()     }, null, { FragmentEffectChroma.enable()     }),
67
    SMOOTH_CHROMA    (EffectType.FRAGMENT,    floatArrayOf(0.0f),             4, 3, 3, { FragmentEffectChroma.code()     }, null, { FragmentEffectChroma.enable()     }),
68
    BRIGHTNESS       (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectBrightness.code() }, null, { FragmentEffectBrightness.enable() }),
69
    SMOOTH_BRIGHTNESS(EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectBrightness.code() }, null, { FragmentEffectBrightness.enable() }),
70
    SATURATION       (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectSaturation.code() }, null, { FragmentEffectSaturation.enable() }),
71
    SMOOTH_SATURATION(EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectSaturation.code() }, null, { FragmentEffectSaturation.enable() }),
72
    CONTRAST         (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectContrast.code()   }, null, { FragmentEffectContrast.enable()   }),
73
    SMOOTH_CONTRAST  (EffectType.FRAGMENT,    floatArrayOf(1.0f),             1, 3, 3, { FragmentEffectContrast.code()   }, null, { FragmentEffectContrast.enable()   }),
74 74

  
75
    BLUR             (EffectType.POSTPROCESS, floatArrayOf(0.0f),             2, 0, 0, PostprocessEffectBlur::class.java),
76
    GLOW             (EffectType.POSTPROCESS, floatArrayOf(0.0f),             6, 0, 0, PostprocessEffectGlow::class.java),
77
    BORDER           (EffectType.POSTPROCESS, floatArrayOf(0.0f),             5, 0, 0, PostprocessEffectBorder::class.java),
75
    BLUR             (EffectType.POSTPROCESS, floatArrayOf(0.0f),             2, 0, 0, null, { PostprocessEffectBlur.destroyStatics()   }, { PostprocessEffectBlur.enable()   } ),
76
    GLOW             (EffectType.POSTPROCESS, floatArrayOf(0.0f),             6, 0, 0, null, { PostprocessEffectGlow.destroyStatics()   }, { PostprocessEffectGlow.enable()   } ),
77
    BORDER           (EffectType.POSTPROCESS, floatArrayOf(0.0f),             5, 0, 0, null, { PostprocessEffectBorder.destroyStatics() }, { PostprocessEffectBorder.enable() } ),
78 78
    ;
79

  
79 80
    ///////////////////////////////////////////////////////////////////////////////////////////////
80 81

  
81 82
    val type: EffectType
......
83 84
    private val dimension: Int
84 85
    private val regionDim: Int
85 86
    private val centerDim: Int
86
    val effectClass: Class<out Effect?>
87
    val code: (() -> String)?
88
    val destroy: (() -> Unit)?
89
    val enable: (() -> Unit)?
87 90

  
88 91
    val effectDimension: Int get() = dimensions[ordinal]
89 92
    val regionDimension: Int get() = Companion.regionDimension[ordinal]
......
121 124
        dimension   = d
122 125
        regionDim   = r
123 126
        centerDim   = c
124
        effectClass = e
127
        code        = e
128
        destroy     = s
129
        enable      = n
125 130
    }
126 131
    ///////////////////////////////////////////////////////////////////////////////////////////////
127 132
    fun getName(ordinal: Int): EffectName? = names[ordinal]
src/main/java/org/distorted/library/effect/FragmentEffectAlpha.kt
36 36

  
37 37
    companion object
38 38
    {
39
        /**
40
         * Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
41
         */
42
        fun enable()
43
        {
44
            addEffect(EffectName.ALPHA, EffectName.SMOOTH_ALPHA,
45
                "color.a *= (degree*(fUniforms[effect].x-1.0)+1.0);")
46
        }
39
        fun code(): String = "color.a *= (degree*(fUniforms[effect].x-1.0)+1.0);"
40
        fun enable() = addEffect(EffectName.ALPHA, EffectName.SMOOTH_ALPHA, code() )
47 41
    }
48 42
    ///////////////////////////////////////////////////////////////////////////////////////////////////
49 43
    /**
src/main/java/org/distorted/library/effect/FragmentEffectBrightness.kt
36 36

  
37 37
    companion object
38 38
    {
39
        /**
40
         * Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
41
         */
42
        fun enable()
43
        {
44
            addEffect(EffectName.BRIGHTNESS, EffectName.SMOOTH_BRIGHTNESS,
45
                "color.rgb = mix(vec3(0.0,0.0,0.0), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 );")
46
        }
39
        fun code(): String = "color.rgb = mix(vec3(0.0,0.0,0.0), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 );"
40
        fun enable() = addEffect(EffectName.BRIGHTNESS, EffectName.SMOOTH_BRIGHTNESS, code() )
47 41
    }
48 42
    ///////////////////////////////////////////////////////////////////////////////////////////////////
49 43
    /**
src/main/java/org/distorted/library/effect/FragmentEffectChroma.kt
37 37

  
38 38
    companion object
39 39
    {
40
        /**
41
         * Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
42
         */
43
        fun enable()
44
        {
45
            addEffect(EffectName.CHROMA, EffectName.SMOOTH_CHROMA,
46
                "color.rgb = mix(color.rgb, fUniforms[effect].yzw, degree*fUniforms[effect].x);")
47
        }
40
        fun code(): String = "color.rgb = mix(color.rgb, fUniforms[effect].yzw, degree*fUniforms[effect].x);"
41
        fun enable() = addEffect(EffectName.CHROMA, EffectName.SMOOTH_CHROMA, code() )
48 42
    }
49 43
    ///////////////////////////////////////////////////////////////////////////////////////////////////
50 44
    /**
src/main/java/org/distorted/library/effect/FragmentEffectContrast.kt
35 35

  
36 36
    companion object
37 37
    {
38
        /**
39
         * Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
40
         */
41
        fun enable()
42
        {
43
            addEffect(EffectName.CONTRAST, EffectName.SMOOTH_CONTRAST,
44
                "color.rgb = mix(vec3(0.5,0.5,0.5), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 );")
45
        }
38
        fun code(): String = "color.rgb = mix(vec3(0.5,0.5,0.5), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 );"
39
        fun enable() = addEffect(EffectName.CONTRAST, EffectName.SMOOTH_CONTRAST, code() )
46 40
    }
47 41
    ///////////////////////////////////////////////////////////////////////////////////////////////////
48 42
    /**
src/main/java/org/distorted/library/effect/FragmentEffectSaturation.kt
36 36

  
37 37
    companion object
38 38
    {
39
        /**
40
         * Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work.
41
         */
42
        fun enable()
43
        {
44
            addEffect(EffectName.SATURATION, EffectName.SMOOTH_SATURATION,
45
                """
39
        fun code(): String = """
46 40
                    float luminance = dot(vec3( 0.2125, 0.7154, 0.0721 ),color.rgb);
47 41
                    color.rgb = mix(vec3(luminance,luminance,luminance), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 ); 
48
                    """.trimIndent())
49
        }
42
                    """.trimIndent()
43
        fun enable() = addEffect(EffectName.SATURATION, EffectName.SMOOTH_SATURATION, code() )
50 44
    }
51 45
    ///////////////////////////////////////////////////////////////////////////////////////////////////
52 46
    /**
src/main/java/org/distorted/library/effect/MatrixEffect.kt
37 37
        const val NUM_FLOAT_UNIFORMS: Int = 7  //  4 per-effect interpolated values + 3 dimensional center.
38 38
        const val NUM_INT_UNIFORMS: Int = 1
39 39
        const val CENTER_OFFSET: Int = 4
40
        fun destroyStatics() { /* NO OP */ }
40
        fun destroyStatics() { }
41 41
    }
42 42
}
src/main/java/org/distorted/library/effect/MatrixEffectRotate.kt
73 73
        rotateSinCos(matrixV, mTmp1, mTmp2, sin, cos, axisX, axisY, axisZ)
74 74
        translate(matrixV, -x, -y, -z)
75 75
    }
76

  
77
    ///////////////////////////////////////////////////////////////////////////////////////////////////
78
    // PUBLIC API
79
    ///////////////////////////////////////////////////////////////////////////////////////////////////
80 76
}
src/main/java/org/distorted/library/effect/PostprocessEffect.kt
26 26
import org.distorted.library.main.InternalMaster
27 27
import org.distorted.library.main.InternalMaster.Slave
28 28
import org.distorted.library.program.DistortedProgram
29
import java.lang.reflect.Method
30 29
import java.nio.ByteBuffer
31 30
import java.nio.ByteOrder
32 31
import java.nio.FloatBuffer
......
132 131
            mSources.clear()
133 132
            mNumSources = 0
134 133

  
135
            var method: Method?
136

  
137 134
            for (name in EffectName.entries)
138
            {
139
                if (name.type==EffectType.POSTPROCESS)
140
                {
141
                    val cls = name.effectClass
142

  
143
                    try
144
                    {
145
                        method = cls.getDeclaredMethod("destroyStatics") // destroyStatics not public, thus getDeclaredMethod
146
                    }
147
                    catch (ex: NoSuchMethodException)
148
                    {
149
                        DistortedLibrary.logMessage("PostprocessEffect: "+cls.simpleName+": exception getting method: "+ex.message)
150
                        method = null
151
                    }
152

  
153
                    try
154
                    {
155
                        method?.invoke(null)
156
                    }
157
                    catch (ex: Exception)
158
                    {
159
                        DistortedLibrary.logMessage("PostprocessEffect: exception invoking method: "+ex.message)
160
                    }
161
                }
162
            }
135
                if (name.type==EffectType.POSTPROCESS) name.destroy?.invoke()
163 136
        }
164 137
    }
165 138
    ///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/library/effect/VertexEffect.kt
21 21
package org.distorted.library.effect
22 22

  
23 23
import org.distorted.library.effectqueue.EffectQueue
24
import org.distorted.library.main.DistortedLibrary
25 24
import org.distorted.library.type.Static1D
26 25
import org.distorted.library.type.Static3D
27 26
import org.distorted.library.type.Static4D
28 27
import org.distorted.library.type.Static5D
29
import java.lang.reflect.Method
30 28

  
31 29
///////////////////////////////////////////////////////////////////////////////////////////////////
32 30
/**
......
96 94
        // prepare the code to be injected into the Full program, i.e. code of ALL vertex effects.
97 95
        private fun prepareFull()
98 96
        {
99
            var method: Method?
100

  
101 97
            for (name in EffectName.entries)
102
            {
103 98
                if (name.type==EffectType.VERTEX)
104 99
                {
105
                    val cls = name.effectClass
106

  
107
                    try
108
                    {
109
                        method = cls.getDeclaredMethod("code")
110
                    }
111
                    catch (ex: NoSuchMethodException)
112
                    {
113
                        DistortedLibrary.logMessage("VertexEffect: exception getting method: "+ex.message)
114
                        method = null
115
                    }
116

  
117
                    try
118
                    {
119
                        if (method!=null)
120
                        {
121
                            val value = method.invoke(null)
122
                            val code = value as String
123
                            mFullGLSL += retSection(name.ordinal, code)
124
                            mFullEnabled++
125
                        }
126
                    }
127
                    catch (ex: Exception)
128
                    {
129
                        DistortedLibrary.logMessage("VertexEffect: exception invoking method: "+ex.message)
130
                    }
100
                    val code = name.code?.invoke()
101
                    mFullGLSL += retSection(name.ordinal, code)
102
                    mFullEnabled++
131 103
                }
132
            }
133 104
        }
134 105

  
135 106
        ///////////////////////////////////////////////////////////////////////////////////////////////////
......
235 206
            return null
236 207
        }
237 208
    }
209
    // end companion
238 210
    ///////////////////////////////////////////////////////////////////////////////////////////////////
239 211
    override fun addQueue(queue: EffectQueue)
240 212
    {
src/main/java/org/distorted/library/effect/VertexEffectDeform.kt
77 77
        //    X(x,y) = -B*x * (|Vy|/(|Vy|+A*W)) * (1-(y/H)^2)                               (**)
78 78
        //    Y(x,y) = Vy * (1 - |y|/(|Vy|+C*|y|)) * (1 - (A*W/(|Vy|+A*W))*(x/W)^2)         (**)
79 79
        //
80
        // We notice that formulas (**) have been construed so that it is possible to continously mirror them
80
        // We notice that formulas (**) have been construed so that it is possible to continuously mirror them
81 81
        // left-right and up-down (i.e. apply not only to the 'bottom-right' rectangle of the 4 subrectangles
82 82
        // but to all 4 of them!).
83 83
        //
......
85 85
        // a) A : valid values: (0,infinity). 'Bendiness' if the surface - the higher A is, the more the surface
86 86
        //        bends. A<=0 destroys the system.
87 87
        // b) B : valid values: <-1,1>. The amount side edges get 'sucked' inwards when we pull the middle of the
88
        //        top edge up. B=0 --> not at all, B=1: a looot. B=-0.5: the edges will actually be pushed outwards
88
        //        top edge up. B=0 --> not at all, B=1: a lot. B=-0.5: the edges will actually be pushed outwards
89 89
        //        quite a bit. One can also set it to <-1 or >1, but it will look a bit ridiculous.
90 90
        // c) C : valid values: <1,infinity). The derivative of the H(y) function at 0, i.e. the rate of 'squeeze'
91 91
        //        surface gets along the force line. C=1: our point gets pulled very closely to points above it

Also available in: Unified diff