forked from kscience/visionforge
A lot of small fixes
This commit is contained in:
parent
720555a942
commit
78a04728ba
@ -12,8 +12,10 @@ val fxVersion by extra("14")
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven("https://repo.kotlin.link")
|
||||
maven("https://kotlin.bintray.com/kotlin-js-wrappers")
|
||||
maven("https://dl.bintray.com/pdvrieze/maven")
|
||||
maven("http://maven.jzy3d.org/releases")
|
||||
|
@ -1,54 +0,0 @@
|
||||
package hep.dataforge.vision.gdml.demo
|
||||
|
||||
import space.kscience.gdml.*
|
||||
|
||||
|
||||
fun cubes(): Gdml = Gdml {
|
||||
val center = define.position("center")
|
||||
structure {
|
||||
val air = ref<GdmlMaterial>("G4_AIR")
|
||||
val tubeMaterial = ref<GdmlMaterial>("tube")
|
||||
val boxMaterial = ref<GdmlMaterial>("box")
|
||||
val segment = solids.tube("segment", 20, 5.0) {
|
||||
rmin = 17
|
||||
deltaphi = 60
|
||||
aunit = AUnit.DEG.title
|
||||
}
|
||||
val worldBox = solids.box("LargeBox", 200, 200, 200)
|
||||
val smallBox = solids.box("smallBox", 30, 30, 30)
|
||||
val segmentVolume = volume("segment", tubeMaterial, segment.ref()) {}
|
||||
val circle = volume("composite", boxMaterial, smallBox.ref()) {
|
||||
for (i in 0 until 6) {
|
||||
physVolume(segmentVolume) {
|
||||
name = "segment_$i"
|
||||
positionref = center.ref()
|
||||
rotation {
|
||||
z = 60 * i
|
||||
unit = AUnit.DEG.title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
world = volume("world", air, worldBox.ref()) {
|
||||
for (i in 0 until 3) {
|
||||
for (j in 0 until 3) {
|
||||
for (k in 0 until 3) {
|
||||
physVolume(circle) {
|
||||
name = "composite$i$j$k"
|
||||
position {
|
||||
x = (-50 + i * 50)
|
||||
y = (-50 + j * 50)
|
||||
z = (-50 + k * 50)
|
||||
}
|
||||
rotation {
|
||||
x = i * 120
|
||||
y = j * 120
|
||||
z = 120 * k
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ package hep.dataforge.vision.gdml
|
||||
import hep.dataforge.meta.string
|
||||
import hep.dataforge.names.toName
|
||||
import hep.dataforge.values.asValue
|
||||
import hep.dataforge.vision.gdml.demo.cubes
|
||||
import hep.dataforge.vision.gdml.GdmlShowcase.cubes
|
||||
import hep.dataforge.vision.setProperty
|
||||
import hep.dataforge.vision.solid.SolidMaterial
|
||||
import kotlin.test.Test
|
||||
@ -11,7 +11,6 @@ import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
class GDMLVisualTest {
|
||||
val gdml = cubes()
|
||||
|
||||
// @Test
|
||||
// fun testCubesStyles(){
|
||||
@ -24,8 +23,8 @@ class GDMLVisualTest {
|
||||
|
||||
@Test
|
||||
fun testPrototypeProperty() {
|
||||
val visual = gdml.toVision()
|
||||
val child = visual["composite000.segment_0".toName()]
|
||||
val visual = cubes.toVision()
|
||||
val child = visual["composite[0,0,0].segment[0]".toName()]
|
||||
assertTrue { child!= null }
|
||||
child?.setProperty(SolidMaterial.MATERIAL_COLOR_KEY, "red".asValue())
|
||||
assertEquals("red", child?.getProperty(SolidMaterial.MATERIAL_COLOR_KEY).string)
|
||||
|
@ -2,6 +2,7 @@ package hep.dataforge.vision.gdml.demo
|
||||
|
||||
import hep.dataforge.context.Global
|
||||
import hep.dataforge.vision.Application
|
||||
import hep.dataforge.vision.gdml.GdmlShowcase
|
||||
import hep.dataforge.vision.gdml.toVision
|
||||
import hep.dataforge.vision.solid.three.ThreePlugin
|
||||
import hep.dataforge.vision.startApplication
|
||||
@ -20,7 +21,7 @@ private class GDMLDemoApp : Application {
|
||||
}
|
||||
render(element) {
|
||||
child(GDMLApp) {
|
||||
val vision = cubes().toVision()
|
||||
val vision = GdmlShowcase.cubes.toVision()
|
||||
//println(context.plugins.fetch(VisionManager).encodeToString(vision))
|
||||
attrs {
|
||||
this.context = context
|
||||
|
@ -5,6 +5,7 @@ import hep.dataforge.vision.VisionManager
|
||||
import hep.dataforge.vision.describedProperties
|
||||
import hep.dataforge.vision.editor.VisualObjectEditorFragment
|
||||
import hep.dataforge.vision.editor.VisualObjectTreeFragment
|
||||
import hep.dataforge.vision.gdml.GdmlShowcase.cubes
|
||||
import hep.dataforge.vision.gdml.toVision
|
||||
import hep.dataforge.vision.solid.FX3DPlugin
|
||||
import hep.dataforge.vision.solid.FXCanvas3D
|
||||
@ -60,7 +61,7 @@ class GDMLView : View() {
|
||||
|
||||
init {
|
||||
runAsync {
|
||||
cubes().toVision()
|
||||
cubes.toVision()
|
||||
} ui {
|
||||
canvas.render(it)
|
||||
}
|
||||
|
@ -12,9 +12,9 @@ import space.kscience.gdml.*
|
||||
internal val cubes = Gdml {
|
||||
val center = define.position("center")
|
||||
structure {
|
||||
val air = ref<GdmlMaterial>("G4_AIR")
|
||||
val tubeMaterial = ref<GdmlMaterial>("tube")
|
||||
val boxMaterial = ref<GdmlMaterial>("box")
|
||||
val air = materials.composite("G4_AIR") {}
|
||||
val tubeMaterial = materials.composite("tube") {}
|
||||
val boxMaterial = materials.composite("box") {}
|
||||
|
||||
val segment = solids.tube("segment", 20, 5.0) {
|
||||
rmin = 17
|
||||
@ -23,11 +23,11 @@ internal val cubes = Gdml {
|
||||
}
|
||||
val worldBox = solids.box("largeBox", 200, 200, 200)
|
||||
val smallBox = solids.box("smallBox", 30, 30, 30)
|
||||
val segmentVolume = volume("segment", tubeMaterial, segment.ref()) {}
|
||||
val circle = volume("composite", boxMaterial, smallBox.ref()) {
|
||||
val segmentVolume = volume("segment", tubeMaterial, segment) {}
|
||||
val circle = volume("composite", boxMaterial, smallBox) {
|
||||
for (i in 0 until 6) {
|
||||
physVolume(segmentVolume) {
|
||||
positionref = center.ref()
|
||||
positionref = center
|
||||
rotation {
|
||||
z = 60 * i
|
||||
unit = AUnit.DEG.title
|
||||
@ -36,7 +36,7 @@ internal val cubes = Gdml {
|
||||
}
|
||||
}
|
||||
|
||||
world = volume("world", air, worldBox.ref()) {
|
||||
world = volume("world", air, worldBox) {
|
||||
for (i in 0 until 3) {
|
||||
for (j in 0 until 3) {
|
||||
for (k in 0 until 3) {
|
||||
|
@ -1,11 +1,13 @@
|
||||
package ru.mipt.npm.sat
|
||||
|
||||
import hep.dataforge.meta.set
|
||||
import hep.dataforge.misc.DFExperimental
|
||||
import hep.dataforge.vision.solid.*
|
||||
import hep.dataforge.vision.style
|
||||
import hep.dataforge.vision.useStyle
|
||||
import kotlin.math.PI
|
||||
|
||||
@DFExperimental
|
||||
internal fun visionOfSatellite(
|
||||
layers: Int = 10,
|
||||
layerHeight: Number = 10,
|
||||
|
@ -9,13 +9,13 @@ import kotlinx.html.*
|
||||
import kotlinx.html.stream.createHTML
|
||||
import kotlin.test.Test
|
||||
|
||||
@DFExperimental
|
||||
class HtmlTagTest {
|
||||
|
||||
@OptIn(DFExperimental::class)
|
||||
fun VisionOutput.base(block: VisionBase.() -> Unit) =
|
||||
VisionBase().apply(block)
|
||||
|
||||
val fragment: HtmlVisionFragment = {
|
||||
val fragment: HtmlVisionFragment = {
|
||||
div {
|
||||
h1 { +"Head" }
|
||||
vision("ddd") {
|
||||
|
@ -42,7 +42,7 @@ public class ColorValueChooser : ValueChooserBase<ColorPicker>() {
|
||||
return node
|
||||
}
|
||||
|
||||
companion object : ValueChooser.Factory {
|
||||
public companion object : ValueChooser.Factory {
|
||||
override val name: Name = "color".asName()
|
||||
|
||||
override fun invoke(meta: Meta): ValueChooser =
|
||||
|
@ -52,7 +52,7 @@ public class ComboBoxValueChooser(public val values: Collection<Value>? = null)
|
||||
node.selectionModel.select(value)
|
||||
}
|
||||
|
||||
companion object : ValueChooser.Factory {
|
||||
public companion object : ValueChooser.Factory {
|
||||
override val name: Name = "combo".asName()
|
||||
|
||||
override fun invoke(meta: Meta): ValueChooser =
|
||||
|
@ -15,6 +15,7 @@ import hep.dataforge.vision.dfIconView
|
||||
import javafx.scene.Node
|
||||
import javafx.scene.control.*
|
||||
import javafx.scene.control.cell.TextFieldTreeTableCell
|
||||
import javafx.scene.layout.BorderPane
|
||||
import javafx.scene.layout.HBox
|
||||
import javafx.scene.layout.Priority
|
||||
import javafx.scene.paint.Color
|
||||
@ -26,17 +27,17 @@ import tornadofx.*
|
||||
*
|
||||
* @author Alexander Nozik
|
||||
*/
|
||||
class ConfigEditor(
|
||||
val rootNode: FXMetaNode<Config>,
|
||||
val allowNew: Boolean = true,
|
||||
public class ConfigEditor(
|
||||
public val rootNode: FXMetaNode<Config>,
|
||||
public val allowNew: Boolean = true,
|
||||
title: String = "Configuration editor"
|
||||
) : Fragment(title = title, icon = dfIconView) {
|
||||
//TODO replace parameters by properties
|
||||
|
||||
constructor(config: Config, descriptor: NodeDescriptor?, title: String = "Configuration editor") :
|
||||
public constructor(config: Config, descriptor: NodeDescriptor?, title: String = "Configuration editor") :
|
||||
this(FXMeta.root(config, descriptor = descriptor), title = title)
|
||||
|
||||
override val root = borderpane {
|
||||
override val root: BorderPane = borderpane {
|
||||
center = treetableview<FXMeta<Config>> {
|
||||
root = TreeItem(rootNode)
|
||||
root.isExpanded = true
|
||||
|
@ -35,18 +35,18 @@ public interface ValueChooser {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
val node: Node
|
||||
public val node: Node
|
||||
|
||||
/**
|
||||
* The descriptor property for this value. Could be null
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
val descriptorProperty: ObjectProperty<ValueDescriptor?>
|
||||
var descriptor: ValueDescriptor?
|
||||
public val descriptorProperty: ObjectProperty<ValueDescriptor?>
|
||||
public var descriptor: ValueDescriptor?
|
||||
|
||||
val valueProperty: ObjectProperty<Value?>
|
||||
var value: Value?
|
||||
public val valueProperty: ObjectProperty<Value?>
|
||||
public var value: Value?
|
||||
|
||||
|
||||
/**
|
||||
@ -54,21 +54,21 @@ public interface ValueChooser {
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
fun setDisplayValue(value: Value)
|
||||
public fun setDisplayValue(value: Value)
|
||||
|
||||
|
||||
fun setDisabled(disabled: Boolean) {
|
||||
public fun setDisabled(disabled: Boolean) {
|
||||
//TODO replace by property
|
||||
}
|
||||
|
||||
fun setCallback(callback: ValueCallback)
|
||||
public fun setCallback(callback: ValueCallback)
|
||||
|
||||
@Type("hep.dataforge.vis.fx.valueChooserFactory")
|
||||
interface Factory : Named {
|
||||
operator fun invoke(meta: Meta = Meta.EMPTY): ValueChooser
|
||||
public interface Factory : Named {
|
||||
public operator fun invoke(meta: Meta = Meta.EMPTY): ValueChooser
|
||||
}
|
||||
|
||||
companion object {
|
||||
public companion object {
|
||||
|
||||
private fun findWidgetByType(context: Context, type: String): Factory? {
|
||||
return when (type.toName()) {
|
||||
|
@ -7,7 +7,7 @@ kotlin {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api(project(":visionforge-solid"))
|
||||
api("space.kscience:gdml:0.2.0")
|
||||
api("space.kscience:gdml:0.3.0-dev")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,57 @@
|
||||
package hep.dataforge.vision.gdml
|
||||
|
||||
import space.kscience.gdml.*
|
||||
|
||||
public object GdmlShowcase {
|
||||
public val cubes = Gdml {
|
||||
val center = define.position("center")
|
||||
structure {
|
||||
val air = materials.composite("G4_AIR") {}
|
||||
val tubeMaterial = materials.composite("tube") {}
|
||||
val boxMaterial = materials.composite("box") {}
|
||||
|
||||
val segment = solids.tube("segment", 20, 5.0) {
|
||||
rmin = 17
|
||||
deltaphi = 60
|
||||
aunit = AUnit.DEG.title
|
||||
}
|
||||
val worldBox = solids.box("largeBox", 200, 200, 200)
|
||||
val smallBox = solids.box("smallBox", 30, 30, 30)
|
||||
val segmentVolume = volume("segment", tubeMaterial, segment) {}
|
||||
val circle = volume("composite", boxMaterial, smallBox) {
|
||||
for (i in 0 until 6) {
|
||||
physVolume(segmentVolume) {
|
||||
name = "segment[$i]"
|
||||
positionref = center
|
||||
rotation {
|
||||
z = 60 * i
|
||||
unit = AUnit.DEG.title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world = volume("world", air, worldBox) {
|
||||
for (i in 0 until 3) {
|
||||
for (j in 0 until 3) {
|
||||
for (k in 0 until 3) {
|
||||
physVolume(circle) {
|
||||
name = "composite[$i,$j,$k]"
|
||||
position {
|
||||
x = (-50 + i * 50)
|
||||
y = (-50 + j * 50)
|
||||
z = (-50 + k * 50)
|
||||
}
|
||||
rotation {
|
||||
x = i * 120
|
||||
y = j * 120
|
||||
z = 120 * k
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -66,7 +66,12 @@ private class GdmlTransformer(val settings: GdmlTransformerSettings) {
|
||||
return ref
|
||||
}
|
||||
|
||||
private fun proxyVolume(root: Gdml, group: SolidGroup, physVolume: GdmlPhysVolume, volume: GdmlGroup): SolidReferenceGroup {
|
||||
private fun proxyVolume(
|
||||
root: Gdml,
|
||||
group: SolidGroup,
|
||||
physVolume: GdmlPhysVolume,
|
||||
volume: GdmlGroup,
|
||||
): SolidReferenceGroup {
|
||||
val templateName = volumesName + volume.name.asName()
|
||||
if (proto[templateName] == null) {
|
||||
proto[templateName] = volume(root, volume)
|
||||
|
66
visionforge-gdml/src/commonTest/kotlin/TestCubes.kt
Normal file
66
visionforge-gdml/src/commonTest/kotlin/TestCubes.kt
Normal file
@ -0,0 +1,66 @@
|
||||
package hep.dataforge.vision.gdml
|
||||
|
||||
import hep.dataforge.context.Context
|
||||
import hep.dataforge.names.toName
|
||||
import hep.dataforge.vision.Vision
|
||||
import hep.dataforge.vision.gdml.GdmlShowcase.cubes
|
||||
import hep.dataforge.vision.get
|
||||
import hep.dataforge.vision.solid.*
|
||||
import hep.dataforge.vision.visionManager
|
||||
import space.kscience.gdml.Gdml
|
||||
import space.kscience.gdml.GdmlBox
|
||||
import space.kscience.gdml.decodeFromString
|
||||
import space.kscience.gdml.encodeToString
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
internal val testContext = Context("TEST") {
|
||||
plugin(Solids)
|
||||
}
|
||||
|
||||
class TestCubes {
|
||||
|
||||
@Test
|
||||
fun testCubesDirect() {
|
||||
val vision = cubes.toVision()
|
||||
val smallBoxPrototype = vision.getPrototype("solids.smallBox".toName()) as? Box
|
||||
assertNotNull(smallBoxPrototype)
|
||||
assertEquals(30.0, smallBoxPrototype.xSize.toDouble())
|
||||
val smallBoxVision = vision["composite[1,1,1].smallBox"]?.prototype as? Box
|
||||
assertNotNull(smallBoxVision)
|
||||
assertEquals(30.0, smallBoxVision.xSize.toDouble())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testGdmlExport() {
|
||||
val xml = cubes.encodeToString()
|
||||
//println(xml)
|
||||
val gdml = Gdml.decodeFromString(xml)
|
||||
val smallBox = gdml.getSolid<GdmlBox>("smallBox")
|
||||
assertNotNull(smallBox)
|
||||
assertEquals(30.0, smallBox.x.toDouble())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCubesReSerialize() {
|
||||
val vision = cubes.toVision()
|
||||
val serialized = Solids.encodeToString(vision)
|
||||
val deserialized = testContext.visionManager.decodeFromString(serialized) as SolidGroup
|
||||
val smallBox = deserialized.getPrototype("solids.smallBox".toName()) as? Box
|
||||
assertNotNull(smallBox)
|
||||
assertEquals(30.0, smallBox.xSize.toDouble())
|
||||
//println(testContext.visionManager.encodeToString(deserialized))
|
||||
fun Vision.checkPrototypes() {
|
||||
if (this is SolidReference) {
|
||||
assertNotNull(this.prototype)
|
||||
}
|
||||
if (this is SolidGroup) {
|
||||
children.forEach {
|
||||
it.value.checkPrototypes()
|
||||
}
|
||||
}
|
||||
}
|
||||
deserialized.checkPrototypes()
|
||||
}
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
package hep.dataforge.vision.gdml
|
||||
|
||||
import hep.dataforge.context.Context
|
||||
import hep.dataforge.names.toName
|
||||
import hep.dataforge.vision.Vision
|
||||
import hep.dataforge.vision.solid.SolidGroup
|
||||
import hep.dataforge.vision.solid.SolidReference
|
||||
import hep.dataforge.vision.solid.Solids
|
||||
import hep.dataforge.vision.visionManager
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.assertDoesNotThrow
|
||||
import space.kscience.gdml.*
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
internal val testContext = Context("TEST"){
|
||||
plugin(Solids)
|
||||
}
|
||||
|
||||
class TestCubes {
|
||||
|
||||
internal val cubes = Gdml {
|
||||
val center = define.position("center")
|
||||
structure {
|
||||
val air = ref<GdmlMaterial>("G4_AIR")
|
||||
val tubeMaterial = ref<GdmlMaterial>("tube")
|
||||
val boxMaterial = ref<GdmlMaterial>("box")
|
||||
|
||||
val segment = solids.tube("segment", 20, 5.0) {
|
||||
rmin = 17
|
||||
deltaphi = 60
|
||||
aunit = AUnit.DEG.title
|
||||
}
|
||||
val worldBox = solids.box("largeBox", 200, 200, 200)
|
||||
val smallBox = solids.box("smallBox", 30, 30, 30)
|
||||
val segmentVolume = volume("segment", tubeMaterial, segment.ref()) {}
|
||||
val circle = volume("composite", boxMaterial, smallBox.ref()) {
|
||||
for (i in 0 until 6) {
|
||||
physVolume(segmentVolume) {
|
||||
positionref = center.ref()
|
||||
rotation {
|
||||
z = 60 * i
|
||||
unit = AUnit.DEG.title
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
world = volume("world", air, worldBox.ref()) {
|
||||
for (i in 0 until 3) {
|
||||
for (j in 0 until 3) {
|
||||
for (k in 0 until 3) {
|
||||
physVolume(circle) {
|
||||
position {
|
||||
x = (-50 + i * 50)
|
||||
y = (-50 + j * 50)
|
||||
z = (-50 + k * 50)
|
||||
}
|
||||
rotation {
|
||||
x = i * 120
|
||||
y = j * 120
|
||||
z = 120 * k
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCubesDirect(){
|
||||
val vision = cubes.toVision()
|
||||
assertNotNull(vision.getPrototype("solids.smallBox".toName()))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCubesReSerialize(){
|
||||
val vision = cubes.toVision()
|
||||
val serialized = Solids.encodeToString(vision)
|
||||
val deserialized = testContext.visionManager.decodeFromString(serialized) as SolidGroup
|
||||
assertNotNull(deserialized.getPrototype("solids.smallBox".toName()))
|
||||
//println(testContext.visionManager.encodeToString(deserialized))
|
||||
fun Vision.checkPrototypes(){
|
||||
if(this is SolidReference){
|
||||
assertDoesNotThrow { this.prototype }
|
||||
}
|
||||
if(this is SolidGroup){
|
||||
children.forEach {
|
||||
it.value.checkPrototypes()
|
||||
}
|
||||
}
|
||||
}
|
||||
deserialized.checkPrototypes()
|
||||
}
|
||||
}
|
@ -163,7 +163,7 @@ public class SolidReferenceGroup(
|
||||
* Get a vision prototype if it is a [SolidReferenceGroup] or vision itself if it is not
|
||||
*/
|
||||
public val Vision.prototype: Vision
|
||||
get() = if (this is SolidReference) prototype else this
|
||||
get() = if (this is SolidReference) prototype.prototype else this
|
||||
|
||||
/**
|
||||
* Create ref for existing prototype
|
||||
|
@ -1,5 +1,6 @@
|
||||
package hep.dataforge.vision.solid
|
||||
|
||||
import hep.dataforge.misc.DFExperimental
|
||||
import hep.dataforge.vision.get
|
||||
import hep.dataforge.vision.style
|
||||
import hep.dataforge.vision.useStyle
|
||||
@ -7,6 +8,7 @@ import kotlinx.serialization.json.encodeToJsonElement
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
@DFExperimental
|
||||
class SolidReferenceTest {
|
||||
val groupWithReference = SolidGroup {
|
||||
val theStyle by style {
|
||||
|
@ -2,6 +2,7 @@ package hep.dataforge.vision.solid.three
|
||||
|
||||
import hep.dataforge.context.*
|
||||
import hep.dataforge.meta.Meta
|
||||
import hep.dataforge.misc.DFExperimental
|
||||
import hep.dataforge.names.*
|
||||
import hep.dataforge.vision.*
|
||||
import hep.dataforge.vision.solid.*
|
||||
@ -50,7 +51,7 @@ public class ThreePlugin : AbstractPlugin(), ElementVisionRenderer {
|
||||
is SolidGroup -> {
|
||||
val group = ThreeGroup()
|
||||
obj.children.forEach { (token, child) ->
|
||||
if (child is Solid && child.ignore != true) {
|
||||
if (child is Solid && token != SolidGroup.PROTOTYPES_TOKEN && child.ignore != true) {
|
||||
try {
|
||||
val object3D = buildObject3D(child)
|
||||
group[token] = object3D
|
||||
@ -151,6 +152,7 @@ public class ThreePlugin : AbstractPlugin(), ElementVisionRenderer {
|
||||
/**
|
||||
* Ensure that [ThreePlugin] is loaded in the global [VisionForge] context
|
||||
*/
|
||||
@DFExperimental
|
||||
public fun VisionForge.useThreeJs() {
|
||||
plugins.fetch(ThreePlugin)
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package hep.dataforge.vision.three.server
|
||||
|
||||
import hep.dataforge.misc.DFExperimental
|
||||
import hep.dataforge.vision.VisionForge
|
||||
import hep.dataforge.vision.solid.three.useThreeJs
|
||||
|
||||
@DFExperimental
|
||||
public fun main(): Unit = VisionForge.run {
|
||||
useThreeJs()
|
||||
renderVisionsInWindow()
|
||||
|
Loading…
Reference in New Issue
Block a user