Add option to use existing vertex buffer in meshGenerator
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package org.openrndr.extras.meshgenerators
|
||||
|
||||
import org.openrndr.draw.VertexBuffer
|
||||
import org.openrndr.draw.vertexBuffer
|
||||
import org.openrndr.draw.vertexFormat
|
||||
import org.openrndr.math.Matrix44
|
||||
import org.openrndr.math.Vector2
|
||||
import org.openrndr.math.Vector3
|
||||
@@ -140,16 +138,11 @@ fun GeneratorBuffer.extrudeShapes(shapes: List<Shape>, length: Double, scale: Do
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun meshGenerator(builder: GeneratorBuffer.() -> Unit): VertexBuffer {
|
||||
fun meshGenerator(vertexBuffer: VertexBuffer? = null, builder: GeneratorBuffer.() -> Unit): VertexBuffer {
|
||||
val gb = GeneratorBuffer()
|
||||
gb.builder()
|
||||
|
||||
val vb = vertexBuffer(vertexFormat {
|
||||
position(3)
|
||||
normal(3)
|
||||
textureCoordinate(2)
|
||||
}, gb.data.size)
|
||||
val vb = vertexBuffer ?: meshVertexBuffer(gb.data.size)
|
||||
|
||||
val bb = gb.toByteBuffer()
|
||||
bb.rewind()
|
||||
|
||||
Reference in New Issue
Block a user