Files
orx/orx-shade-styles/src/jvmDemo/kotlin/spatial/DemoHemisphere01.kt
Edwin Jakobs 69721407af [orx-shade-styles] Add HemisphereLight shader and demo example
Introduce the `HemisphereLight` shader for smooth gradient lighting based on surface orientation relative to a light direction. Add a demo featuring the Suzanne model to showcase the shader in action.
2025-03-06 12:26:18 +01:00

35 lines
1.0 KiB
Kotlin

package spatial
import org.openrndr.WindowMultisample
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.draw.DrawPrimitive
import org.openrndr.extra.camera.Orbital
import org.openrndr.extra.color.presets.SADDLE_BROWN
import org.openrndr.extra.objloader.loadOBJasVertexBuffer
import org.openrndr.extra.shadestyles.spatial.HemisphereLight
import org.openrndr.math.Vector3
fun main() {
application {
configure {
width = 720
height = 720
multisample = WindowMultisample.SampleCount(8)
}
program {
val obj = loadOBJasVertexBuffer("demo-data/obj-models/suzanne/Suzanne.obj")
extend(Orbital()) {
eye = Vector3(0.0, 0.0, 2.0)
}
extend {
drawer.shadeStyle = HemisphereLight().apply {
downColor = ColorRGBa.SADDLE_BROWN
}
drawer.vertexBuffer(obj, DrawPrimitive.TRIANGLES)
}
}
}
}