[orx-jvm] Move panel, gui, dnk3, keyframer, triangulation to orx-jvm
This commit is contained in:
47
orx-jvm/orx-dnk3/src/demo/kotlin/DemoObject01.kt
Normal file
47
orx-jvm/orx-dnk3/src/demo/kotlin/DemoObject01.kt
Normal file
@@ -0,0 +1,47 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.draw.DrawPrimitive
|
||||
import org.openrndr.draw.shadeStyle
|
||||
import org.openrndr.extensions.SingleScreenshot
|
||||
import org.openrndr.extra.dnk3.gltf.loadGltfFromFile
|
||||
import org.openrndr.extras.camera.Orbital
|
||||
import org.openrndr.math.Vector3
|
||||
import java.io.File
|
||||
|
||||
suspend fun main() = application {
|
||||
program {
|
||||
if (System.getProperty("takeScreenshot") == "true") {
|
||||
extend(SingleScreenshot()) {
|
||||
this.outputFile = System.getProperty("screenshotPath")
|
||||
}
|
||||
}
|
||||
|
||||
val gltf = loadGltfFromFile(File("demo-data/gltf-models/duck/Duck.gltf"))
|
||||
val meshes = gltf.meshes.map {
|
||||
it.createDrawCommands(gltf)
|
||||
}
|
||||
|
||||
extend(Orbital()) {
|
||||
far = 400.0
|
||||
lookAt = Vector3(0.0, 50.0, 0.0)
|
||||
eye = Vector3(100.0, 200.0, 150.0)
|
||||
fov = 45.0
|
||||
}
|
||||
|
||||
extend {
|
||||
drawer.shadeStyle = shadeStyle {
|
||||
fragmentTransform = """
|
||||
x_fill.rgb = vec3(v_viewNormal.z);
|
||||
""".trimIndent()
|
||||
}
|
||||
for (mesh in meshes) {
|
||||
for (primitive in mesh) {
|
||||
if (primitive.indexBuffer == null) {
|
||||
drawer.vertexBuffer(primitive.vertexBuffer, DrawPrimitive.TRIANGLES)
|
||||
} else {
|
||||
drawer.vertexBuffer(primitive.indexBuffer!!, listOf(primitive.vertexBuffer), DrawPrimitive.TRIANGLES)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user