Skip to content

Commit 6bbe93e

Browse files
committed
Fixes for OPENRNDR 0.3.58 compatibility
1 parent 552a044 commit 6bbe93e

File tree

7 files changed

+54
-54
lines changed

7 files changed

+54
-54
lines changed
Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
import org.openrndr.application
2-
import org.openrndr.draw.VertexElementType
3-
import org.openrndr.draw.shadeStyle
4-
import org.openrndr.draw.shaderStorageBuffer
5-
import org.openrndr.draw.shaderStorageFormat
6-
import java.nio.ByteBuffer
7-
import java.nio.ByteOrder
8-
9-
fun main() = application {
10-
program {
11-
12-
val ssb = shaderStorageBuffer(shaderStorageFormat {
13-
attribute("foo", VertexElementType.FLOAT32, 1000)
14-
15-
})
16-
val ss = shadeStyle {
17-
buffer("someBuffer", ssb)
18-
fragmentTransform = "float a = b_someBuffer.foo[0]; b_someBuffer.foo[1] += 2.0;"
19-
}
20-
21-
val bb = ByteBuffer.allocateDirect(ssb.format.size)
22-
bb.order(ByteOrder.nativeOrder())
23-
24-
extend {
25-
ssb.clear()
26-
27-
drawer.shadeStyle = ss
28-
drawer.circle(100.0, 100.0, 200.0)
29-
bb.rewind()
30-
ssb.read(bb)
31-
bb.rewind()
32-
val f0 = bb.float
33-
val f1 = bb.float
34-
println(f1)
35-
36-
}
37-
38-
}
39-
}
1+
//import org.openrndr.application
2+
//import org.openrndr.draw.VertexElementType
3+
//import org.openrndr.draw.shadeStyle
4+
//import org.openrndr.draw.shaderStorageBuffer
5+
//import org.openrndr.draw.shaderStorageFormat
6+
//import java.nio.ByteBuffer
7+
//import java.nio.ByteOrder
8+
//
9+
//fun main() = application {
10+
// program {
11+
//
12+
// val ssb = shaderStorageBuffer(shaderStorageFormat {
13+
// //member("foo", VertexElementType.FLOAT32, 1000)
14+
//
15+
// })
16+
// val ss = shadeStyle {
17+
// buffer("someBuffer", ssb)
18+
// fragmentTransform = "float a = b_someBuffer.foo[0]; b_someBuffer.foo[1] += 2.0;"
19+
// }
20+
//
21+
// val bb = ByteBuffer.allocateDirect(ssb.format.size)
22+
// bb.order(ByteOrder.nativeOrder())
23+
//
24+
// extend {
25+
// ssb.clear()
26+
//
27+
// drawer.shadeStyle = ss
28+
// drawer.circle(100.0, 100.0, 200.0)
29+
// bb.rewind()
30+
// ssb.read(bb)
31+
// bb.rewind()
32+
// val f0 = bb.float
33+
// val f1 = bb.float
34+
// println(f1)
35+
//
36+
// }
37+
//
38+
// }
39+
//}

orx-color/src/demo/kotlin/DemoHistogram01.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fun main() = application {
3030
}
3131
println(" and sort them by luminosity.")
3232

33-
val topColorsFreqSum = topColors.sumByDouble { it.second }
33+
val topColorsFreqSum = topColors.sumOf { it.second }
3434
println("\nThose top $useColors colors represent " +
3535
String.format("%.02f", 100 * topColorsFreqSum) +
3636
"% of the image colors.")

orx-color/src/main/kotlin/spaces/ColorHSLUVa.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ data class ColorHSLUVa(val h: Double, val s: Double, val l: Double, val a: Doubl
123123

124124
override fun opacify(factor: Double) = copy(a = a * factor)
125125

126-
override fun minus(other: ColorHSLUVa) = copy(h = h - other.h, s = s - other.s, l = l - other.l, a = a - other.a)
126+
override fun minus(right: ColorHSLUVa) = copy(h = h - right.h, s = s - right.s, l = l - right.l, a = a - right.a)
127127

128-
override fun plus(other: ColorHSLUVa) = copy(h = h + other.h, s = s + other.s, l = l + other.l, a = a + other.a)
128+
override fun plus(right: ColorHSLUVa) = copy(h = h + right.h, s = s + right.s, l = l + right.l, a = a + right.a)
129129

130-
override fun times(factor: Double) = copy(h = h * factor, s = s * factor, l = l * factor, a = a * factor)
130+
override fun times(scale: Double) = copy(h = h * scale, s = s * scale, l = l * scale, a = a * scale)
131131

132132
override fun mix(other: ColorHSLUVa, factor: Double) = mix(this, other, factor)
133133

@@ -163,11 +163,11 @@ data class ColorXSLUVa(val x: Double, val s: Double, val l: Double, val a: Doubl
163163

164164
override fun opacify(factor: Double) = copy(a = a * factor)
165165

166-
override fun minus(other: ColorXSLUVa) = copy(x = x - other.x, s = s - other.s, l = l - other.l, a = a - other.a)
166+
override fun minus(right: ColorXSLUVa) = copy(x = x - right.x, s = s - right.s, l = l - right.l, a = a - right.a)
167167

168-
override fun plus(other: ColorXSLUVa) = copy(x = x + other.x, s = s + other.s, l = l + other.l, a = a + other.a)
168+
override fun plus(right: ColorXSLUVa) = copy(x = x + right.x, s = s + right.s, l = l + right.l, a = a + right.a)
169169

170-
override fun times(factor: Double) = copy(x = x * factor, s = s * factor, l = l * factor, a = a * factor)
170+
override fun times(scale: Double) = copy(x = x * scale, s = s * scale, l = l * scale, a = a * scale)
171171

172172
override fun mix(other: ColorXSLUVa, factor: Double) = mix(this, other, factor)
173173
}
@@ -254,11 +254,11 @@ data class ColorHPLUVa(val h: Double, val s: Double, val l: Double, val a: Doubl
254254

255255
override fun opacify(factor: Double) = copy(a = a * factor)
256256

257-
override fun minus(other: ColorHPLUVa) = copy(h = h - other.h, s = s - other.s, l = l - other.l, a = a - other.a)
257+
override fun minus(right: ColorHPLUVa) = copy(h = h - right.h, s = s - right.s, l = l - right.l, a = a - right.a)
258258

259-
override fun plus(other: ColorHPLUVa) = copy(h = h + other.h, s = s + other.s, l = l + other.l, a = a + other.a)
259+
override fun plus(right: ColorHPLUVa) = copy(h = h + right.h, s = s + right.s, l = l + right.l, a = a + right.a)
260260

261-
override fun times(factor: Double) = copy(h = h * factor, s = s * factor, l = l * factor, a = a * factor)
261+
override fun times(scale: Double) = copy(h = h * scale, s = s * scale, l = l * scale, a = a * scale)
262262

263263
override fun mix(other: ColorHPLUVa, factor: Double) = mix(this, other, factor)
264264

orx-gradient-descent/src/main/kotlin/GradientDescent.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private fun mul(x: DoubleArray, y: DoubleArray) = DoubleArray(x.size) { x[it] *
8686
private fun div(x: Array<DoubleArray>, y: Double) = Array(x.size) { div(x[it], y) }
8787
private fun div(x: DoubleArray, y: Double) = DoubleArray(x.size) { x[it] / y }
8888
private fun norm2(x: DoubleArray): Double {
89-
return sqrt(x.sumByDouble { it * it })
89+
return sqrt(x.sumOf { it * it })
9090
}
9191

9292
internal fun dot(x: DoubleArray, y: DoubleArray): Double = (x.mapIndexed { index, it -> it * y[index] }).sum()

orx-interval-tree/src/main/kotlin/IntervalTree.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class IntervalNode<T>(val center: Double) {
3939

4040
fun <T : Any> buildIntervalTree(items: List<T>, intervalFunction: (T) -> Pair<Double, Double>): IntervalNode<T> {
4141
val ranges = items.map { intervalFunction(it) }
42-
val center = ranges.sumByDouble { (it.first + it.second) / 2.0 } / ranges.size
42+
val center = ranges.sumOf { (it.first + it.second) / 2.0 } / ranges.size
4343
val node = IntervalNode<T>(center)
4444
val leftItems = mutableListOf<T>()
4545
val rightItems = mutableListOf<T>()

orx-noise/src/main/kotlin/Random.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ object Random {
2222
private var nextGaussian: Double = 0.0
2323
private var hasNextGaussian = false
2424

25-
private lateinit var state: RandomState
25+
private var state: RandomState
2626

2727
enum class Fractal {
2828
FBM, BILLOW, RIGID

orx-panel/src/main/kotlin/org/openrndr/panel/layout/Layouter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ class Layouter {
5959
val verticalPadding = element.computedStyle.effectivePaddingTop + element.computedStyle.effectivePaddingBottom
6060
val totalHeight = element.children
6161
.filter { it.computedStyle.display in blockLike && it.computedStyle.position !in manualPosition }
62-
.sumByDouble { height(it, width(it)) }
62+
.sumOf { height(it, width(it)) }
6363
val remainder = ((element.layout.screenHeight - verticalPadding) - totalHeight)
6464
val totalGrow = element.children
6565
.filter { it.computedStyle.display in blockLike && it.computedStyle.position !in manualPosition }
66-
.sumByDouble { (it.computedStyle.flexGrow as FlexGrow.Ratio).value }
66+
.sumOf { (it.computedStyle.flexGrow as FlexGrow.Ratio).value }
6767

6868
element.children.filter { it.computedStyle.display in blockLike && it.computedStyle.position !in manualPosition }.forEach { child ->
6969
val elementGrow = (child.computedStyle.flexGrow as FlexGrow.Ratio).value

0 commit comments

Comments
 (0)