Project

General

Profile

« Previous | Next » 

Revision 2885d4f1

Added by Leszek Koltunski 2 days ago

migrate the 'effect' package.

View differences:

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( type: EffectType, unity: FloatArray, dim: Int, regionDim: Int, centerDim: Int, effectClass: Class<out Effect?>)
40
enum class EffectName( t: EffectType, u: FloatArray, d: Int, r: Int, c: Int, e: Class<out Effect>)
41 41
{
42 42
    // EFFECT NAME /////// EFFECT TYPE ////////// EFFECT UNITY //////////// DIM REGION CENTER // CLASS
43 43
    ROTATE           (EffectType.MATRIX,      floatArrayOf(0.0f),             4, 0, 3, MatrixEffectRotate::class.java),
......
116 116
    ///////////////////////////////////////////////////////////////////////////////////////////////
117 117
    init
118 118
    {
119
        this.type        = type
120
        this.unity       = unity
121
        this.dimension   = dim
122
        this.regionDim   = regionDim
123
        this.centerDim   = centerDim
124
        this.effectClass = effectClass
119
        type        = t
120
        unity       = u
121
        dimension   = d
122
        regionDim   = r
123
        centerDim   = c
124
        effectClass = e
125 125
    }
126 126
    ///////////////////////////////////////////////////////////////////////////////////////////////
127 127
    fun getName(ordinal: Int): EffectName? = names[ordinal]
src/main/java/org/distorted/library/effect/FragmentEffect.kt
41 41
        private var mGLSL = ""
42 42
        private var numEnabled: Int = 0  //  number of Fragment effects enabled.
43 43
        val MAX_REGION: Static3D = Static3D(1000000f, 1000000f, 1000000f)
44
        @JvmStatic val gLSL: String get() = mGLSL+"{}"
44

  
45
        ///////////////////////////////////////////////////////////////////////////////////////////
46
        @JvmStatic fun getGLSL(): String = mGLSL+"{}"
47

  
48
        ///////////////////////////////////////////////////////////////////////////////////////////
49
        @JvmStatic fun getNumEnabled(): Int = numEnabled
45 50

  
46 51
        ///////////////////////////////////////////////////////////////////////////////////////////////////
47 52
        // prepare code to be injected into the 'main_fragment_shader' main() function.
src/main/java/org/distorted/library/effect/VertexEffect.kt
40 40
    {
41 41
        const val NUM_FLOAT_UNIFORMS = 12 //  5 per-effect interpolated values, 3-dimensional center, 4-dimensional Region
42 42
        const val NUM_INT_UNIFORMS   = 4  // name, AND association, reserved, EQU Association
43

  
44 43
        const val VALUES_OFFSET = 0
45 44
        const val CENTER_OFFSET = 5
46 45
        const val REGION_OFFSET = 8
46

  
47 47
        private var mGLSL = ""
48 48
        private var numEnabled: Int = 0 // number of Vertex effects enabled.
49 49
        private var mFullGLSL = ""
......
52 52

  
53 53
        val MAX_REGION: Static4D = Static4D(0f,0f,0f,1000000f)
54 54

  
55
        @JvmStatic val gLSL: String get() = mGLSL+"{}"
56 55
        @JvmStatic val allGLSL: String
57 56
            get()
58 57
            {
......
76 75
                return mFullEnabled
77 76
            }
78 77

  
78
        ///////////////////////////////////////////////////////////////////////////////////////////
79
        @JvmStatic fun getNumEnabled(): Int = numEnabled
80

  
81
        ///////////////////////////////////////////////////////////////////////////////////////////
82
        @JvmStatic fun getGLSL(): String = mGLSL+"{}"
83

  
79 84
        ///////////////////////////////////////////////////////////////////////////////////////////
80 85
        private fun retSection(effect: Int, code: String?): String
81 86
        {
src/main/java/org/distorted/library/effectqueue/EffectQueuePostprocess.kt
199 199
    }
200 200

  
201 201
    ///////////////////////////////////////////////////////////////////////////////////////////////
202
    fun postprocess(buffer: DistortedFramebuffer?): Int
202
    fun postprocess(buffer: DistortedFramebuffer): Int
203 203
    {
204 204
        var numRenders = 0
205 205
        val array = mUBF!!.backingArray
src/main/java/org/distorted/library/main/DistortedEffects.java
159 159
 */
160 160
  public int abortByName(EffectName name)
161 161
    {
162
    int num = name.type.ordinal();
162
    int num = name.getType().ordinal();
163 163
    return mQueues[num].removeByName(name);
164 164
    }
165 165

  
src/main/java/org/distorted/library/message/EffectMessageSender.kt
112 112

  
113 113
            if (numListeners>0)
114 114
            {
115
                val id = effect.id
115
                val id = effect.iD
116 116

  
117 117
                for (i in 0 until numListeners)
118 118
                {
119 119
                    val listener = effect.removeFirstListener()
120
                    val msg = Message(listener, id)
120
                    val msg = Message(listener!!, id)
121 121
                    mList!!.add(msg)
122 122
                }
123 123

  

Also available in: Unified diff