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, val indexBuffer: IndexBuffer?, val primitive: DrawPrimitive, val offset: Int, val vertexCount: Int) { 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) abstract class MeshBase(var primitives: List) : Entity() class Mesh(primitives: List) : MeshBase(primitives) { override fun toString(): String { return "Mesh(primitives: $primitives)" } override fun hashCode(): Int { return primitives.hashCode() } } class SkinnedMesh(primitives: List, val joints: List, val skeleton: SceneNode, val inverseBindMatrices: List ) : MeshBase(primitives) class InstancedMesh(primitives: List, var instances: Int, var attributes: List) : MeshBase(primitives) data class Fog(var color: ColorRGBa = ColorRGBa.WHITE, var end : Double = 100.0) : Entity() abstract class Light : Entity() { var color: ColorRGBa = ColorRGBa.WHITE } 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() } }