Upgrade to Gradle 8.10, Kotlin 2.0.20, reduce warnings
This commit is contained in:
@@ -5,6 +5,8 @@ import org.gradle.accessors.dm.LibrariesForLibs
|
||||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||
|
||||
val libs = the<LibrariesForLibs>()
|
||||
|
||||
@@ -22,8 +24,6 @@ if (shouldPublish) {
|
||||
apply(plugin = "maven-publish")
|
||||
}
|
||||
|
||||
//apply(plugin = "nebula.release")
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
@@ -57,8 +57,6 @@ dependencies {
|
||||
"demoRuntimeOnly"(libs.slf4j.simple)
|
||||
}
|
||||
|
||||
|
||||
|
||||
tasks {
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
val test by getting(Test::class) {
|
||||
@@ -76,12 +74,14 @@ tasks {
|
||||
addBooleanOption("Xdoclint:none", true)
|
||||
}
|
||||
}
|
||||
withType<KotlinCompile>() {
|
||||
kotlinOptions.jvmTarget = libs.versions.jvmTarget.get()
|
||||
kotlinOptions.apiVersion = libs.versions.kotlinApi.get()
|
||||
kotlinOptions.languageVersion = libs.versions.kotlinLanguage.get()
|
||||
kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes"
|
||||
kotlinOptions.freeCompilerArgs += "-Xjdk-release=${libs.versions.jvmTarget.get()}"
|
||||
withType<KotlinCompile> {
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.valueOf("JVM_${libs.versions.jvmTarget.get()}"))
|
||||
freeCompilerArgs.add("-Xexpect-actual-classes")
|
||||
freeCompilerArgs.add("-Xjdk-release=${libs.versions.jvmTarget.get()}")
|
||||
apiVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.versions.kotlinApi.get().replace(".", "_")}"))
|
||||
languageVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.versions.kotlinApi.get().replace(".", "_")}"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ import CollectScreenshotsTask
|
||||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
|
||||
|
||||
|
||||
val libs = the<LibrariesForLibs>()
|
||||
|
||||
val shouldPublish = project.name !in setOf("openrndr-demos")
|
||||
@@ -31,14 +32,19 @@ repositories {
|
||||
|
||||
group = "org.openrndr.extra"
|
||||
|
||||
tasks.withType<KotlinCompile<*>> {
|
||||
kotlinOptions.apiVersion = libs.versions.kotlinApi.get()
|
||||
kotlinOptions.languageVersion = libs.versions.kotlinLanguage.get()
|
||||
kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes"
|
||||
kotlinOptions.freeCompilerArgs += "-Xjdk-release=${libs.versions.jvmTarget.get()}"
|
||||
tasks.withType<KotlinCompilationTask<*>> {
|
||||
compilerOptions {
|
||||
apiVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.versions.kotlinApi.get().replace(".", "_")}"))
|
||||
languageVersion.set(KotlinVersion.valueOf("KOTLIN_${libs.versions.kotlinApi.get().replace(".", "_")}"))
|
||||
freeCompilerArgs.add("-Xexpect-actual-classes")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinJvmCompile>().configureEach {
|
||||
compilerOptions.jvmTarget.set(JvmTarget.fromTarget(libs.versions.jvmTarget.get()))
|
||||
compilerOptions {
|
||||
jvmTarget.set(JvmTarget.fromTarget(libs.versions.jvmTarget.get()))
|
||||
freeCompilerArgs.add("-Xjdk-release=${libs.versions.jvmTarget.get()}")
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
@@ -46,7 +52,6 @@ kotlin {
|
||||
compilations {
|
||||
val main by getting
|
||||
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
val demo by creating {
|
||||
associateWith(main)
|
||||
tasks.register<CollectScreenshotsTask>("collectScreenshots") {
|
||||
@@ -74,7 +79,6 @@ kotlin {
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
implementation(libs.kotlin.stdlib)
|
||||
@@ -82,14 +86,12 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
val commonTest by getting {
|
||||
dependencies {
|
||||
implementation(libs.kotlin.test)
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
val jvmTest by getting {
|
||||
dependencies {
|
||||
runtimeOnly(libs.bundles.jupiter)
|
||||
@@ -97,7 +99,6 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNUSED_VARIABLE")
|
||||
val jvmDemo by getting {
|
||||
dependencies {
|
||||
implementation(libs.openrndr.application)
|
||||
@@ -181,6 +182,7 @@ if (shouldPublish) {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
@OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||
jvm().mainRun {
|
||||
classpath(kotlin.jvm().compilations.getByName("demo").output.allOutputs)
|
||||
classpath(kotlin.jvm().compilations.getByName("demo").configurations.runtimeDependencyConfiguration!!)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[versions]
|
||||
kotlinApi = "2.0"
|
||||
kotlinLanguage = "2.0"
|
||||
kotlin = "2.0.10"
|
||||
kotlin = "2.0.20"
|
||||
jvmTarget = "17"
|
||||
openrndr = { require = "[0.4.2, 0.5.0)" }
|
||||
kotlinxCoroutines = "1.8.1"
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
2
gradlew
vendored
2
gradlew
vendored
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
||||
@@ -10,8 +10,7 @@ fun main() = application {
|
||||
program {
|
||||
|
||||
val shader = Shader.createFromCode(vsCode =
|
||||
"""
|
||||
#version 430
|
||||
"""${Driver.instance.shaderConfiguration()}
|
||||
in vec3 a_position;
|
||||
in vec2 a_texCoord0;
|
||||
in vec3 a_normal;
|
||||
@@ -22,16 +21,15 @@ void main() {
|
||||
gl_Position = projMatrix * vec4(a_position, 1.0);
|
||||
}
|
||||
""",
|
||||
fsCode = """
|
||||
#version 430
|
||||
fsCode = """${Driver.instance.shaderConfiguration()}
|
||||
out vec4 o_color;
|
||||
layout(rgba8) uniform image2D bla;
|
||||
layout(rgba8) uniform writeonly image2D bla;
|
||||
void main() {
|
||||
imageStore(bla, ivec2(30,30), vec4(1.0, 0.0, 0.0, 1.0));
|
||||
o_color = vec4(1.0);
|
||||
}
|
||||
""", name = "ils")
|
||||
val cb = colorBuffer(128, 128)
|
||||
val cb = colorBuffer(128, 128, type = ColorType.UINT8)
|
||||
val mesh = planeMesh(Vector3.ZERO, Vector3.UNIT_X, Vector3.UNIT_Y, -Vector3.UNIT_Z, 100.0, 100.0)
|
||||
|
||||
extend {
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.ImageAccess
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.draw.imageBinding
|
||||
import org.openrndr.draw.shadeStyle
|
||||
import org.openrndr.draw.*
|
||||
|
||||
|
||||
fun main() = application {
|
||||
program {
|
||||
val cb = colorBuffer(128, 128)
|
||||
extend {
|
||||
val cb = colorBuffer(128, 128, type = ColorType.UINT8)
|
||||
cb.fill(ColorRGBa.BLACK)
|
||||
val ss = shadeStyle {
|
||||
fragmentTransform = """
|
||||
imageStore(p_image, ivec2(30.0, 30.0), vec4(1.0, 0.0, 0.0, 1.0));
|
||||
imageStore(p_image, ivec2(30, 30), vec4(1.0, 0.0, 0.0, 1.0));
|
||||
""".trimIndent()
|
||||
|
||||
parameter("image", cb.imageBinding(0, ImageAccess.READ_WRITE))
|
||||
image("image", cb.imageBinding(0, ImageAccess.WRITE))
|
||||
}
|
||||
extend {
|
||||
|
||||
drawer.shadeStyle = ss
|
||||
drawer.clear(ColorRGBa.PINK)
|
||||
drawer.rectangle(0.0, 0.0, 100.0, 100.0)
|
||||
drawer.shadeStyle = null
|
||||
drawer.image(cb, 0.0, 200.0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.VolumeTexture
|
||||
import org.openrndr.draw.colorBuffer
|
||||
import org.openrndr.draw.isolatedWithTarget
|
||||
import org.openrndr.draw.renderTarget
|
||||
import org.openrndr.draw.*
|
||||
|
||||
fun main() = application {
|
||||
program {
|
||||
val volumeTexture = VolumeTexture.create(128,128,32)
|
||||
val volumeTexture = VolumeTexture.create(128,128,32, type = ColorType.UINT8)
|
||||
val rt = renderTarget(128, 128) {
|
||||
volumeTexture(volumeTexture, 0)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
|
||||
package org.openrndr.extra.camera
|
||||
|
||||
import org.openrndr.Extension
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
|
||||
package org.openrndr.extra.compositor
|
||||
|
||||
import org.openrndr.Extension
|
||||
|
||||
@@ -18,6 +18,7 @@ internal fun vec2(x: Any): Vector2 {
|
||||
is List<*> -> {
|
||||
when (x.size) {
|
||||
2 -> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
x as List<Double>; Vector2(x[0], x[1])
|
||||
}
|
||||
|
||||
@@ -172,6 +173,7 @@ internal fun translate(translation: Any): Matrix44 {
|
||||
internal fun mat4(x: Any): Matrix44 {
|
||||
return when (x) {
|
||||
is List<*> -> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
when (x.size) {
|
||||
16 -> Matrix44.fromDoubleArray((x as List<Double>).toDoubleArray())
|
||||
4 -> {
|
||||
|
||||
@@ -20,32 +20,44 @@ internal fun List<*>.memberFunctions(n: String): ((Array<Any>) -> Any)? {
|
||||
"drop" -> { n -> this.drop((n[0] as Number).toInt()) }
|
||||
"takeLast" -> { n -> this.takeLast((n[0] as Number).toInt()) }
|
||||
"dropLast" -> { n -> this.takeLast((n[0] as Number).toInt()) }
|
||||
"map" -> { n -> val lambda = (n[0] as (Any) -> Any); this.map { lambda(it!!) } }
|
||||
"map" -> { n -> @Suppress("UNCHECKED_CAST") val lambda = (n[0] as (Any) -> Any); this.map { lambda(it!!) } }
|
||||
"filter" -> { n ->
|
||||
val lambda = (n[0] as (Any) -> Any); this.filter { (lambda(it!!) as Double).roundToInt() != 0 }
|
||||
}
|
||||
|
||||
"max" -> { n -> (this as List<Comparable<Any>>).max() }
|
||||
"min" -> { n -> (this as List<Comparable<Any>>).min() }
|
||||
"max" -> { n ->
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(this as List<Comparable<Any>>).max()
|
||||
}
|
||||
"min" -> { n ->
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(this as List<Comparable<Any>>).min()
|
||||
}
|
||||
"maxBy" -> { n ->
|
||||
val lambda = (n[0] as (Any) -> Any); this.maxByOrNull { lambda(it!!) as Comparable<Any> } ?: error("no max")
|
||||
@Suppress("UNCHECKED_CAST") val lambda = (n[0] as (Any) -> Any); this.maxByOrNull { lambda(it!!) as Comparable<Any> } ?: error("no max")
|
||||
}
|
||||
|
||||
"minBy" -> { n ->
|
||||
val lambda = (n[0] as (Any) -> Any); this.minByOrNull { lambda(it!!) as Comparable<Any> } ?: error("no max")
|
||||
@Suppress("UNCHECKED_CAST") val lambda = (n[0] as (Any) -> Any); this.minByOrNull { lambda(it!!) as Comparable<Any> } ?: error("no max")
|
||||
}
|
||||
|
||||
"sorted" -> { n -> (this as List<Comparable<Any>>).sorted() }
|
||||
"sorted" -> { n ->
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(this as List<Comparable<Any>>).sorted()
|
||||
}
|
||||
"sortedBy" -> { n ->
|
||||
val lambda = (n[0] as (Any) -> Any); this.sortedBy { lambda(it!!) as Comparable<Any> }
|
||||
@Suppress("UNCHECKED_CAST") val lambda = (n[0] as (Any) -> Any); this.sortedBy { lambda(it!!) as Comparable<Any> }
|
||||
}
|
||||
|
||||
"sortedByDescending" -> { n ->
|
||||
val lambda = (n[0] as (Any) -> Any); this.sortedByDescending { lambda(it!!) as Comparable<Any> }
|
||||
@Suppress("UNCHECKED_CAST") val lambda = (n[0] as (Any) -> Any); this.sortedByDescending { lambda(it!!) as Comparable<Any> }
|
||||
}
|
||||
|
||||
"reversed" -> { n -> this.reversed() }
|
||||
"zip" -> { n -> this.zip(n[0] as List<Any>).map { listOf(it.first, it.second) } }
|
||||
"zip" -> { n ->
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
this.zip(n[0] as List<Any>).map { listOf(it.first, it.second) }
|
||||
}
|
||||
|
||||
else -> null
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ abstract class TypedExpressionListenerBase(
|
||||
val index = (s.valueStack.pop() as? Double)?.roundToInt() ?: error("index is not a number")
|
||||
val listValue = s.valueStack.pop()
|
||||
|
||||
val value = when (listValue) {
|
||||
@Suppress("UNCHECKED_CAST") val value = when (listValue) {
|
||||
is List<*> -> listValue[index] ?: error("got null")
|
||||
is Function<*> -> (listValue as (Int) -> Any)(index)
|
||||
else -> error("can't index on '$listValue'")
|
||||
@@ -216,6 +216,7 @@ abstract class TypedExpressionListenerBase(
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("IMPLICIT_CAST_TO_ANY")
|
||||
override fun exitBinaryOperation1(ctx: KeyLangParser.BinaryOperation1Context) {
|
||||
val s = state
|
||||
if (s.inFunctionLiteral > 0) {
|
||||
@@ -759,6 +760,7 @@ abstract class TypedExpressionListenerBase(
|
||||
}
|
||||
|
||||
|
||||
@Suppress("MoveLambdaOutsideParentheses")
|
||||
override fun visitTerminal(node: TerminalNode) {
|
||||
val s = state
|
||||
if (s.inFunctionLiteral > 0) {
|
||||
@@ -835,26 +837,30 @@ abstract class TypedExpressionListenerBase(
|
||||
is Function<*> -> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
receiver as (String) -> Any
|
||||
@Suppress("UNCHECKED_CAST") val function =
|
||||
receiver.invoke(name) ?: error("no such function $name")
|
||||
val function =
|
||||
receiver.invoke(name)
|
||||
|
||||
when (idType) {
|
||||
IDType.MEMBER_FUNCTION0 -> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
function as () -> Any
|
||||
s.functionStack.push({ function() })
|
||||
}
|
||||
|
||||
IDType.MEMBER_FUNCTION1 -> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
function as (Any) -> Any
|
||||
s.functionStack.push({ x -> function(x[0]) })
|
||||
}
|
||||
|
||||
IDType.MEMBER_FUNCTION2 -> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
function as (Any, Any) -> Any
|
||||
s.functionStack.push({ x -> function(x[0], x[1]) })
|
||||
}
|
||||
|
||||
IDType.MEMBER_FUNCTION3 -> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
function as (Any, Any, Any) -> Any
|
||||
s.functionStack.push({ x -> function(x[0], x[1], x[2]) })
|
||||
}
|
||||
@@ -873,13 +879,13 @@ abstract class TypedExpressionListenerBase(
|
||||
}
|
||||
|
||||
IDType.FUNCTION1 -> {
|
||||
val s = state
|
||||
val localState = state
|
||||
val function: (Array<Any>) -> Any =
|
||||
dispatchFunction1(name, functions.functions1)
|
||||
?: errorValue(
|
||||
"unresolved function: '${name}(x0)'"
|
||||
) { _ -> error("this is the error function") }
|
||||
s.functionStack.push(function)
|
||||
localState.functionStack.push(function)
|
||||
}
|
||||
|
||||
IDType.FUNCTION2 -> {
|
||||
|
||||
@@ -11,12 +11,12 @@ class TestTypedExpression {
|
||||
fun funTestFunction() {
|
||||
run {
|
||||
val r = evaluateTypedExpression("{ x -> 2.0 + x }")
|
||||
val f = r as (Double) -> Double
|
||||
@Suppress("UNCHECKED_CAST") val f = r as (Double) -> Double
|
||||
println(f(3.0))
|
||||
}
|
||||
run {
|
||||
val r = evaluateTypedExpression("{ { 2.0 + it } }")
|
||||
val f0 = r as (Any) -> ((Any) -> Any)
|
||||
@Suppress("UNCHECKED_CAST") val f0 = r as (Any) -> ((Any) -> Any)
|
||||
val f1 = f0(0.0)
|
||||
println(f1(3.0))
|
||||
}
|
||||
@@ -102,6 +102,7 @@ class TestTypedExpression {
|
||||
return fun(p: String): Any? {
|
||||
val v = this[p]
|
||||
if (v is Map<*, *>) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return (v as Map<String, Any>).function()
|
||||
} else {
|
||||
return v
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import com.strumenta.antlrkotlin.gradle.AntlrKotlinTask
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
|
||||
|
||||
plugins {
|
||||
org.openrndr.extra.convention.`kotlin-multiplatform`
|
||||
@@ -55,7 +55,7 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile<*>> {
|
||||
tasks.withType<KotlinCompilationTask<*>> {
|
||||
dependsOn(generateKotlinGrammarSource)
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class HashGrid(val radius: Double) {
|
||||
private set
|
||||
|
||||
val cellSize = radius / sqrt(2.0)
|
||||
private inline fun coords(v: Vector2): GridCoords {
|
||||
private fun coords(v: Vector2): GridCoords {
|
||||
val x = (v.x / cellSize).fastFloor()
|
||||
val y = (v.y / cellSize).fastFloor()
|
||||
return GridCoords(x, y)
|
||||
|
||||
@@ -87,7 +87,7 @@ class HashGrid3D(val radius: Double) {
|
||||
private set
|
||||
|
||||
val cellSize = radius / sqrt(3.0)
|
||||
private inline fun coords(v: Vector3): GridCoords3D {
|
||||
private fun coords(v: Vector3): GridCoords3D {
|
||||
val x = (v.x / cellSize).fastFloor()
|
||||
val y = (v.y / cellSize).fastFloor()
|
||||
val z = (v.z / cellSize).fastFloor()
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
|
||||
package org.openrndr.extra.jumpfill.fx
|
||||
|
||||
import org.openrndr.draw.*
|
||||
|
||||
@@ -90,7 +90,6 @@ fun GltfFile.buildSceneNodes(): GltfSceneData {
|
||||
|
||||
val localBuffer = buffers[localBufferView.buffer].contents(this@buildSceneNodes)
|
||||
require(localBufferView.byteOffset != null)
|
||||
require(localBufferView.byteLength != null)
|
||||
localBuffer.position(localBufferView.byteOffset)
|
||||
localBuffer.limit(localBufferView.byteOffset + localBufferView.byteLength)
|
||||
|
||||
@@ -321,7 +320,6 @@ fun GltfFile.buildSceneNodes(): GltfSceneData {
|
||||
val scenes = scenes.map { scene ->
|
||||
scene.nodes.map { node ->
|
||||
val gltfNode = nodes.getOrNull(node) ?: error("node not found: $node")
|
||||
require(gltfNode != null)
|
||||
val sceneNode = gltfNode.createSceneNode()
|
||||
sceneNode
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@ fun Mesh.collapse() {
|
||||
}
|
||||
|
||||
grouped.map {
|
||||
val vertexCount = it.value.sumBy { primitive ->
|
||||
val vertexCount = it.value.sumOf { primitive ->
|
||||
primitive.geometry.vertexCount
|
||||
}
|
||||
|
||||
val indexCount = if (it.key.hasIndexBuffer)
|
||||
it.value.sumBy { primitive ->
|
||||
it.value.sumOf { primitive ->
|
||||
primitive.geometry.indexBuffer?.indexCount ?: 0
|
||||
}
|
||||
else 0
|
||||
|
||||
@@ -5,7 +5,9 @@ plugins {
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
|
||||
compilerOptions {
|
||||
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -5,7 +5,9 @@ plugins {
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
|
||||
compilerOptions {
|
||||
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -11,7 +11,9 @@ tasks.generateGrammarSource {
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
|
||||
compilerOptions {
|
||||
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -5,7 +5,9 @@ plugins {
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
|
||||
compilerOptions {
|
||||
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.io.File
|
||||
import java.io.InputStream
|
||||
import java.io.Reader
|
||||
import java.net.MalformedURLException
|
||||
import java.net.URI
|
||||
import java.net.URL
|
||||
import javax.script.ScriptEngineManager
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ plugins {
|
||||
}
|
||||
|
||||
tasks.withType<KotlinCompile> {
|
||||
kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
|
||||
compilerOptions {
|
||||
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
|
||||
@@ -88,7 +88,7 @@ fun Element.div(vararg classes: String, init: Div.() -> Unit): Div {
|
||||
}
|
||||
|
||||
inline fun <reified T : TextElement> Element.textElement(classes: Array<out String>, init: T.() -> String): T {
|
||||
val te = T::class.java.newInstance()
|
||||
@Suppress("DEPRECATION") val te = T::class.java.newInstance()
|
||||
te.classes.addAll(classes.map { ElementClass(it) })
|
||||
te.text(te.init())
|
||||
append(te)
|
||||
|
||||
@@ -7,7 +7,7 @@ import kotlin.reflect.full.declaredMemberProperties
|
||||
fun watchHash(toHash: Any): Int {
|
||||
var hash = 0
|
||||
for (property in toHash::class.declaredMemberProperties) {
|
||||
val v = ((property as KProperty1<Any, Any?>).getter).invoke(toHash)
|
||||
@Suppress("UNCHECKED_CAST") val v = ((property as KProperty1<Any, Any?>).getter).invoke(toHash)
|
||||
if (v is KProperty0<*>) {
|
||||
val pv = v.get()
|
||||
hash = 31 * hash + (pv?.hashCode() ?: 0)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
|
||||
package org.openrndr.extra.noise.filters
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
|
||||
package org.openrndr.extra.noise.filters
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
|
||||
package org.openrndr.extra.noise.filters
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
|
||||
package org.openrndr.extra.noise.filters
|
||||
|
||||
import org.openrndr.color.ColorRGBa
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
|
||||
package org.openrndr.extra.noise.filters
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@file:Suppress("RUNTIME_ANNOTATION_NOT_SUPPORTED")
|
||||
|
||||
package org.openrndr.extra.noise.filters
|
||||
|
||||
import org.openrndr.draw.Filter
|
||||
|
||||
@@ -219,7 +219,7 @@ class PaletteStudio(
|
||||
|
||||
fun randomPalette() {
|
||||
val comparison = palette.colors.toMutableList()
|
||||
val colors = Random.pick(palettes, comparison) as MutableList<ColorRGBa>
|
||||
@Suppress("UNCHECKED_CAST") val colors = Random.pick(palettes, comparison) as MutableList<ColorRGBa>
|
||||
|
||||
paletteIndex = palettes.indexOf(colors)
|
||||
palette = createPalette(colors)
|
||||
|
||||
@@ -224,7 +224,7 @@ class Quadtree<T>(val bounds: Rectangle, val maxObjects: Int = 10, val mapper: (
|
||||
}
|
||||
|
||||
private fun intersect(rect: Rectangle): List<Quadtree<T>>? {
|
||||
val intersects = intersects(bounds, rect)
|
||||
val intersects = bounds.intersects(rect)
|
||||
|
||||
if (!intersects) return null
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@ import org.openrndr.draw.Drawer
|
||||
import org.openrndr.draw.FontImageMap
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.shape.Rectangle
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.InvocationKind
|
||||
import kotlin.contracts.contract
|
||||
|
||||
class Cursor(var x: Double = 0.0, var y: Double = 0.0) {
|
||||
constructor(cursor: Cursor) : this(cursor.x, cursor.y)
|
||||
@@ -205,7 +208,11 @@ class TextWriter(val drawerRef: Drawer?) {
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
fun <T> writer(drawer: Drawer, f: TextWriter.() -> T): T {
|
||||
contract {
|
||||
callsInPlace(f, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
val textWriter = TextWriter(drawer)
|
||||
return textWriter.f()
|
||||
}
|
||||
Reference in New Issue
Block a user