Revision 0bff60a4
Added by Leszek Koltunski 22 days ago
src/main/java/org/distorted/library/effect/Effect.kt | ||
---|---|---|
64 | 64 |
* |
65 | 65 |
* @y.exclude |
66 | 66 |
*/ |
67 |
@JvmStatic |
|
68 | 67 |
fun onPause() |
69 | 68 |
{ |
70 | 69 |
for (i in 0 until NUM_EFFECTS) mEnabled[i] = false |
... | ... | |
83 | 82 |
* |
84 | 83 |
* @param type EffectType to enable. |
85 | 84 |
*/ |
86 |
@JvmStatic |
|
87 | 85 |
fun enableEffects(type: EffectType) |
88 | 86 |
{ |
89 | 87 |
var method: Method? |
src/main/java/org/distorted/library/effect/EffectQuality.kt | ||
---|---|---|
38 | 38 |
|
39 | 39 |
companion object |
40 | 40 |
{ |
41 |
@JvmField val LENGTH: Int = entries.size
|
|
41 |
val LENGTH: Int = entries.size |
|
42 | 42 |
private val qualities: Array<EffectQuality?> |
43 | 43 |
|
44 | 44 |
init |
... | ... | |
48 | 48 |
for (q in entries) qualities[i++] = q |
49 | 49 |
} |
50 | 50 |
|
51 |
@JvmStatic fun getMipmap(quality: Int): Float = qualities[quality]!!.mipmap
|
|
51 |
fun getMipmap(quality: Int): Float = qualities[quality]!!.mipmap |
|
52 | 52 |
} |
53 | 53 |
} |
54 | 54 |
|
src/main/java/org/distorted/library/effect/EffectType.kt | ||
---|---|---|
36 | 36 |
|
37 | 37 |
companion object |
38 | 38 |
{ |
39 |
@JvmField val LENGTH: Int = entries.size
|
|
40 |
@JvmField val MASK: Int = (1 shl LENGTH)-1
|
|
41 |
@JvmStatic fun reset(maxtable: IntArray)
|
|
39 |
val LENGTH: Int = entries.size |
|
40 |
val MASK: Int = (1 shl LENGTH)-1 |
|
41 |
fun reset(maxtable: IntArray) |
|
42 | 42 |
{ |
43 | 43 |
maxtable[0] = 100 // By default, there can be a maximum 100 MATRIX effects in a single |
44 | 44 |
// EffectQueueMatrix at any given time. This can be changed with a call |
... | ... | |
48 | 48 |
maxtable[3] = 3 // Max 3 POSTPROCESSING Effects |
49 | 49 |
} |
50 | 50 |
|
51 |
@JvmStatic fun getType(ordinal: Int): EffectType = entries[ordinal]
|
|
51 |
fun getType(ordinal: Int): EffectType = entries[ordinal] |
|
52 | 52 |
} |
53 | 53 |
} |
src/main/java/org/distorted/library/effect/FragmentEffect.kt | ||
---|---|---|
43 | 43 |
val MAX_REGION: Static3D = Static3D(1000000f, 1000000f, 1000000f) |
44 | 44 |
|
45 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////// |
46 |
@JvmStatic fun getGLSL(): String = mGLSL+"{}"
|
|
46 |
fun getGLSL(): String = mGLSL+"{}" |
|
47 | 47 |
|
48 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////// |
49 |
@JvmStatic fun getNumEnabled(): Int = numEnabled
|
|
49 |
fun getNumEnabled(): Int = numEnabled |
|
50 | 50 |
|
51 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
52 | 52 |
// prepare code to be injected into the 'main_fragment_shader' main() function. |
src/main/java/org/distorted/library/effect/FragmentEffectAlpha.kt | ||
---|---|---|
39 | 39 |
/** |
40 | 40 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work. |
41 | 41 |
*/ |
42 |
@JvmStatic fun enable()
|
|
42 |
fun enable() |
|
43 | 43 |
{ |
44 | 44 |
addEffect(EffectName.ALPHA, EffectName.SMOOTH_ALPHA, |
45 | 45 |
"color.a *= (degree*(fUniforms[effect].x-1.0)+1.0);") |
src/main/java/org/distorted/library/effect/FragmentEffectBrightness.kt | ||
---|---|---|
39 | 39 |
/** |
40 | 40 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work. |
41 | 41 |
*/ |
42 |
@JvmStatic fun enable()
|
|
42 |
fun enable() |
|
43 | 43 |
{ |
44 | 44 |
addEffect(EffectName.BRIGHTNESS, EffectName.SMOOTH_BRIGHTNESS, |
45 | 45 |
"color.rgb = mix(vec3(0.0,0.0,0.0), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 );") |
src/main/java/org/distorted/library/effect/FragmentEffectChroma.kt | ||
---|---|---|
40 | 40 |
/** |
41 | 41 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work. |
42 | 42 |
*/ |
43 |
@JvmStatic fun enable()
|
|
43 |
fun enable() |
|
44 | 44 |
{ |
45 | 45 |
addEffect(EffectName.CHROMA, EffectName.SMOOTH_CHROMA, |
46 | 46 |
"color.rgb = mix(color.rgb, fUniforms[effect].yzw, degree*fUniforms[effect].x);") |
src/main/java/org/distorted/library/effect/FragmentEffectContrast.kt | ||
---|---|---|
38 | 38 |
/** |
39 | 39 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work. |
40 | 40 |
*/ |
41 |
@JvmStatic fun enable()
|
|
41 |
fun enable() |
|
42 | 42 |
{ |
43 | 43 |
addEffect(EffectName.CONTRAST, EffectName.SMOOTH_CONTRAST, |
44 | 44 |
"color.rgb = mix(vec3(0.5,0.5,0.5), color.rgb, degree*(fUniforms[effect].x-1.0)+1.0 );") |
src/main/java/org/distorted/library/effect/FragmentEffectSaturation.kt | ||
---|---|---|
39 | 39 |
/** |
40 | 40 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work. |
41 | 41 |
*/ |
42 |
@JvmStatic fun enable()
|
|
42 |
fun enable() |
|
43 | 43 |
{ |
44 | 44 |
addEffect(EffectName.SATURATION, EffectName.SMOOTH_SATURATION, |
45 | 45 |
""" |
src/main/java/org/distorted/library/effect/PostprocessEffect.kt | ||
---|---|---|
102 | 102 |
} |
103 | 103 |
|
104 | 104 |
/////////////////////////////////////////////////////////////////////////////////////////// |
105 |
@JvmStatic fun createPrograms(GLSL: Int)
|
|
105 |
fun createPrograms(GLSL: Int) |
|
106 | 106 |
{ |
107 | 107 |
var source: Source |
108 | 108 |
val len = mSources.size |
src/main/java/org/distorted/library/effect/PostprocessEffectBlur.kt | ||
---|---|---|
37 | 37 |
/** |
38 | 38 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work. |
39 | 39 |
*/ |
40 |
@JvmStatic fun enable() = enable("BLUR1", "BLUR2")
|
|
40 |
fun enable() = enable("BLUR1", "BLUR2") |
|
41 | 41 |
|
42 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
43 | 43 |
// Clean up of static variables on exit. Called by reflection from super class. |
44 | 44 |
@Suppress("unused") |
45 |
@JvmStatic |
|
46 | 45 |
fun destroyStatics() = PostprocessEffectBlurred.destroyStatics() |
47 | 46 |
} |
48 | 47 |
|
src/main/java/org/distorted/library/effect/PostprocessEffectBlurred.kt | ||
---|---|---|
206 | 206 |
private var mIndex2 = 0 |
207 | 207 |
|
208 | 208 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
209 |
@JvmStatic fun destroyStatics()
|
|
209 |
fun destroyStatics() |
|
210 | 210 |
{ |
211 | 211 |
mProgram1 = null |
212 | 212 |
mProgram2 = null |
... | ... | |
221 | 221 |
/** |
222 | 222 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work. |
223 | 223 |
*/ |
224 |
@JvmStatic fun enable(prog1: String, prog2: String)
|
|
224 |
fun enable(prog1: String, prog2: String) |
|
225 | 225 |
{ |
226 | 226 |
val vertex = |
227 | 227 |
""" precision lowp float; |
src/main/java/org/distorted/library/effect/PostprocessEffectBorder.kt | ||
---|---|---|
39 | 39 |
{ |
40 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////// |
41 | 41 |
// Clean up of static variables on exit. Called by reflection from super class. |
42 |
@Suppress("unused") @JvmStatic fun destroyStatics() { }
|
|
42 |
@Suppress("unused") fun destroyStatics() { } |
|
43 | 43 |
/** |
44 | 44 |
* No local programs; we do not postprocess anything here. No need to do anything |
45 | 45 |
*/ |
46 |
@JvmStatic fun enable() { }
|
|
46 |
fun enable() { } |
|
47 | 47 |
} |
48 | 48 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
49 | 49 |
override fun compute(uniforms: FloatArray, index: Int, currentDuration: Long, step: Long): Boolean |
src/main/java/org/distorted/library/effect/PostprocessEffectGlow.kt | ||
---|---|---|
38 | 38 |
/** |
39 | 39 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work. |
40 | 40 |
*/ |
41 |
@JvmStatic fun enable() = enable("GLOW1", "GLOW2")
|
|
41 |
fun enable() = enable("GLOW1", "GLOW2") |
|
42 | 42 |
|
43 | 43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
44 | 44 |
// Clean up of static variables on exit. Called by reflection from super class. |
45 |
@Suppress("unused") @JvmStatic fun destroyStatics() = PostprocessEffectBlurred.destroyStatics()
|
|
45 |
@Suppress("unused") fun destroyStatics() = PostprocessEffectBlurred.destroyStatics() |
|
46 | 46 |
} |
47 | 47 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
48 | 48 |
override fun compute(uniforms: FloatArray, index: Int, currentDuration: Long, step: Long): Boolean |
src/main/java/org/distorted/library/effect/VertexEffect.kt | ||
---|---|---|
52 | 52 |
|
53 | 53 |
val MAX_REGION: Static4D = Static4D(0f,0f,0f,1000000f) |
54 | 54 |
|
55 |
@JvmStatic val allGLSL: String
|
|
55 |
val allGLSL: String |
|
56 | 56 |
get() |
57 | 57 |
{ |
58 | 58 |
if (!mFullPrepared) |
... | ... | |
63 | 63 |
|
64 | 64 |
return mFullGLSL+"{}" |
65 | 65 |
} |
66 |
@JvmStatic val allEnabled: Int
|
|
66 |
val allEnabled: Int |
|
67 | 67 |
get() |
68 | 68 |
{ |
69 | 69 |
if (!mFullPrepared) |
... | ... | |
76 | 76 |
} |
77 | 77 |
|
78 | 78 |
/////////////////////////////////////////////////////////////////////////////////////////// |
79 |
@JvmStatic fun getNumEnabled(): Int = numEnabled
|
|
79 |
fun getNumEnabled(): Int = numEnabled |
|
80 | 80 |
|
81 | 81 |
/////////////////////////////////////////////////////////////////////////////////////////// |
82 |
@JvmStatic fun getGLSL(): String = mGLSL+"{}"
|
|
82 |
fun getGLSL(): String = mGLSL+"{}" |
|
83 | 83 |
|
84 | 84 |
/////////////////////////////////////////////////////////////////////////////////////////// |
85 | 85 |
private fun retSection(effect: Int, code: String?): String |
... | ... | |
160 | 160 |
/** |
161 | 161 |
* Return a constructed VertexEffect based on its name, the 5 variables, center & region. |
162 | 162 |
*/ |
163 |
@JvmStatic |
|
164 | 163 |
fun constructEffect(name: String, vars: FloatArray, center: FloatArray, region: FloatArray): VertexEffect? |
165 | 164 |
{ |
166 | 165 |
val staCenter = Static3D(center[0], center[1], center[2]) |
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 |
@JvmStatic fun code(): String
|
|
98 |
fun code(): String |
|
99 | 99 |
{ |
100 | 100 |
return (""" |
101 | 101 |
const vec3 ONE = vec3(1.0,1.0,1.0); |
... | ... | |
135 | 135 |
/** |
136 | 136 |
* Have to call this before the shaders get compiled (i.e before DistortedLibrary.onCreate()) for the Effect to work. |
137 | 137 |
*/ |
138 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
138 |
fun enable() = addEffect(NAME, code()) |
|
139 | 139 |
} |
140 | 140 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
141 | 141 |
/** |
src/main/java/org/distorted/library/effect/VertexEffectDisappear.kt | ||
---|---|---|
29 | 29 |
companion object |
30 | 30 |
{ |
31 | 31 |
private val NAME = EffectName.DISAPPEAR |
32 |
@JvmStatic fun code(): String = "v = vec3(0.0, 0.0, 0.0);"
|
|
33 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
32 |
fun code(): String = "v = vec3(0.0, 0.0, 0.0);" |
|
33 |
fun enable() = addEffect(NAME, code()) |
|
34 | 34 |
} |
35 | 35 |
|
36 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
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 |
@JvmStatic fun code(): String
|
|
114 |
fun code(): String |
|
115 | 115 |
{ |
116 | 116 |
return (""" vec3 ps = vUniforms[effect+1].yzw - v; |
117 | 117 |
vec3 force = vUniforms[effect].xyz; |
... | ... | |
138 | 138 |
} |
139 | 139 |
|
140 | 140 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
141 |
@JvmStatic fun enable() =addEffect(NAME, code())
|
|
141 |
fun enable() =addEffect(NAME, code()) |
|
142 | 142 |
} |
143 | 143 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
144 | 144 |
override fun compute(uniforms: FloatArray, index: Int, currentDuration: Long, step: Long): Boolean |
src/main/java/org/distorted/library/effect/VertexEffectMove.kt | ||
---|---|---|
33 | 33 |
companion object |
34 | 34 |
{ |
35 | 35 |
private val NAME = EffectName.VERTEX_MOVE |
36 |
@JvmStatic fun code(): String = "v += vUniforms[effect].xyz;"
|
|
37 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
36 |
fun code(): String = "v += vUniforms[effect].xyz;" |
|
37 |
fun enable() = addEffect(NAME, code()) |
|
38 | 38 |
} |
39 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
40 | 40 |
override fun compute(uniforms: FloatArray, index: Int, currentDuration: Long, step: Long): Boolean |
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 |
@JvmStatic fun code(): String
|
|
52 |
fun code(): String |
|
53 | 53 |
{ |
54 | 54 |
return (""" |
55 | 55 |
vec3 ps = vUniforms[effect+1].yzw -v; |
... | ... | |
78 | 78 |
} |
79 | 79 |
|
80 | 80 |
/////////////////////////////////////////////////////////////////////////////////////////// |
81 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
81 |
fun enable() = addEffect(NAME, code()) |
|
82 | 82 |
} |
83 | 83 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
84 | 84 |
override fun compute(uniforms: FloatArray, index: Int, currentDuration: Long, step: Long): Boolean |
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 |
@JvmStatic fun code(): String
|
|
46 |
fun code(): String |
|
47 | 47 |
{ |
48 | 48 |
return (""" |
49 | 49 |
vec3 pc = vUniforms[effect+1].yzw - v; |
... | ... | |
70 | 70 |
} |
71 | 71 |
|
72 | 72 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
73 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
73 |
fun enable() = addEffect(NAME, code()) |
|
74 | 74 |
} |
75 | 75 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
76 | 76 |
override fun compute(uniforms: FloatArray, index: Int, currentDuration: Long, step: Long): Boolean |
src/main/java/org/distorted/library/effect/VertexEffectQuaternion.kt | ||
---|---|---|
37 | 37 |
private val NAME = EffectName.VERTEX_QUATERNION |
38 | 38 |
|
39 | 39 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
40 |
@JvmStatic fun code(): String
|
|
40 |
fun code(): String |
|
41 | 41 |
{ |
42 | 42 |
return (""" |
43 | 43 |
float qx = vUniforms[effect].x; |
... | ... | |
66 | 66 |
} |
67 | 67 |
|
68 | 68 |
/////////////////////////////////////////////////////////////////////////////////////////// |
69 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
69 |
fun enable() = addEffect(NAME, code()) |
|
70 | 70 |
} |
71 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
72 | 72 |
override fun compute(uniforms: FloatArray, index: Int, currentDuration: Long, step: Long): Boolean |
src/main/java/org/distorted/library/effect/VertexEffectRotate.kt | ||
---|---|---|
39 | 39 |
private val NAME = EffectName.VERTEX_ROTATE |
40 | 40 |
|
41 | 41 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 |
@JvmStatic fun code(): String
|
|
42 |
fun code(): String |
|
43 | 43 |
{ |
44 | 44 |
return (""" |
45 | 45 |
float angle = vUniforms[effect].x*3.14159265/360.0; |
... | ... | |
71 | 71 |
} |
72 | 72 |
|
73 | 73 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
74 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
74 |
fun enable() = addEffect(NAME, code()) |
|
75 | 75 |
} |
76 | 76 |
|
77 | 77 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/library/effect/VertexEffectScale.kt | ||
---|---|---|
36 | 36 |
private val NAME = EffectName.VERTEX_SCALE |
37 | 37 |
|
38 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
39 |
@JvmStatic fun code(): String
|
|
39 |
fun code(): String |
|
40 | 40 |
{ |
41 | 41 |
return """ |
42 | 42 |
v *= vUniforms[effect].xyz; |
... | ... | |
49 | 49 |
} |
50 | 50 |
|
51 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
52 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
52 |
fun enable() = addEffect(NAME, code()) |
|
53 | 53 |
} |
54 | 54 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
55 | 55 |
override fun compute(uniforms: FloatArray, index: Int, currentDuration: Long, step: Long): Boolean |
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 |
@JvmStatic fun code(): String
|
|
40 |
fun code(): String |
|
41 | 41 |
{ |
42 | 42 |
return (""" |
43 | 43 |
float sx = vUniforms[effect].x; |
... | ... | |
62 | 62 |
} |
63 | 63 |
|
64 | 64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
65 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
65 |
fun enable() = addEffect(NAME, code()) |
|
66 | 66 |
} |
67 | 67 |
|
68 | 68 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
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 |
@JvmStatic fun code(): String
|
|
48 |
fun code(): String |
|
49 | 49 |
{ |
50 | 50 |
return (""" |
51 | 51 |
vec3 ps = vUniforms[effect+1].yzw - v; |
... | ... | |
69 | 69 |
} |
70 | 70 |
|
71 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
72 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
72 |
fun enable() = addEffect(NAME, code()) |
|
73 | 73 |
} |
74 | 74 |
|
75 | 75 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
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 |
@JvmStatic fun code(): String
|
|
51 |
fun code(): String |
|
52 | 52 |
{ |
53 | 53 |
return (""" |
54 | 54 |
vec3 center = vUniforms[effect+1].yzw; |
... | ... | |
67 | 67 |
} |
68 | 68 |
|
69 | 69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
70 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
70 |
fun enable() = addEffect(NAME, code()) |
|
71 | 71 |
} |
72 | 72 |
|
73 | 73 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
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 |
@JvmStatic fun code(): String
|
|
109 |
fun code(): String |
|
110 | 110 |
{ |
111 | 111 |
return (""" |
112 | 112 |
vec3 center = vUniforms[effect+1].yzw; |
... | ... | |
157 | 157 |
} |
158 | 158 |
|
159 | 159 |
/////////////////////////////////////////////////////////////////////////////////////////// |
160 |
@JvmStatic fun enable() = addEffect(NAME, code())
|
|
160 |
fun enable() = addEffect(NAME, code()) |
|
161 | 161 |
} |
162 | 162 |
/////////////////////////////////////////////////////////////////////////////////////////////// |
163 | 163 |
override fun compute(uniforms: FloatArray, index: Int, currentDuration: Long, step: Long): Boolean |
src/main/java/org/distorted/library/effectqueue/EffectQueue.kt | ||
---|---|---|
64 | 64 |
private const val DETALL = 3 |
65 | 65 |
|
66 | 66 |
/////////////////////////////////////////////////////////////////////////////////////////// |
67 |
@JvmStatic |
|
68 | 67 |
fun createQueues() : Array<EffectQueue> |
69 | 68 |
{ |
70 | 69 |
val queues: Array<EffectQueue?> = arrayOfNulls(EffectType.LENGTH) |
... | ... | |
78 | 77 |
} |
79 | 78 |
|
80 | 79 |
/////////////////////////////////////////////////////////////////////////////////////////// |
81 |
@JvmStatic |
|
82 | 80 |
fun createQueues(from: Array<EffectQueue>, flags: Int) : Array<EffectQueue> |
83 | 81 |
{ |
84 | 82 |
val queues: Array<EffectQueue?> = arrayOfNulls(EffectType.LENGTH) |
... | ... | |
92 | 90 |
} |
93 | 91 |
|
94 | 92 |
/////////////////////////////////////////////////////////////////////////////////////////// |
95 |
@JvmStatic |
|
96 | 93 |
fun compute(queues: Array<EffectQueue>, currTime: Long, step: Long) |
97 | 94 |
{ |
98 | 95 |
(queues[0] as EffectQueueMatrix ).compute(currTime, step) |
... | ... | |
102 | 99 |
} |
103 | 100 |
|
104 | 101 |
/////////////////////////////////////////////////////////////////////////////////////////// |
105 |
@JvmStatic |
|
106 | 102 |
fun send(queues: Array<EffectQueue>, programH: Int, distance: Float, mipmap: Float, |
107 | 103 |
projection: FloatArray, inflate: Float, variant: Int) |
108 | 104 |
{ |
... | ... | |
113 | 109 |
|
114 | 110 |
/////////////////////////////////////////////////////////////////////////////////////////// |
115 | 111 |
// variant: 0 --> MAIN 1 --> OIT 2 --> prePOST 3 --> FULL |
116 |
@JvmStatic |
|
117 | 112 |
fun getUniforms(programH: Int, variant: Int) |
118 | 113 |
{ |
119 | 114 |
EffectQueueFragment.uniforms(programH, variant) |
... | ... | |
122 | 117 |
} |
123 | 118 |
|
124 | 119 |
/////////////////////////////////////////////////////////////////////////////////////////// |
125 |
@JvmStatic |
|
126 | 120 |
fun setMax(index: Int, m: Int): Boolean |
127 | 121 |
{ |
128 | 122 |
return InternalStackFrameList.setMax(index, max(m,0) ) |
129 | 123 |
} |
130 | 124 |
|
131 | 125 |
/////////////////////////////////////////////////////////////////////////////////////////// |
132 |
@JvmStatic |
|
133 | 126 |
fun getMax(index: Int): Int = InternalStackFrameList.getMax(index) |
134 | 127 |
} |
135 | 128 |
|
src/main/java/org/distorted/library/effectqueue/EffectQueuePostprocess.kt | ||
---|---|---|
67 | 67 |
private var mPreProgramH = 0 |
68 | 68 |
|
69 | 69 |
/////////////////////////////////////////////////////////////////////////////////////////// |
70 |
@JvmStatic |
|
70 |
|
|
71 | 71 |
fun createPrograms(vert: InputStream, frag: InputStream, GLSL: Int) |
72 | 72 |
{ |
73 | 73 |
val numV = VertexEffect.getNumEnabled() |
src/main/java/org/distorted/library/helpers/MatrixHelper.kt | ||
---|---|---|
23 | 23 |
|
24 | 24 |
object MatrixHelper |
25 | 25 |
{ |
26 |
@JvmStatic fun setIdentity(output: FloatArray)
|
|
26 |
fun setIdentity(output: FloatArray) |
|
27 | 27 |
{ |
28 | 28 |
output[ 0] = 1f |
29 | 29 |
output[ 1] = 0f |
... | ... | |
44 | 44 |
} |
45 | 45 |
|
46 | 46 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
47 |
@JvmStatic |
|
48 | 47 |
fun multiply(output: FloatArray, m1: FloatArray, m2: FloatArray) |
49 | 48 |
{ |
50 | 49 |
output[ 0] = m1[0] * m2[ 0] + m1[4] * m2[ 1] + m1[ 8] * m2[ 2] + m1[12] * m2[ 3] |
... | ... | |
69 | 68 |
} |
70 | 69 |
|
71 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
72 |
@JvmStatic |
|
73 | 71 |
fun frustum(output: FloatArray, l: Float, r: Float, b: Float, t: Float, n: Float, f: Float) |
74 | 72 |
{ |
75 | 73 |
output[ 0] = 2 * n / (r - l) |
... | ... | |
91 | 89 |
} |
92 | 90 |
|
93 | 91 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
94 |
@JvmStatic |
|
95 | 92 |
fun ortho(output: FloatArray, l: Float, r: Float, b: Float, t: Float, n: Float, f: Float) |
96 | 93 |
{ |
97 | 94 |
output[ 0] = 2 / (r - l) |
... | ... | |
124 | 121 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
125 | 122 |
// this is android.opengl.Matrix.rotateM(), but with pre-computed sin and cos of the angle |
126 | 123 |
// and also we have to pre-allocate and pass here two temp arrays. |
127 |
@JvmStatic |
|
128 | 124 |
fun rotateSinCos(output: FloatArray, tmp1: FloatArray, tmp2: FloatArray, sin: Float, cos: Float, x: Float, y: Float, z: Float) |
129 | 125 |
{ |
130 | 126 |
tmp1[ 0] = (1-cos)*x*x + cos |
... | ... | |
165 | 161 |
} |
166 | 162 |
|
167 | 163 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
168 |
@JvmStatic |
|
169 | 164 |
fun translate(output: FloatArray, dx: Float, dy: Float, dz: Float) |
170 | 165 |
{ |
171 | 166 |
output[12] += (output[0]*dx + output[4]*dy + output[ 8]*dz) |
... | ... | |
175 | 170 |
} |
176 | 171 |
|
177 | 172 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
178 |
@JvmStatic |
|
179 | 173 |
fun scale(output: FloatArray, sx: Float, sy: Float, sz: Float) |
180 | 174 |
{ |
181 | 175 |
output[ 0] *= sx |
src/main/java/org/distorted/library/main/DistortedLibrary.kt | ||
---|---|---|
128 | 128 |
* There are only three possibilities: 300 (OpenGL ES 3.0) or 310 (at least OpenGL ES 3.1) |
129 | 129 |
* or 200 (OpenGL ES 2.0) |
130 | 130 |
*/ |
131 |
@JvmStatic var gLSL: Int = 0
|
|
131 |
var gLSL: Int = 0 |
|
132 | 132 |
private set |
133 | 133 |
private var mGLSL_VERSION: String? = null |
134 | 134 |
private var mOITCompilationAttempted = false |
... | ... | |
137 | 137 |
/** |
138 | 138 |
* Return the maximum size of the texture supported by the driver. |
139 | 139 |
*/ |
140 |
@JvmStatic var maxTextureSize: Int = Int.MAX_VALUE
|
|
140 |
var maxTextureSize: Int = Int.MAX_VALUE |
|
141 | 141 |
private set |
142 | 142 |
|
143 | 143 |
/** |
... | ... | |
1020 | 1020 |
* @param user The Code which will be using this library, which must implement the LibraryUser interface. |
1021 | 1021 |
* @param queueSize the size of the FBO queue, a workaround for the bug on Mali drivers. Use a small integer - 1,...,4 |
1022 | 1022 |
*/ |
1023 |
@JvmStatic |
|
1024 |
@JvmOverloads |
|
1025 | 1023 |
fun onSurfaceCreated(user: LibraryUser, queueSize: Int = 4) |
1026 | 1024 |
{ |
1027 | 1025 |
mUser = user |
... | ... | |
1092 | 1090 |
/** |
1093 | 1091 |
* Switch face culling on/off |
1094 | 1092 |
*/ |
1095 |
@JvmStatic |
|
1096 | 1093 |
fun setCull(on: Boolean) |
1097 | 1094 |
{ |
1098 | 1095 |
if (on) |
... | ... | |
1114 | 1111 |
* @param id id of an Activity that is using the library; anything unique so that the Library can |
1115 | 1112 |
* tell between Activities in case you're going to be using it from more than one. |
1116 | 1113 |
*/ |
1117 |
@JvmStatic |
|
1118 |
@JvmOverloads |
|
1119 | 1114 |
fun onCreate(id: Long = 0) |
1120 | 1115 |
{ |
1121 | 1116 |
InternalStackFrameList.onCreate(id) |
... | ... | |
1129 | 1124 |
* @param id id of an Activity that is using the library; anything unique so that the Library can |
1130 | 1125 |
* tell between Activities in case you're going to be using it from more than one. |
1131 | 1126 |
*/ |
1132 |
@JvmStatic |
|
1133 |
@JvmOverloads |
|
1134 | 1127 |
fun onResume(id: Long = 0) |
1135 | 1128 |
{ |
1136 | 1129 |
InternalStackFrameList.onResume(id) |
... | ... | |
1144 | 1137 |
* @param id id of an Activity that is using the library; anything unique so that the Library can |
1145 | 1138 |
* tell between Activities in case you're going to be using it from more than one. |
1146 | 1139 |
*/ |
1147 |
@JvmStatic |
|
1148 |
@JvmOverloads |
|
1149 | 1140 |
fun onPause(id: Long = 0) |
1150 | 1141 |
{ |
1151 | 1142 |
InternalStackFrameList.onPause(id) |
... | ... | |
1181 | 1172 |
* @param id id of an Activity that is using the library; anything unique so that the Library can |
1182 | 1173 |
* tell between Activities in case you're going to be using it from more than one. |
1183 | 1174 |
*/ |
1184 |
@JvmStatic |
|
1185 |
@JvmOverloads |
|
1186 | 1175 |
fun onDestroy(id: Long = 0) |
1187 | 1176 |
{ |
1188 | 1177 |
if (isInitialized) |
... | ... | |
1197 | 1186 |
* suffer from a very slow compilation of GLSL program if said program includes Transform Feedback. |
1198 | 1187 |
* Return true if the platform we are running on does not suffer from this problem. |
1199 | 1188 |
*/ |
1200 |
@JvmStatic |
|
1201 | 1189 |
fun fastCompilationTF(): Boolean |
1202 | 1190 |
{ |
1203 | 1191 |
return mFastCompilationTF |
... | ... | |
1209 | 1197 |
/** |
1210 | 1198 |
* Call this before calling onSurfaceCreated() if you want to access normal vectors in CPU. |
1211 | 1199 |
*/ |
1212 |
@JvmStatic |
|
1213 | 1200 |
fun needTransformFeedback() |
1214 | 1201 |
{ |
1215 | 1202 |
mNeedsTransformFeedback = true |
... | ... | |
1246 | 1233 |
* than Byte.MAX_VALUE |
1247 | 1234 |
* @return `true` if operation was successful, `false` otherwise. |
1248 | 1235 |
*/ |
1249 |
@JvmStatic |
|
1250 | 1236 |
@Suppress("unused") |
1251 | 1237 |
fun setMax(type: EffectType, max: Int): Boolean |
1252 | 1238 |
{ |
src/main/java/org/distorted/library/main/DistortedTexture.kt | ||
---|---|---|
33 | 33 |
* Create a Texture of arbitrary size and feed some pixels to it via the setTexture() method. |
34 | 34 |
*/ |
35 | 35 |
class DistortedTexture |
36 |
@JvmOverloads constructor(type: Int = TYPE_USER) : InternalSurface(NOT_CREATED_YET, 1, 1, type, STORAGE_PRIVATE)
|
|
36 |
constructor(type: Int = TYPE_USER) : InternalSurface(NOT_CREATED_YET, 1, 1, type, STORAGE_PRIVATE) |
|
37 | 37 |
{ |
38 | 38 |
private var mBmp: Bitmap? = null |
39 | 39 |
private var mBitmapInverted = false |
src/main/java/org/distorted/library/main/InternalNodeData.kt | ||
---|---|---|
23 | 23 |
/** |
24 | 24 |
* This is a member of DistortedNode. Makes sure two isomorphic Nodes only get rendered once. |
25 | 25 |
*/ |
26 |
class InternalNodeData(@JvmField val ID: Long, private val mKey: ArrayList<Long>)
|
|
26 |
class InternalNodeData( val ID: Long, private val mKey: ArrayList<Long>) |
|
27 | 27 |
{ |
28 | 28 |
private var numPointingNodes = 1 |
29 | 29 |
private var currTime: Long |
30 |
@JvmField var mFBO: DistortedFramebuffer? = null
|
|
30 |
var mFBO: DistortedFramebuffer? = null |
|
31 | 31 |
|
32 | 32 |
init { currTime = -1 } |
33 | 33 |
|
34 | 34 |
companion object |
35 | 35 |
{ |
36 |
@JvmStatic fun returnData(list: ArrayList<Long>): InternalNodeData
|
|
36 |
fun returnData(list: ArrayList<Long>): InternalNodeData |
|
37 | 37 |
{ |
38 | 38 |
var data = InternalStackFrameList.getMapID(list) |
39 | 39 |
if (data!=null) data.numPointingNodes++ |
src/main/java/org/distorted/library/main/InternalOutputSurface.kt | ||
---|---|---|
38 | 38 |
*/ |
39 | 39 |
abstract class InternalOutputSurface |
40 | 40 |
internal constructor(var mWidth: Int, var mHeight: Int, createColor: Int, numfbos: Int, numcolors: Int, |
41 |
@JvmField var mDepthStencil: Int, fbo: Int, type: Int, storage: Int)
|
|
41 |
var mDepthStencil: Int, fbo: Int, type: Int, storage: Int) |
|
42 | 42 |
: InternalSurface(createColor, numfbos, numcolors, type, storage), InternalChildrenList.Parent |
43 | 43 |
{ |
44 | 44 |
var fOV: Float |
... | ... | |
57 | 57 |
private val mChildren: InternalChildrenList |
58 | 58 |
private val mBufferInitialized: BooleanArray |
59 | 59 |
|
60 |
@JvmField var mDistance: Float = 0f
|
|
61 |
@JvmField var mNear: Float
|
|
62 |
@JvmField var mMipmap: Float = 1.0f
|
|
63 |
@JvmField var mProjectionMatrix: FloatArray
|
|
64 |
@JvmField var mDepthStencilCreated: Int
|
|
65 |
@JvmField var mDepthStencilH: IntArray? = null
|
|
66 |
@JvmField var mFBOH: IntArray
|
|
67 |
@JvmField var mRealWidth: Int // the Surface can be backed up by a texture larger than the viewport we have to it.
|
|
68 |
@JvmField var mRealHeight: Int // mWidth,mHeight are the sizes of the Viewport, those - sizes of the backing up texture.
|
|
69 |
@JvmField var mCurrFBO: Int = 0 // internal current FBO (see DistortedLibrary.FBO_QUEUE_SIZE)
|
|
60 |
var mDistance: Float = 0f |
|
61 |
var mNear: Float |
|
62 |
var mMipmap: Float = 1.0f |
|
63 |
var mProjectionMatrix: FloatArray |
|
64 |
var mDepthStencilCreated: Int |
|
65 |
var mDepthStencilH: IntArray? = null |
|
66 |
var mFBOH: IntArray |
|
67 |
var mRealWidth: Int // the Surface can be backed up by a texture larger than the viewport we have to it. |
|
68 |
var mRealHeight: Int // mWidth,mHeight are the sizes of the Viewport, those - sizes of the backing up texture. |
|
69 |
var mCurrFBO: Int = 0 // internal current FBO (see DistortedLibrary.FBO_QUEUE_SIZE) |
|
70 | 70 |
|
71 | 71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
72 | 72 |
companion object |
... | ... | |
123 | 123 |
} |
124 | 124 |
|
125 | 125 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
126 |
@JvmStatic |
|
127 | 126 |
@Synchronized |
128 | 127 |
fun onPause() |
129 | 128 |
{ |
src/main/java/org/distorted/library/main/InternalRenderState.kt | ||
---|---|---|
467 | 467 |
} |
468 | 468 |
|
469 | 469 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
470 |
@JvmStatic fun switchOffDrawing()
|
|
470 |
fun switchOffDrawing() |
|
471 | 471 |
{ |
472 | 472 |
GLES30.glEnable(GLES30.GL_SCISSOR_TEST) |
473 | 473 |
GLES30.glScissor(0, 0, 0, 0) |
474 | 474 |
} |
475 | 475 |
|
476 | 476 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
477 |
@JvmStatic fun restoreDrawing()
|
|
477 |
fun restoreDrawing() |
|
478 | 478 |
{ |
479 | 479 |
GLES30.glDisable(GLES30.GL_SCISSOR_TEST) |
480 | 480 |
} |
src/main/java/org/distorted/library/main/InternalStackFrameList.kt | ||
---|---|---|
41 | 41 |
private val mFrameList = ArrayList<InternalStackFrame?>() |
42 | 42 |
|
43 | 43 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
44 |
@JvmStatic |
|
45 | 44 |
fun onCreate(taskId: Long) |
46 | 45 |
{ |
47 | 46 |
val num = mFrameList.size |
... | ... | |
73 | 72 |
} |
74 | 73 |
|
75 | 74 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
76 |
@JvmStatic |
|
77 | 75 |
fun onResume(taskId: Long) |
78 | 76 |
{ |
79 | 77 |
val num = mFrameList.size |
... | ... | |
94 | 92 |
} |
95 | 93 |
|
96 | 94 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
97 |
@JvmStatic |
|
98 | 95 |
fun onPause(taskId: Long) |
99 | 96 |
{ |
100 | 97 |
val num = mFrameList.size |
... | ... | |
116 | 113 |
} |
117 | 114 |
|
118 | 115 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
119 |
@JvmStatic |
|
120 | 116 |
fun onDestroy(taskId: Long) |
121 | 117 |
{ |
122 | 118 |
val num = mFrameList.size |
... | ... | |
201 | 197 |
} |
202 | 198 |
} |
203 | 199 |
|
204 |
@JvmStatic val nextEffectsID: Long get() = currentFrame!!.nextEffectsID
|
|
200 |
val nextEffectsID: Long get() = currentFrame!!.nextEffectsID |
|
205 | 201 |
|
206 | 202 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
207 | 203 |
fun getMapID(key: ArrayList<Long>): InternalNodeData? |
... | ... | |
225 | 221 |
|
226 | 222 |
val nextEffectID: Long get() = currentFrame!!.nextEffectID |
227 | 223 |
|
228 |
@JvmStatic |
|
229 | 224 |
var isInitialized: Boolean |
230 | 225 |
get() = currentFrame!!.isInitialized |
231 | 226 |
set(init) |
src/main/java/org/distorted/library/main/InternalSurface.kt | ||
---|---|---|
25 | 25 |
// common parent class of Texture & OutputSurface; so that we can store either in Nodes. |
26 | 26 |
abstract class InternalSurface(create: Int, numfbos: Int, numcolors: Int, type: Int, storage: Int) : InternalObject(type, storage) |
27 | 27 |
{ |
28 |
@JvmField var mColorCreated: Int = create
|
|
29 |
@JvmField var mNumColors : Int = numcolors
|
|
30 |
@JvmField var mNumFBOs : Int = numfbos
|
|
31 |
@JvmField var mColorH : IntArray? = null
|
|
28 |
var mColorCreated: Int = create |
|
29 |
var mNumColors : Int = numcolors |
|
30 |
var mNumFBOs : Int = numfbos |
|
31 |
var mColorH : IntArray? = null |
|
32 | 32 |
|
33 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 34 |
init |
src/main/java/org/distorted/library/mesh/DeferredJobs.kt | ||
---|---|---|
241 | 241 |
* |
242 | 242 |
* @y.exclude |
243 | 243 |
*/ |
244 |
@JvmStatic |
|
245 | 244 |
fun onPause() |
246 | 245 |
{ |
247 | 246 |
val num = mJobs.size |
src/main/java/org/distorted/library/mesh/MeshBase.kt | ||
---|---|---|
101 | 101 |
/** |
102 | 102 |
* How many mesh components are we going to need? Call before compilation of the shaders. |
103 | 103 |
*/ |
104 |
@JvmStatic |
|
105 | 104 |
var maxEffComponents: Int = 100 |
106 | 105 |
|
107 | 106 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
109 | 108 |
* Are we going to need per-component centers (needed for correct postprocessing of concave meshes) |
110 | 109 |
* Switching this on allocates 16*MAX_EFFECT_COMPONENTS bytes for uniforms in the vertex shader. |
111 | 110 |
*/ |
112 |
@JvmStatic |
|
113 | 111 |
var useCenters: Boolean = false |
114 | 112 |
|
115 | 113 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
116 |
@JvmStatic |
|
117 | 114 |
fun getUniforms(programH: Int, variant: Int) |
118 | 115 |
{ |
119 | 116 |
mCenterBlockIndex[variant] = GLES30.glGetUniformBlockIndex(programH, "componentCenter") |
src/main/java/org/distorted/library/mesh/MeshMultigon.kt | ||
---|---|---|
692 | 692 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
693 | 693 |
// PUBLIC API |
694 | 694 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
695 |
@JvmStatic |
|
696 | 695 |
fun computeEdgesUp(vertices: Array<Array<FloatArray>>): Array<IntArray> |
697 | 696 |
{ |
698 | 697 |
val numPoly = vertices.size |
... | ... | |
709 | 708 |
} |
710 | 709 |
|
711 | 710 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
712 |
@JvmStatic |
|
713 | 711 |
fun computeOuterAndHoleVertices(vertices: Array<Array<FloatArray>>, edgesUp: Array<IntArray>): Array<Array<FloatArray>> |
714 | 712 |
{ |
715 | 713 |
val tmp = ArrayList<FloatArray>() |
src/main/java/org/distorted/library/message/EffectMessageSender.kt | ||
---|---|---|
75 | 75 |
private var mStartTime: Long = 0 |
76 | 76 |
private var mStopTime: Long = 0 |
77 | 77 |
|
78 |
@JvmStatic fun startSending()
|
|
78 |
fun startSending() |
|
79 | 79 |
{ |
80 | 80 |
synchronized(mLock) |
81 | 81 |
{ |
... | ... | |
91 | 91 |
} |
92 | 92 |
} |
93 | 93 |
|
94 |
@JvmStatic fun stopSending()
|
|
94 |
fun stopSending() |
|
95 | 95 |
{ |
96 | 96 |
synchronized(mLock) |
97 | 97 |
{ |
... | ... | |
106 | 106 |
} |
107 | 107 |
} |
108 | 108 |
|
109 |
@JvmStatic fun newMessage(effect: Effect)
|
|
109 |
fun newMessage(effect: Effect) |
|
110 | 110 |
{ |
111 | 111 |
val numListeners = effect.numListeners |
112 | 112 |
|
... | ... | |
129 | 129 |
} |
130 | 130 |
} |
131 | 131 |
|
132 |
@JvmStatic val isRunning: Boolean
|
|
132 |
val isRunning: Boolean |
|
133 | 133 |
get() = mThis!=null |
134 | 134 |
|
135 |
@JvmStatic fun restartThread()
|
|
135 |
fun restartThread() |
|
136 | 136 |
{ |
137 | 137 |
synchronized(mLock) |
138 | 138 |
{ |
... | ... | |
145 | 145 |
} |
146 | 146 |
} |
147 | 147 |
|
148 |
@JvmStatic fun reportState(): String
|
|
148 |
fun reportState(): String |
|
149 | 149 |
{ |
150 | 150 |
return "running "+(mThis!=null)+" notify="+mNotify+" elements="+mList!!.size+ |
151 | 151 |
" start="+mStartTime+" stop="+mStopTime+" numStarts="+mNumStarts |
src/main/java/org/distorted/library/program/DistortedProgram.kt | ||
---|---|---|
49 | 49 |
* Pre has 3 attributes (position,texcoord,component) |
50 | 50 |
* Maybe there are other possibilities (only position and normal? 3- position,normal,texcoord?) |
51 | 51 |
*/ |
52 |
@JvmField var mAttributeLayout: Int = 0
|
|
52 |
var mAttributeLayout: Int = 0 |
|
53 | 53 |
|
54 | 54 |
/** |
55 | 55 |
* List of Attributes (OpenGL ES 3.0: 'in' variables), in the same order as declared in the shader source. |
56 | 56 |
*/ |
57 |
@JvmField var mAttribute: IntArray? = null
|
|
57 |
var mAttribute: IntArray? = null |
|
58 | 58 |
|
59 | 59 |
/** |
60 | 60 |
* List of Uniforms, in the same order as declared in the shader source. |
61 | 61 |
*/ |
62 |
@JvmField var mUniform: IntArray? = null
|
|
62 |
var mUniform: IntArray? = null |
|
63 | 63 |
|
64 | 64 |
companion object |
65 | 65 |
{ |
src/main/java/org/distorted/library/type/Dynamic.kt | ||
---|---|---|
117 | 117 |
private const val NUM_NOISE = 5 // used iff mNoise>0.0. Number of intermediary points between each pair of adjacent vectors |
118 | 118 |
private var mPausedTime: Long = 0 |
119 | 119 |
|
120 |
@JvmStatic fun onPause() { mPausedTime = System.currentTimeMillis() }
|
|
120 |
fun onPause() { mPausedTime = System.currentTimeMillis() } |
|
121 | 121 |
} |
122 | 122 |
|
123 | 123 |
var dimension: Int = 0 |
Also available in: Unified diff
remove all @Jvm's