Kotlin/JVM port of the popular three.js 3D library (r106).
Be warned, while the basics works, such as:
- Primitives, Points and TubeGeometry (Only BufferGeometries are supported)
- All materials
- OrbitControls
- Ambient, Directional, Point and Spot lights
- RenderTarget, 2D textures
- Other stuff like Reflector (mirror) and water
a lot of features are still missing and the API can change rapidly.
Right now, this is mostly interesting for developers that want to contribute.
This project has been setup as a kotlin multi-platform project.
Due to some issue loading files from the resources folder in this context,
right click -> run
will not work. As a temporary workaround,
please run the associated gradle tasks instead.
E.g. BasicExample.kt
will have an associated runBasicExample
gradle task.
Canvas().use { canvas ->
val scene = Scene().apply {
setBackground(Color.aliceblue)
}
val camera = PerspectiveCamera(75, canvas.aspect, 0.1, 1000)
val renderer = GLRenderer(canvas).apply {
checkShaderErrors = true
}
val box = Mesh(BoxGeometry(1f), MeshBasicMaterial().apply {
color.set(0x00ff00)
}).also {
scene.add(it)
}
camera.position.z = 5f
val controls = OrbitControls(camera, canvas)
val clock = Clock()
while (!canvas.shouldClose()) {
renderer.render(scene, camera)
val dt = clock.getDelta()
box.rotation.x += 1f * dt
box.rotation.y += 1f * dt
}
}
It has been renamed and moved to here.