Upgrade to Kotlin 1.4, Gradle 6.6

This commit is contained in:
Edwin Jakobs
2020-08-18 08:30:18 +02:00
parent d7b17d6910
commit 5235d8ce19
22 changed files with 205 additions and 62 deletions

View File

@@ -7,7 +7,7 @@ import org.openrndr.math.YPolarity
import org.openrndr.math.transforms.rotateY
fun generateCap(sides: Int, radius: Double, enveloppe: List<Vector2> = listOf(Vector2(0.0, 0.0), Vector2(1.0, 0.0)), writer: VertexWriter) {
val maxX = enveloppe.maxBy { it.x } ?: Vector2(1.0, 0.0)
val maxX = enveloppe.maxByOrNull { it.x } ?: Vector2(1.0, 0.0)
val a = maxX.x
val cleanEnveloppe = enveloppe.map { Vector2((it.x / a) * radius, it.y) }
@@ -51,7 +51,7 @@ fun generateCap(sides: Int, radius: Double, enveloppe: List<Vector2> = listOf(Ve
}
fun generateRevolve(sides: Int, length: Double, enveloppe: List<Vector2> = listOf(Vector2(1.0, 0.0), Vector2(1.0, 1.0)), writer: VertexWriter) {
val maxY = enveloppe.maxBy { it.y } ?: Vector2(0.0, 1.0)
val maxY = enveloppe.maxByOrNull { it.y } ?: Vector2(0.0, 1.0)
val a = maxY.y
val cleanEnveloppe = enveloppe.map { Vector2((it.x), (it.y/a - 0.5) * length ) }
@@ -62,8 +62,6 @@ fun generateRevolve(sides: Int, length: Double, enveloppe: List<Vector2> = listO
}
val extended = listOf(normals2D[0]) + normals2D + normals2D[normals2D.size-1]
val basePositions = cleanEnveloppe.map { Vector3(it.x, it.y, 0.0) }
val baseNormals = normals2D.map { Vector3(it.x, it.y, 0.0) }

View File

@@ -32,8 +32,8 @@ class GeneratorBuffer {
fun toByteBuffer(): ByteBuffer {
val bb = ByteBuffer.allocateDirect(data.size * (3 * 4 + 3 * 4 + 2 * 4))
bb.order(ByteOrder.nativeOrder())
bb.rewind()
for (d in data) {
bb.rewind()
bb.putFloat(d.position.x.toFloat())
bb.putFloat(d.position.y.toFloat())
bb.putFloat(d.position.z.toFloat())
@@ -212,15 +212,3 @@ fun GeneratorBuffer.group(builder: GeneratorBuffer.() -> Unit) {
gb.builder()
this.concat(gb)
}
fun main(args: Array<String>) {
val gb = generator {
box(20.0, 20.0, 20.0)
group {
box(40.0, 40.0, 40.0)
transform(transform {
translate(0.0, 20.0, 0.0)
})
}
}
}