Worley noise, Syphon and noise filter parameters...

This commit is contained in:
Rein van der Woerd
2020-02-21 09:25:29 +01:00
committed by edwin
parent 1eaf8607db
commit bb7439db54
15 changed files with 306 additions and 2 deletions

View File

@@ -0,0 +1,54 @@
import jsyphon.JSyphonServer
import org.openrndr.Extension
import org.openrndr.Program
import org.openrndr.draw.Drawer
import org.openrndr.draw.RenderTarget
import org.openrndr.draw.renderTarget
import org.openrndr.internal.gl3.ColorBufferGL3
class SyphonServer(private val name: String = "OPENRNDR", var target: RenderTarget? = null): Extension {
override var enabled = true
private val server = JSyphonServer()
override fun setup(program: Program) {
server.initWithName(name)
if (target == null) {
target = renderTarget(program.width, program.height) {
colorBuffer()
depthBuffer()
}
}
}
override fun beforeDraw(drawer: Drawer, program: Program) {
target?.bind()
}
override fun afterDraw(drawer: Drawer, program: Program) {
target?.unbind()
drawer.image(target?.colorBuffer(0)!!)
val glBuffer = target?.colorBuffer(0) as ColorBufferGL3
println(glBuffer.multisample)
// Send to Syphon
server.publishFrameTexture(
glBuffer.texture, glBuffer.target, 0, 0,
program.width, program.height, program.width, program.height, false
)
}
override fun shutdown(program: Program) {
// Cleanup
server.stop()
}
}

Binary file not shown.

View File

@@ -0,0 +1,11 @@
package jsyphon
class NSSize (var x: Int, var y: Int)
class NSPoint(var x: Int, var y: Int)
class NSRect(var origin: NSPoint, var size: NSSize) {
constructor(startX: Int, xLength: Int, startY: Int, yLength: Int) : this(
NSPoint(startX, startY),
NSSize(xLength, yLength)
)
}

Binary file not shown.