diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt b/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt index 3e3faf3..65b27a8 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/app/Main.kt @@ -1,15 +1,10 @@ package org.hso.texturesyncclient.app import org.hso.texturesyncclient.view.importView.ImportView +import org.hso.texturesyncclient.view.mainView.MainView import org.hso.texturesyncclient.view.startupView.StartupView import tornadofx.App -class Main: App(ImportView::class){ - - - - - - - +class Main: App(MainView::class){ + } \ No newline at end of file diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/DetailView.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/DetailView.kt new file mode 100644 index 0000000..7ffaaab --- /dev/null +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/DetailView.kt @@ -0,0 +1,43 @@ +package org.hso.texturesyncclient.view.mainView + +import javafx.geometry.Insets +import javafx.geometry.Orientation +import javafx.scene.image.Image +import javafx.scene.layout.Background +import javafx.scene.layout.BackgroundFill +import javafx.scene.layout.CornerRadii +import javafx.scene.paint.Paint +import tornadofx.* + +class DetailView: View() { + + val preview = Preview3D() + + init { + val DIFFUSE_MAP = "https://bit.ly/2FTajSP" + preview.setTexture(Image(DIFFUSE_MAP)) + } + + override val root = form { + minWidth = 250.0 + background = Background(BackgroundFill(Paint.valueOf("#9f9f9f"), CornerRadii.EMPTY, Insets.EMPTY)) + + fieldset("DetailView", labelPosition = Orientation.VERTICAL) { + + field("3D Preview") { + vbox(7) { + add(preview) + } + } + + field("Text input") { + + } + + field("Tags") { + + } + } + + } +} \ No newline at end of file diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/FolderView.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/FolderView.kt new file mode 100644 index 0000000..6ed3611 --- /dev/null +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/FolderView.kt @@ -0,0 +1,21 @@ +package org.hso.texturesyncclient.view.mainView + +import javafx.geometry.Insets +import javafx.scene.control.TextField +import javafx.scene.layout.Background +import javafx.scene.layout.BackgroundFill +import javafx.scene.layout.CornerRadii +import javafx.scene.paint.Paint +import tornadofx.* + +class FolderView : View("FolderView"){ + + val tf = TextField("FolderView") + + override val root = gridpane { + prefWidth = 750.0 + background = Background(BackgroundFill(Paint.valueOf("#cfcfcf"), CornerRadii.EMPTY, Insets.EMPTY)) + + add(tf) + } +} \ No newline at end of file diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt index 074644e..00282a3 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/MainView.kt @@ -1,13 +1,27 @@ package org.hso.texturesyncclient.view.mainView -import javafx.scene.Parent import tornadofx.* class MainView : View() { + private val folderView = find(FolderView::class) + private val detailView = find(DetailView::class) - override val root: Parent - get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. + private val mvc: MainViewController by inject() + + override val root = borderpane { + minWidth = 1000.0 + minHeight = 500.0 + + left = folderView.root + right = detailView.root + + style { + // style options + } + + // actions + } diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/Preview3D.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/Preview3D.kt new file mode 100644 index 0000000..3dc1d5f --- /dev/null +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/mainView/Preview3D.kt @@ -0,0 +1,74 @@ +package org.hso.texturesyncclient.view.mainView + +import javafx.animation.Interpolator +import javafx.animation.RotateTransition +import javafx.geometry.Insets +import javafx.scene.AmbientLight +import javafx.scene.PointLight +import javafx.scene.image.Image +import javafx.scene.layout.Background +import javafx.scene.layout.BackgroundFill +import javafx.scene.layout.CornerRadii +import javafx.scene.paint.Color +import javafx.scene.paint.PhongMaterial +import javafx.scene.shape.Box +import javafx.scene.transform.Rotate +import tornadofx.* + +class Preview3D : View("Preview3D") { + + private val boxSize = 100.0 + private val dBox = Box(boxSize, boxSize, boxSize) + private val rxBox = Rotate(45.0, 0.0, 0.0, 0.0, Rotate.X_AXIS) + private val ryBox = Rotate(45.0, 0.0, 0.0, 0.0, Rotate.Y_AXIS) + + private val pointLightFront = PointLight(Color.WHITE) + private val ambient = AmbientLight(Color.ANTIQUEWHITE) + + init { + // add rotation to the box + dBox.transforms.addAll(rxBox, ryBox) + + // light stuff + pointLightFront.translateX = boxSize + pointLightFront.translateY = boxSize + pointLightFront.translateZ = (-2 * boxSize) + pointLightFront.rotate = 90.0 + } + + + override val root = stackpane { + + add(dBox).apply { + // rotate the box from 0° to 360° for infinity around the y axis + dBox.rotationAxis = Rotate.Y_AXIS + timeline { + keyframe(18.seconds) { + keyvalue(dBox.rotateProperty(), 360.0, interpolator = Interpolator.LINEAR) + } + cycleCount = RotateTransition.INDEFINITE + } + } + + add(pointLightFront) + add(ambient) + + style { + minWidth = 200.px + minHeight = 200.px + background = Background(BackgroundFill(Color.BLUEVIOLET, CornerRadii.EMPTY, Insets.EMPTY)) + } + + } + + /** + * set the texture of the bock + * @param img the texture to set + */ + fun setTexture(img: Image) { + val textureMaterial = PhongMaterial() + textureMaterial.diffuseMap = img + dBox.material = textureMaterial + } + +} diff --git a/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupView.kt b/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupView.kt index 23722cf..b904603 100644 --- a/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupView.kt +++ b/client/src/main/kotlin/org/hso/texturesyncclient/view/startupView/StartupView.kt @@ -16,7 +16,7 @@ import javafx.scene.text.Font import javafx.scene.text.FontWeight import tornadofx.* -class StartupView : View() { +class StartupView : View("StartupView") { val labelStatus = Label("Verbindung zum Server einrichten") val spinnerStatus = JFXSpinner() @@ -57,8 +57,7 @@ class StartupView : View() { labelServerIP.textFill = Paint.valueOf("#2b7bbb") labelServerIP.font = Font.font("Verdana", FontWeight.MEDIUM, 15.0) btnConnect.textFill = Paint.valueOf("#2b7bbb") - btnConnect.background = - Background(BackgroundFill(Paint.valueOf("#3c3f41"), CornerRadii.EMPTY, Insets.EMPTY)) + btnConnect.background = Background(BackgroundFill(Paint.valueOf("#3c3f41"), CornerRadii.EMPTY, Insets.EMPTY)) tfServerIP.style { //TODO without .style textFill = Paint.valueOf("#b15b2e")