From 0b0691e9ae4f62f0621a8a11ab83e2623fbd7d11 Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Thu, 2 Jul 2020 18:02:06 +0200 Subject: [PATCH] Bump to OPENRNDR 0.3.43-rc.14 --- build.gradle | 2 +- orx-compositor/src/main/kotlin/Compositor.kt | 24 ++++++++++++------- orx-dnk3/src/main/kotlin/PBRMaterial.kt | 8 +++---- orx-dnk3/src/main/kotlin/SceneRenderer.kt | 11 +++++---- .../org/openrndr/panel/ControlManager.kt | 4 ++-- .../src/main/kotlin/ConvolutionPyramid.kt | 13 ++++++---- .../src/main/kotlin/TemporalBlur.kt | 10 ++++---- 7 files changed, 42 insertions(+), 30 deletions(-) diff --git a/build.gradle b/build.gradle index 3d3fa89f..61c38b27 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ buildscript { apply plugin: 'org.jetbrains.dokka' project.ext { - openrndrVersion = "0.3.43-rc.13" + openrndrVersion = "0.3.43-rc.14" kotlinVersion = "1.3.72" spekVersion = "2.0.10" libfreenectVersion = "0.5.7-1.5.3" diff --git a/orx-compositor/src/main/kotlin/Compositor.kt b/orx-compositor/src/main/kotlin/Compositor.kt index d4afb9d4..95067e16 100644 --- a/orx-compositor/src/main/kotlin/Compositor.kt +++ b/orx-compositor/src/main/kotlin/Compositor.kt @@ -13,12 +13,17 @@ import org.openrndr.math.Matrix44 private val postBufferCache = mutableListOf() fun RenderTarget.deepDestroy() { - val cbcopy = colorBuffers.map { it } + val cbcopy = colorAttachments.map { it } val dbcopy = depthBuffer detachDepthBuffer() - detachColorBuffers() + detachColorAttachments() cbcopy.forEach { - it.destroy() + when (it) { + is ColorBufferAttachment -> it.colorBuffer.destroy() + is CubemapAttachment -> it.cubemap.destroy() + is ArrayTextureAttachment -> it.arrayTexture.destroy() + is ArrayCubemapAttachment -> it.arrayCubemap.destroy() + } } dbcopy?.destroy() destroy() @@ -42,15 +47,16 @@ open class Layer internal constructor() { @BooleanParameter("enabled") var enabled = true + @BooleanParameter("Invert mask") var invertMask = false var clearColor: ColorRGBa? = ColorRGBa.TRANSPARENT private var layerTarget: RenderTarget? = null val result: ColorBuffer? - get() { - return layerTarget?.colorBuffer(0) - } + get() { + return layerTarget?.colorBuffer(0) + } /** * draw the layer @@ -65,7 +71,7 @@ open class Layer internal constructor() { accumulation = if (activeRenderTarget !is ProgramRenderTarget) { activeRenderTarget.colorBuffer(0) } else { - null + null } if (shouldCreateLayerTarget(activeRenderTarget)) { @@ -238,8 +244,8 @@ fun Layer.blend(filter: F, configure: F.() -> Unit = {}): F { return filter } -class Composite: Layer() { - fun draw(drawer:Drawer) { +class Composite : Layer() { + fun draw(drawer: Drawer) { drawLayer(drawer) } } diff --git a/orx-dnk3/src/main/kotlin/PBRMaterial.kt b/orx-dnk3/src/main/kotlin/PBRMaterial.kt index a57e51c5..8f6b6e83 100644 --- a/orx-dnk3/src/main/kotlin/PBRMaterial.kt +++ b/orx-dnk3/src/main/kotlin/PBRMaterial.kt @@ -445,7 +445,7 @@ class PBRMaterial : Material { if (rt is ProgramRenderTarget || materialContext.pass === DefaultPass || materialContext.pass === DefaultOpaquePass || materialContext.pass == DefaultTransparentPass) { this.output(it.targetOutput, ShadeStyleOutput(0)) } else { - val index = rt.colorBufferIndex(it.targetOutput) + val index = rt.colorAttachmentIndexByName(it.targetOutput) ?: error("no such attachment ${it.targetOutput}") val type = rt.colorBuffer(index).type val format = rt.colorBuffer(0).format this.output(it.targetOutput, ShadeStyleOutput(index, format, type)) @@ -521,7 +521,7 @@ class PBRMaterial : Material { is SpotLight -> { shadeStyle.parameter("lightPosition$index", (node.worldTransform * Vector4.UNIT_W).xyz) - shadeStyle.parameter("lightDirection$index", ((normalMatrix(node.worldTransform)) * light.direction).normalized) + shadeStyle.parameter("lightDirection$index", ((normalMatrix(node.worldTransform)) * light.direction.xyz0).normalized.xyz) shadeStyle.parameter("lightConstantAttenuation$index", light.constantAttenuation) shadeStyle.parameter("lightLinearAttenuation$index", light.linearAttenuation) shadeStyle.parameter("lightQuadraticAttenuation$index", light.quadraticAttenuation) @@ -546,7 +546,7 @@ class PBRMaterial : Material { } is DirectionalLight -> { shadeStyle.parameter("lightPosition$index", (node.worldTransform * Vector4.UNIT_W).xyz) - shadeStyle.parameter("lightDirection$index", ((normalMatrix(node.worldTransform)) * light.direction).normalized) + shadeStyle.parameter("lightDirection$index", ((normalMatrix(node.worldTransform)) * light.direction.xyz0).normalized.xyz) if (light.shadows is Shadows.MappedShadows) { context.shadowMaps[light]?.let { val look = light.view(node) @@ -565,7 +565,7 @@ class PBRMaterial : Material { } is HemisphereLight -> { - shadeStyle.parameter("lightDirection$index", ((normalMatrix(node.worldTransform)) * light.direction).normalized) + shadeStyle.parameter("lightDirection$index", ((normalMatrix(node.worldTransform)) * light.direction.xyz0).normalized.xyz) shadeStyle.parameter("lightUpColor$index", light.upColor) shadeStyle.parameter("lightDownColor$index", light.downColor) diff --git a/orx-dnk3/src/main/kotlin/SceneRenderer.kt b/orx-dnk3/src/main/kotlin/SceneRenderer.kt index 49088315..77b55bc1 100644 --- a/orx-dnk3/src/main/kotlin/SceneRenderer.kt +++ b/orx-dnk3/src/main/kotlin/SceneRenderer.kt @@ -117,7 +117,8 @@ class SceneRenderer { outputPassTarget?.let { target -> pass.combiners.forEach { if (it is ColorBufferFacetCombiner) { - val index = target.colorBufferIndex(it.targetOutput) + val index = target.colorAttachmentIndexByName(it.targetOutput) + ?: error("no such attachment ${it.targetOutput}") target.blendMode(index, it.blendMode) } } @@ -128,7 +129,8 @@ class SceneRenderer { outputPassTarget?.let { output -> for (combiner in pass.combiners) { - buffers[combiner.targetOutput] = output.colorBuffer(combiner.targetOutput) + buffers[combiner.targetOutput] = (output.colorAttachmentByName(combiner.targetOutput) as? ColorBufferAttachment)?.colorBuffer + ?: error("no such attachment: ${combiner.targetOutput}") } } } @@ -226,9 +228,8 @@ class SceneRenderer { val nodeInverse = it.node.worldTransform.inversed - val jointTransforms = (skinnedMesh.joints zip skinnedMesh.inverseBindMatrices) - .map{ (nodeInverse * it.first.worldTransform * it.second) } + .map { (nodeInverse * it.first.worldTransform * it.second) } // val jointNormalTransforms = jointTransforms.map { Matrix44.IDENTITY } val shadeStyle = primitive.material.generateShadeStyle(materialContext, primitiveContext) @@ -269,7 +270,7 @@ class SceneRenderer { .forEach { val primitive = it.content drawer.isolated { - val primitiveContext = PrimitiveContext(true, false) + val primitiveContext = PrimitiveContext(true, false) val shadeStyle = primitive.primitive.material.generateShadeStyle(materialContext, primitiveContext) shadeStyle.parameter("viewMatrixInverse", drawer.view.inversed) primitive.primitive.material.applyToShadeStyle(materialContext, shadeStyle) diff --git a/orx-panel/src/main/kotlin/org/openrndr/panel/ControlManager.kt b/orx-panel/src/main/kotlin/org/openrndr/panel/ControlManager.kt index 747c7f85..3d5d3b81 100644 --- a/orx-panel/src/main/kotlin/org/openrndr/panel/ControlManager.kt +++ b/orx-panel/src/main/kotlin/org/openrndr/panel/ControlManager.kt @@ -363,10 +363,10 @@ class ControlManager : Extension { body?.draw?.dirty = true - if (renderTarget.colorBuffers.isNotEmpty()) { + if (renderTarget.colorAttachments.isNotEmpty()) { renderTarget.colorBuffer(0).destroy() renderTarget.depthBuffer?.destroy() - renderTarget.detachColorBuffers() + renderTarget.detachColorAttachments() renderTarget.detachDepthBuffer() renderTarget.destroy() } else { diff --git a/orx-poisson-fill/src/main/kotlin/ConvolutionPyramid.kt b/orx-poisson-fill/src/main/kotlin/ConvolutionPyramid.kt index c5a72490..6d45fa94 100644 --- a/orx-poisson-fill/src/main/kotlin/ConvolutionPyramid.kt +++ b/orx-poisson-fill/src/main/kotlin/ConvolutionPyramid.kt @@ -124,11 +124,16 @@ internal class ConvolutionPyramid(width: Int, height: Int, fun destroy() { result.destroy() (levelsIn+levelsOut).forEach { - it.colorBuffers.forEach { it.destroy() } - it.detachColorBuffers() + it.colorAttachments.forEach { + when(it) { + is ColorBufferAttachment -> it.colorBuffer.destroy() + is CubemapAttachment -> it.cubemap.destroy() + is ArrayTextureAttachment -> it.arrayTexture.destroy() + is ArrayCubemapAttachment -> it.arrayCubemap.destroy() + } + } + it.detachColorAttachments() it.destroy() } } - - } \ No newline at end of file diff --git a/orx-temporal-blur/src/main/kotlin/TemporalBlur.kt b/orx-temporal-blur/src/main/kotlin/TemporalBlur.kt index 9b05dfa4..2ec0193f 100644 --- a/orx-temporal-blur/src/main/kotlin/TemporalBlur.kt +++ b/orx-temporal-blur/src/main/kotlin/TemporalBlur.kt @@ -65,7 +65,7 @@ class TemporalBlur : Extension { accumulator?.let { a -> if (a.width != program.width || a.height != program.height) { a.colorBuffer(0).destroy() - a.detachColorBuffers() + a.detachColorAttachments() a.destroy() } } @@ -73,7 +73,7 @@ class TemporalBlur : Extension { result?.let { r -> if (r.width != program.width || r.height != program.height) { r.colorBuffer(0).destroy() - r.detachColorBuffers() + r.detachColorAttachments() r.destroy() } } @@ -82,7 +82,7 @@ class TemporalBlur : Extension { if (i.width != program.width || i.height != program.height) { i.colorBuffer(0).destroy() i.depthBuffer?.destroy() - i.detachColorBuffers() + i.detachColorAttachments() i.detachDepthBuffer() i.destroy() } @@ -91,7 +91,7 @@ class TemporalBlur : Extension { imageResolved?.let { i -> if (i.width != program.width || i.height != program.height) { i.colorBuffer(0).destroy() - i.detachColorBuffers() + i.detachColorAttachments() i.destroy() } } @@ -160,7 +160,7 @@ class TemporalBlur : Extension { if (linearizeInput) { imageResolved?.let { - linearize.apply(it, it) + linearize.apply(it.colorBuffer(0), it.colorBuffer(0)) } }