[orx-kinect] Change shutdown handler to inner class
This commit is contained in:
@@ -17,19 +17,17 @@ class DefaultKinects<CTX>(
|
|||||||
private val manager: KinectsManager<CTX>
|
private val manager: KinectsManager<CTX>
|
||||||
) : Kinects<CTX> {
|
) : Kinects<CTX> {
|
||||||
|
|
||||||
|
private inner class Destroyer : Thread() {
|
||||||
|
override fun run() {
|
||||||
|
manager.shutdown()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
manager.initialize()
|
manager.initialize()
|
||||||
// as we don't have explicit shutdown mechanism in OPENRNDR
|
// as we don't have explicit shutdown mechanism in OPENRNDR
|
||||||
// we need to install a shutdown hook for now
|
// we need to install a shutdown hook for now
|
||||||
Runtime.getRuntime().addShutdownHook(
|
Runtime.getRuntime().addShutdownHook(Destroyer())
|
||||||
thread(
|
|
||||||
name = "${manager.javaClass.simpleName}-closer",
|
|
||||||
start = false,
|
|
||||||
isDaemon = false
|
|
||||||
) {
|
|
||||||
manager.shutdown()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun countDevices(): Int {
|
override fun countDevices(): Int {
|
||||||
@@ -132,14 +130,20 @@ class DefaultKinectDepthCamera(
|
|||||||
|
|
||||||
override var mirror: Boolean
|
override var mirror: Boolean
|
||||||
get() = depthMapper.mirror
|
get() = depthMapper.mirror
|
||||||
set(value) { depthMapper.mirror = value }
|
set(value) {
|
||||||
|
depthMapper.mirror = value
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class KinectRawDataToDepthMapper :
|
private class KinectRawDataToDepthMapper :
|
||||||
Filter(filterShaderFromUrl(
|
Filter(
|
||||||
resourceUrl("kinect-raw-to-depth.frag",
|
filterShaderFromUrl(
|
||||||
DefaultKinects::class.java))
|
resourceUrl(
|
||||||
|
"kinect-raw-to-depth.frag",
|
||||||
|
DefaultKinects::class.java
|
||||||
|
)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
var depthScale: Double by parameters
|
var depthScale: Double by parameters
|
||||||
var mirror: Boolean by parameters
|
var mirror: Boolean by parameters
|
||||||
|
|||||||
Reference in New Issue
Block a user