From 20c3a13ece79bf58737e0d80c811706d5e2ab9e5 Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Thu, 27 Feb 2020 19:26:44 +0100 Subject: [PATCH] Add configurable color type for Layer --- orx-compositor/src/main/kotlin/Compositor.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/orx-compositor/src/main/kotlin/Compositor.kt b/orx-compositor/src/main/kotlin/Compositor.kt index 25b10a47..35940b9a 100644 --- a/orx-compositor/src/main/kotlin/Compositor.kt +++ b/orx-compositor/src/main/kotlin/Compositor.kt @@ -31,6 +31,7 @@ open class Layer internal constructor() { val children: MutableList = mutableListOf() var blendFilter: Pair Unit>? = null val postFilters: MutableList Unit>> = mutableListOf() + var colorType = ColorType.UINT8 @BooleanParameter("enabled") var enabled = true @@ -52,7 +53,7 @@ open class Layer internal constructor() { if (localLayerTarget == null || (localLayerTarget.width != activeRenderTarget.width || localLayerTarget.height != activeRenderTarget.height)) { layerTarget?.deepDestroy() layerTarget = renderTarget(activeRenderTarget.width, activeRenderTarget.height) { - colorBuffer() + colorBuffer(type = colorType) depthBuffer() } layerTarget?.let { @@ -86,12 +87,8 @@ open class Layer internal constructor() { } if (postBufferCache.isEmpty()) { - postBufferCache += colorBuffer(activeRenderTarget.width, activeRenderTarget.height).apply { - Session.active.untrack(this) - } - postBufferCache += colorBuffer(activeRenderTarget.width, activeRenderTarget.height).apply { - Session.active.untrack(this) - } + postBufferCache += colorBuffer(activeRenderTarget.width, activeRenderTarget.height, type = colorType) + postBufferCache += colorBuffer(activeRenderTarget.width, activeRenderTarget.height, type = colorType) } }