Bump to OPENRNDR 0.3.43-rc.14

This commit is contained in:
Edwin Jakobs
2020-07-02 18:02:06 +02:00
parent fee5475fe9
commit 0b0691e9ae
7 changed files with 42 additions and 30 deletions

View File

@@ -14,7 +14,7 @@ buildscript {
apply plugin: 'org.jetbrains.dokka' apply plugin: 'org.jetbrains.dokka'
project.ext { project.ext {
openrndrVersion = "0.3.43-rc.13" openrndrVersion = "0.3.43-rc.14"
kotlinVersion = "1.3.72" kotlinVersion = "1.3.72"
spekVersion = "2.0.10" spekVersion = "2.0.10"
libfreenectVersion = "0.5.7-1.5.3" libfreenectVersion = "0.5.7-1.5.3"

View File

@@ -13,12 +13,17 @@ import org.openrndr.math.Matrix44
private val postBufferCache = mutableListOf<ColorBuffer>() private val postBufferCache = mutableListOf<ColorBuffer>()
fun RenderTarget.deepDestroy() { fun RenderTarget.deepDestroy() {
val cbcopy = colorBuffers.map { it } val cbcopy = colorAttachments.map { it }
val dbcopy = depthBuffer val dbcopy = depthBuffer
detachDepthBuffer() detachDepthBuffer()
detachColorBuffers() detachColorAttachments()
cbcopy.forEach { 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() dbcopy?.destroy()
destroy() destroy()
@@ -42,6 +47,7 @@ open class Layer internal constructor() {
@BooleanParameter("enabled") @BooleanParameter("enabled")
var enabled = true var enabled = true
@BooleanParameter("Invert mask") @BooleanParameter("Invert mask")
var invertMask = false var invertMask = false
var clearColor: ColorRGBa? = ColorRGBa.TRANSPARENT var clearColor: ColorRGBa? = ColorRGBa.TRANSPARENT

View File

@@ -445,7 +445,7 @@ class PBRMaterial : Material {
if (rt is ProgramRenderTarget || materialContext.pass === DefaultPass || materialContext.pass === DefaultOpaquePass || materialContext.pass == DefaultTransparentPass) { if (rt is ProgramRenderTarget || materialContext.pass === DefaultPass || materialContext.pass === DefaultOpaquePass || materialContext.pass == DefaultTransparentPass) {
this.output(it.targetOutput, ShadeStyleOutput(0)) this.output(it.targetOutput, ShadeStyleOutput(0))
} else { } 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 type = rt.colorBuffer(index).type
val format = rt.colorBuffer(0).format val format = rt.colorBuffer(0).format
this.output(it.targetOutput, ShadeStyleOutput(index, format, type)) this.output(it.targetOutput, ShadeStyleOutput(index, format, type))
@@ -521,7 +521,7 @@ class PBRMaterial : Material {
is SpotLight -> { is SpotLight -> {
shadeStyle.parameter("lightPosition$index", (node.worldTransform * Vector4.UNIT_W).xyz) 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("lightConstantAttenuation$index", light.constantAttenuation)
shadeStyle.parameter("lightLinearAttenuation$index", light.linearAttenuation) shadeStyle.parameter("lightLinearAttenuation$index", light.linearAttenuation)
shadeStyle.parameter("lightQuadraticAttenuation$index", light.quadraticAttenuation) shadeStyle.parameter("lightQuadraticAttenuation$index", light.quadraticAttenuation)
@@ -546,7 +546,7 @@ class PBRMaterial : Material {
} }
is DirectionalLight -> { is DirectionalLight -> {
shadeStyle.parameter("lightPosition$index", (node.worldTransform * Vector4.UNIT_W).xyz) 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) { if (light.shadows is Shadows.MappedShadows) {
context.shadowMaps[light]?.let { context.shadowMaps[light]?.let {
val look = light.view(node) val look = light.view(node)
@@ -565,7 +565,7 @@ class PBRMaterial : Material {
} }
is HemisphereLight -> { 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("lightUpColor$index", light.upColor)
shadeStyle.parameter("lightDownColor$index", light.downColor) shadeStyle.parameter("lightDownColor$index", light.downColor)

View File

@@ -117,7 +117,8 @@ class SceneRenderer {
outputPassTarget?.let { target -> outputPassTarget?.let { target ->
pass.combiners.forEach { pass.combiners.forEach {
if (it is ColorBufferFacetCombiner) { 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) target.blendMode(index, it.blendMode)
} }
} }
@@ -128,7 +129,8 @@ class SceneRenderer {
outputPassTarget?.let { output -> outputPassTarget?.let { output ->
for (combiner in pass.combiners) { 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,7 +228,6 @@ class SceneRenderer {
val nodeInverse = it.node.worldTransform.inversed val nodeInverse = it.node.worldTransform.inversed
val jointTransforms = (skinnedMesh.joints zip skinnedMesh.inverseBindMatrices) 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 jointNormalTransforms = jointTransforms.map { Matrix44.IDENTITY }

View File

@@ -363,10 +363,10 @@ class ControlManager : Extension {
body?.draw?.dirty = true body?.draw?.dirty = true
if (renderTarget.colorBuffers.isNotEmpty()) { if (renderTarget.colorAttachments.isNotEmpty()) {
renderTarget.colorBuffer(0).destroy() renderTarget.colorBuffer(0).destroy()
renderTarget.depthBuffer?.destroy() renderTarget.depthBuffer?.destroy()
renderTarget.detachColorBuffers() renderTarget.detachColorAttachments()
renderTarget.detachDepthBuffer() renderTarget.detachDepthBuffer()
renderTarget.destroy() renderTarget.destroy()
} else { } else {

View File

@@ -124,11 +124,16 @@ internal class ConvolutionPyramid(width: Int, height: Int,
fun destroy() { fun destroy() {
result.destroy() result.destroy()
(levelsIn+levelsOut).forEach { (levelsIn+levelsOut).forEach {
it.colorBuffers.forEach { it.destroy() } it.colorAttachments.forEach {
it.detachColorBuffers() 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() it.destroy()
} }
} }
} }

View File

@@ -65,7 +65,7 @@ class TemporalBlur : Extension {
accumulator?.let { a -> accumulator?.let { a ->
if (a.width != program.width || a.height != program.height) { if (a.width != program.width || a.height != program.height) {
a.colorBuffer(0).destroy() a.colorBuffer(0).destroy()
a.detachColorBuffers() a.detachColorAttachments()
a.destroy() a.destroy()
} }
} }
@@ -73,7 +73,7 @@ class TemporalBlur : Extension {
result?.let { r -> result?.let { r ->
if (r.width != program.width || r.height != program.height) { if (r.width != program.width || r.height != program.height) {
r.colorBuffer(0).destroy() r.colorBuffer(0).destroy()
r.detachColorBuffers() r.detachColorAttachments()
r.destroy() r.destroy()
} }
} }
@@ -82,7 +82,7 @@ class TemporalBlur : Extension {
if (i.width != program.width || i.height != program.height) { if (i.width != program.width || i.height != program.height) {
i.colorBuffer(0).destroy() i.colorBuffer(0).destroy()
i.depthBuffer?.destroy() i.depthBuffer?.destroy()
i.detachColorBuffers() i.detachColorAttachments()
i.detachDepthBuffer() i.detachDepthBuffer()
i.destroy() i.destroy()
} }
@@ -91,7 +91,7 @@ class TemporalBlur : Extension {
imageResolved?.let { i -> imageResolved?.let { i ->
if (i.width != program.width || i.height != program.height) { if (i.width != program.width || i.height != program.height) {
i.colorBuffer(0).destroy() i.colorBuffer(0).destroy()
i.detachColorBuffers() i.detachColorAttachments()
i.destroy() i.destroy()
} }
} }
@@ -160,7 +160,7 @@ class TemporalBlur : Extension {
if (linearizeInput) { if (linearizeInput) {
imageResolved?.let { imageResolved?.let {
linearize.apply(it, it) linearize.apply(it.colorBuffer(0), it.colorBuffer(0))
} }
} }