Demos: ensure 720px wide, reduce indentation
This commit is contained in:
@@ -1,15 +1,32 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.draw.loadFont
|
||||
import org.openrndr.extra.objloader.loadOBJMeshData
|
||||
import org.openrndr.extra.objloader.toObj
|
||||
import org.openrndr.math.Vector2
|
||||
import java.io.File
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
program {
|
||||
val path = "demo-data/obj-models"
|
||||
val cm = loadOBJMeshData(File("$path/suzanne/Suzanne.obj"))
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val path = "demo-data/obj-models"
|
||||
val cm = loadOBJMeshData(File("$path/suzanne/Suzanne.obj"))
|
||||
|
||||
println(cm.toObj())
|
||||
// Convert mesh data to Wavefront OBJ String representation
|
||||
val obj = cm.toObj()
|
||||
|
||||
println(obj)
|
||||
|
||||
val font = loadFont("demo-data/fonts/IBMPlexMono-Regular.ttf", 24.0)
|
||||
|
||||
extend {
|
||||
// Draw part of the OBJ data as text
|
||||
drawer.fontMap = font
|
||||
drawer.texts(obj.split("\n").take(50), List(50) {
|
||||
Vector2(10.0, 20.0 + it * 20.0)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,10 @@ import org.openrndr.extra.objloader.loadOBJasVertexBuffer
|
||||
import org.openrndr.math.Vector3
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 540
|
||||
}
|
||||
program {
|
||||
val mesh = loadOBJasVertexBuffer("demo-data/obj-models/suzanne/Suzanne.obj")
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.openrndr.extra.objloader.saveOBJ
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 100
|
||||
}
|
||||
program {
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.openrndr.extra.objloader.saveOBJ
|
||||
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 100
|
||||
}
|
||||
program {
|
||||
|
||||
@@ -16,48 +16,46 @@ import org.openrndr.shape.Path3D
|
||||
import java.io.File
|
||||
import kotlin.math.cos
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
multisample = WindowMultisample.SampleCount(4)
|
||||
fun main() = application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
multisample = WindowMultisample.SampleCount(4)
|
||||
}
|
||||
program {
|
||||
val vb = loadOBJasVertexBuffer("orx-obj-loader/test-data/non-planar.obj")
|
||||
val md = readObjMeshData(File("orx-obj-loader/test-data/non-planar.obj").readLines())
|
||||
|
||||
val paths = md.wireframe().map {
|
||||
Path3D.fromPoints(it, true)
|
||||
}
|
||||
program {
|
||||
val vb = loadOBJasVertexBuffer("orx-obj-loader/test-data/non-planar.obj")
|
||||
val md = readObjMeshData(File("orx-obj-loader/test-data/non-planar.obj").readLines())
|
||||
|
||||
val paths = md.wireframe().map {
|
||||
Path3D.fromPoints(it, true)
|
||||
}
|
||||
|
||||
extend(Orbital())
|
||||
extend {
|
||||
drawer.rotate(Vector3.Companion.UNIT_Y, seconds * 45.0 + 45.0, TransformTarget.MODEL)
|
||||
drawer.translate(0.0, 0.0, 9.0, TransformTarget.VIEW)
|
||||
drawer.shadeStyle = shadeStyle {
|
||||
fragmentTransform = """
|
||||
extend(Orbital())
|
||||
extend {
|
||||
drawer.rotate(Vector3.Companion.UNIT_Y, seconds * 45.0 + 45.0, TransformTarget.MODEL)
|
||||
drawer.translate(0.0, 0.0, 9.0, TransformTarget.VIEW)
|
||||
drawer.shadeStyle = shadeStyle {
|
||||
fragmentTransform = """
|
||||
x_fill.rgb = normalize(v_viewNormal) * 0.5 + vec3(0.5);
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
|
||||
drawer.vertexBuffer(vb, DrawPrimitive.TRIANGLES)
|
||||
drawer.stroke = ColorRGBa.WHITE
|
||||
drawer.strokeWeight = 1.0
|
||||
drawer.vertexBuffer(vb, DrawPrimitive.TRIANGLES)
|
||||
drawer.stroke = ColorRGBa.WHITE
|
||||
drawer.strokeWeight = 1.0
|
||||
|
||||
drawer.shadeStyle = shadeStyle {
|
||||
vertexTransform = """
|
||||
drawer.shadeStyle = shadeStyle {
|
||||
vertexTransform = """
|
||||
x_projectionMatrix[3][2] -= 0.001;
|
||||
""".trimIndent()
|
||||
}
|
||||
|
||||
drawer.strokeWeight = 1.0
|
||||
drawer.paths(paths.mapIndexed { index, it ->
|
||||
it.sub(
|
||||
0.0, cos(seconds * 0.5 + index * 0.5) * 0.5 + 0.5
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
drawer.strokeWeight = 1.0
|
||||
drawer.paths(paths.mapIndexed { index, it ->
|
||||
it.sub(
|
||||
0.0, cos(seconds * 0.5 + index * 0.5) * 0.5 + 0.5
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user