aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/phenax/utils
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2026-10-03 22:37:16 +0530
committerAkshay Nair <phenax5@gmail.com>2026-10-03 22:44:48 +0530
commitb32d32248e0bfd6e763991b14c9d7bf29063ed29 (patch)
treece607e60d9ffa267e42bca69b80db800ff67d210 /src/main/kotlin/phenax/utils
parent592603fdeedfd4e6784606b9e7c9c8fdb306af42 (diff)
downloadart-playground-openrndr-b32d32248e0bfd6e763991b14c9d7bf29063ed29.tar.gz
art-playground-openrndr-b32d32248e0bfd6e763991b14c9d7bf29063ed29.zip
Fix recording
Diffstat (limited to 'src/main/kotlin/phenax/utils')
-rw-r--r--src/main/kotlin/phenax/utils/program.kt17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main/kotlin/phenax/utils/program.kt b/src/main/kotlin/phenax/utils/program.kt
index cfbe9c9..fdb6197 100644
--- a/src/main/kotlin/phenax/utils/program.kt
+++ b/src/main/kotlin/phenax/utils/program.kt
@@ -4,23 +4,22 @@ import java.io.File
import kotlin.properties.ReadOnlyProperty
import org.openrndr.ApplicationBuilder
import org.openrndr.Program
-import org.openrndr.draw.*
import org.openrndr.color.*
+import org.openrndr.draw.*
import org.openrndr.extra.filewatcher.watchingFile
import org.openrndr.extra.olive.oliveProgram as oliveProgramOriginal
-fun Int.seconds(): Int = this * 1000
-
-fun Int.minutes(): Int = this.seconds() * 60
+fun Number.seconds(): Number = this
-fun recordDuration(millis: Int) {
- System.setProperty("phenax.record.frameCount", (60 * millis / 1000).toInt().toString())
+fun recordDuration(millis: Number) {
+ System.setProperty("phenax.record.recordDuration", millis.toDouble().toString())
}
-fun recordDuration(): Int? = System.getProperty("phenax.record.frameCount")?.toIntOrNull()
+fun recordDuration(): Double = System.getProperty("phenax.record.recordDuration")?.toDoubleOrNull() ?: 5000.0
val recordingEnabled: Boolean by lazy { System.getenv("PHENAX_RECORD") != null }
val screenshotEnabled: Boolean by lazy { System.getenv("PHENAX_SCREENSHOT") != null }
+val captureEnabled: Boolean by lazy { recordingEnabled || screenshotEnabled }
// fun classDir(): String =
// "src/main/kotlin/${stackRootClassName(sanitize =
@@ -31,7 +30,7 @@ val screenshotEnabled: Boolean by lazy { System.getenv("PHENAX_SCREENSHOT") != n
// Have to keep the same name (oliveProgram) to get update on save to work
fun ApplicationBuilder.oliveProgram(init: Program.() -> Unit) {
- if (recordingEnabled || screenshotEnabled) {
+ if (captureEnabled) {
program(init)
} else {
// TODO: Make watching shader files work
@@ -89,7 +88,7 @@ fun Program.liveComputeShader(name: String): ReadOnlyProperty<Any?, ComputeShade
var cs: ComputeShader = ComputeShader.fromCode(shaderCode, name)
- if (!recordingEnabled || screenshotEnabled) {
+ if (!captureEnabled) {
var lastCompiledCode: String = shaderCode
program.extend {