Merged spatial into a single project

This commit is contained in:
Alexander Nozik 2019-08-04 11:32:19 +03:00
parent c3a7afc6d0
commit 5cb62c8f6e
25 changed files with 31 additions and 57 deletions

View File

@ -1,16 +0,0 @@
import org.openjfx.gradle.JavaFXOptions
plugins {
id("scientifik.jvm")
id("org.openjfx.javafxplugin")
}
dependencies {
implementation(project(":dataforge-vis-spatial"))
implementation(project(":dataforge-vis-fx"))
implementation("org.fxyz3d:fxyz3d:0.4.0")
}
configure<JavaFXOptions> {
modules("javafx.controls")
}

View File

@ -12,7 +12,7 @@ kotlin {
} }
val jsMain by getting { val jsMain by getting {
dependencies { dependencies {
api(project(":dataforge-vis-spatial-js")) api(project(":dataforge-vis-spatial"))
} }
} }
} }

View File

@ -1,21 +0,0 @@
plugins {
id("scientifik.js")
//id("kotlin-dce-js")
}
//val kotlinVersion: String by rootProject.extra
dependencies {
api(project(":dataforge-vis-spatial"))
api("info.laht.threekt:threejs-wrapper:0.106-npm-3")
testCompile(kotlin("test-js"))
}
kotlin{
sourceSets["main"].dependencies{
implementation(npm("three","0.106.2"))
implementation(npm("@hi-level/three-csg"))
implementation(npm("style-loader"))
implementation(npm("element-resize-event"))
}
}

View File

@ -1,5 +1,8 @@
import org.openjfx.gradle.JavaFXOptions
plugins { plugins {
id("scientifik.mpp") id("scientifik.mpp")
id("org.openjfx.javafxplugin")
} }
scientifik{ scientifik{
@ -18,7 +21,8 @@ kotlin {
} }
jvmMain{ jvmMain{
dependencies { dependencies {
implementation(project(":dataforge-vis-fx"))
implementation("org.fxyz3d:fxyz3d:0.4.0")
} }
} }
jsMain{ jsMain{
@ -33,3 +37,7 @@ kotlin {
} }
} }
configure<JavaFXOptions> {
modules("javafx.controls")
}

View File

@ -1,5 +1,6 @@
package hep.dataforge.vis.spatial package hep.dataforge.vis.spatial.fx
import com.sun.tools.javac.util.JCDiagnostic
import hep.dataforge.vis.spatial.World.CAMERA_FAR_CLIP import hep.dataforge.vis.spatial.World.CAMERA_FAR_CLIP
import hep.dataforge.vis.spatial.World.CAMERA_INITIAL_DISTANCE import hep.dataforge.vis.spatial.World.CAMERA_INITIAL_DISTANCE
import hep.dataforge.vis.spatial.World.CAMERA_INITIAL_X_ANGLE import hep.dataforge.vis.spatial.World.CAMERA_INITIAL_X_ANGLE
@ -54,7 +55,7 @@ class Canvas3D : Fragment() {
var angleZ by rotationZProperty var angleZ by rotationZProperty
override val root =borderpane { override val root = borderpane {
center = SubScene( center = SubScene(
Group(world, cameraRotation).apply { DepthTest.ENABLE }, Group(world, cameraRotation).apply { DepthTest.ENABLE },
1024.0, 1024.0,

View File

@ -1,10 +1,9 @@
package hep.dataforge.vis.spatial package hep.dataforge.vis.spatial.fx
import hep.dataforge.meta.* import hep.dataforge.meta.*
import hep.dataforge.names.Name import hep.dataforge.names.Name
import hep.dataforge.names.toName import hep.dataforge.names.toName
import hep.dataforge.vis.common.VisualObject import hep.dataforge.vis.common.VisualObject
import hep.dataforge.vis.common.onChange
import javafx.beans.binding.ObjectBinding import javafx.beans.binding.ObjectBinding
import tornadofx.* import tornadofx.*
@ -15,7 +14,7 @@ class DisplayObjectFXListener(val obj: VisualObject) {
private val binndings = HashMap<Name, ObjectBinding<MetaItem<*>?>>() private val binndings = HashMap<Name, ObjectBinding<MetaItem<*>?>>()
init { init {
obj.onChange(this) { name, _, _ -> obj.onPropertyChange(this) { name, _, _ ->
binndings[name]?.invalidate() binndings[name]?.invalidate()
} }
} }
@ -23,7 +22,7 @@ class DisplayObjectFXListener(val obj: VisualObject) {
operator fun get(key: Name): ObjectBinding<MetaItem<*>?> { operator fun get(key: Name): ObjectBinding<MetaItem<*>?> {
return binndings.getOrPut(key) { return binndings.getOrPut(key) {
object : ObjectBinding<MetaItem<*>?>() { object : ObjectBinding<MetaItem<*>?>() {
override fun computeValue(): MetaItem<*>? = obj.properties[key] override fun computeValue(): MetaItem<*>? = obj.getProperty(key)
} }
} }
} }

View File

@ -1,10 +1,11 @@
package hep.dataforge.vis.spatial package hep.dataforge.vis.spatial.fx
import hep.dataforge.context.Context import hep.dataforge.context.Context
import hep.dataforge.meta.Meta import hep.dataforge.meta.Meta
import hep.dataforge.output.Output import hep.dataforge.output.Output
import hep.dataforge.vis.common.VisualNode import hep.dataforge.vis.common.VisualNode
import hep.dataforge.vis.common.VisualObject import hep.dataforge.vis.common.VisualObject
import hep.dataforge.vis.spatial.Box
import javafx.scene.Group import javafx.scene.Group
import javafx.scene.Node import javafx.scene.Node
import org.fxyz3d.shapes.primitives.CuboidMesh import org.fxyz3d.shapes.primitives.CuboidMesh

View File

@ -1,4 +1,4 @@
package hep.dataforge.vis.spatial package hep.dataforge.vis.spatial.fx
import hep.dataforge.meta.MetaItem import hep.dataforge.meta.MetaItem
import hep.dataforge.meta.double import hep.dataforge.meta.double

View File

@ -1,7 +1,8 @@
package hep.dataforge.vis.spatial package hep.dataforge.vis.spatial.fx
import hep.dataforge.context.Global import hep.dataforge.context.Global
import hep.dataforge.meta.number import hep.dataforge.meta.number
import hep.dataforge.vis.spatial.*
import javafx.scene.Parent import javafx.scene.Parent
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay import kotlinx.coroutines.delay

View File

@ -34,9 +34,6 @@ include(
":dataforge-vis-common", ":dataforge-vis-common",
":dataforge-vis-fx", ":dataforge-vis-fx",
":dataforge-vis-spatial", ":dataforge-vis-spatial",
":dataforge-vis-spatial-fx",
":dataforge-vis-spatial-js",
// ":dataforge-vis-jsroot",
":dataforge-vis-spatial-gdml", ":dataforge-vis-spatial-gdml",
":spatial-js-demo" ":spatial-js-demo"
) )

View File

@ -4,7 +4,7 @@ plugins {
} }
dependencies { dependencies {
api(project(":dataforge-vis-spatial-js")) api(project(":dataforge-vis-spatial"))
api("info.laht.threekt:threejs-wrapper:0.106-npm-3") api("info.laht.threekt:threejs-wrapper:0.106-npm-3")
testCompile(kotlin("test-js")) testCompile(kotlin("test-js"))
} }

View File

@ -9,9 +9,7 @@ import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlin.math.PI import kotlin.math.*
import kotlin.math.cos
import kotlin.math.sin
import kotlin.random.Random import kotlin.random.Random
@ -36,7 +34,7 @@ private class ThreeDemoApp : ApplicationBase() {
tube(50, height = 10, innerRadius = 25, angle = PI) { tube(50, height = 10, innerRadius = 25, angle = PI) {
y = 110 y = 110
detail = 16 detail = 16
rotationX = PI/4 rotationX = PI / 4
} }
} }
@ -94,7 +92,7 @@ private class ThreeDemoApp : ApplicationBase() {
} }
} }
demo("CSG", "CSG operations") { demo("CSG.simple", "CSG operations") {
composite(CompositeType.UNION) { composite(CompositeType.UNION) {
box(100, 100, 100) { box(100, 100, 100) {
z = 50 z = 50
@ -122,6 +120,12 @@ private class ThreeDemoApp : ApplicationBase() {
color(Colors.blue) color(Colors.blue)
} }
} }
demo("CSG.custom","CSG with manually created object"){
intersect {
box(100,100,100)
tube(60,10)
}
}
} }