[orx-dnk3] Add feature architecture and post processing effects

This commit is contained in:
Edwin Jakobs
2020-07-06 13:00:58 +02:00
parent 0b0691e9ae
commit 419c38cc25
63 changed files with 2164 additions and 187 deletions

View File

@@ -3,6 +3,7 @@ package org.openrndr.extra.dnk3
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.*
import org.openrndr.math.Matrix44
import org.openrndr.math.transforms.perspective
class Geometry(val vertexBuffers: List<VertexBuffer>,
@@ -14,19 +15,28 @@ class Geometry(val vertexBuffers: List<VertexBuffer>,
override fun toString(): String {
return "Geometry(vertexBuffers: $vertexBuffers, indexBuffers: $indexBuffer, primitive: $primitive, offset: $offset, vertexCount: $vertexCount)"
}
override fun hashCode(): Int {
var result = 0
result = 31 * result + primitive.ordinal.hashCode()
result = 31 * result + offset.hashCode()
result = 31 * result + vertexCount.hashCode()
return result
}
}
val DummyGeometry = Geometry(emptyList(), null, DrawPrimitive.TRIANGLES, 0, 0)
sealed class Entity
class MeshPrimitive(var geometry: Geometry, var material: Material) {
override fun toString(): String {
return "MeshPrimitive(geometry: $geometry, material: $material)"
}
override fun hashCode(): Int {
var result = geometry.hashCode()
result = 31 * result + material.hashCode()
return result
}
}
class MeshPrimitiveInstance(val primitive: MeshPrimitive, val instances: Int, val attributes: List<VertexBuffer>)
@@ -36,6 +46,9 @@ class Mesh(primitives: List<MeshPrimitive>) : MeshBase(primitives) {
override fun toString(): String {
return "Mesh(primitives: $primitives)"
}
override fun hashCode(): Int {
return primitives.hashCode()
}
}
class SkinnedMesh(primitives: List<MeshPrimitive>,
@@ -49,10 +62,7 @@ class InstancedMesh(primitives: List<MeshPrimitive>,
var attributes: List<VertexBuffer>) : MeshBase(primitives)
class Fog : Entity() {
var color: ColorRGBa = ColorRGBa.WHITE
var end: Double = 100.0
}
data class Fog(var color: ColorRGBa = ColorRGBa.WHITE, var end : Double = 100.0) : Entity()
abstract class Light : Entity() {
var color: ColorRGBa = ColorRGBa.WHITE
@@ -61,4 +71,18 @@ abstract class Light : Entity() {
abstract class Camera : Entity() {
abstract val projectionMatrix: Matrix44
abstract val viewMatrix: Matrix44
}
abstract class CubemapProbe : Entity() {
open val projectionMatrix: Matrix44
get() {
return perspective(90.0, 1.0, 0.1, 150.0)
}
var dirty = true
}
class IrradianceProbe: CubemapProbe() {
override fun hashCode(): Int {
return true.hashCode()
}
}