-
Notifications
You must be signed in to change notification settings - Fork 37
/
DemoComplex05.kt
45 lines (43 loc) · 1.44 KB
/
DemoComplex05.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import org.openrndr.WindowMultisample
import org.openrndr.application
import org.openrndr.draw.CullTestPass
import org.openrndr.draw.DrawPrimitive
import org.openrndr.draw.shadeStyle
import org.openrndr.extra.camera.Orbital
import org.openrndr.extra.meshgenerators.*
import org.openrndr.math.Vector3
import org.openrndr.shape.Circle
fun main() {
application {
configure {
width = 800
height = 800
multisample = WindowMultisample.SampleCount(8)
}
program {
extend(Orbital()) {
this.eye = Vector3(0.0, 30.0, 50.0)
}
val m = buildTriangleMesh {
grid(5,5, 5) { u, v, w ->
isolated {
translate(u * 20.0, v * 20.0, w * 20.0)
extrudeShape(Circle(0.0, 0.0, 50.0).shape, 4.0, scale = 0.1)
}
}
twist(360.0/200.0, 0.0)
twist(360.0/200.0, 0.0, Vector3.UNIT_X)
twist(360.0/200.0, 0.0, Vector3.UNIT_Z)
}
extend {
drawer.shadeStyle = shadeStyle {
fragmentTransform = """
x_fill.rgb *= v_viewNormal.z;
""".trimIndent()
}
drawer.drawStyle.cullTestPass = CullTestPass.FRONT
drawer.vertexBuffer(m, DrawPrimitive.TRIANGLES)
}
}
}
}