Fix light in GDML demo

This commit is contained in:
Alexander Nozik 2022-05-24 23:09:40 +03:00
parent ce02a18c09
commit 86935ce52a
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
2 changed files with 14 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import space.kscience.dataforge.context.fetch
import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.Name
import space.kscience.gdml.Gdml import space.kscience.gdml.Gdml
import space.kscience.gdml.decodeFromString import space.kscience.gdml.decodeFromString
import space.kscience.visionforge.Colors
import space.kscience.visionforge.gdml.markLayers import space.kscience.visionforge.gdml.markLayers
import space.kscience.visionforge.gdml.toVision import space.kscience.visionforge.gdml.toVision
import space.kscience.visionforge.ring.ThreeCanvasWithControls import space.kscience.visionforge.ring.ThreeCanvasWithControls
@ -24,6 +25,8 @@ import space.kscience.visionforge.ring.tab
import space.kscience.visionforge.setAsRoot import space.kscience.visionforge.setAsRoot
import space.kscience.visionforge.solid.Solid import space.kscience.visionforge.solid.Solid
import space.kscience.visionforge.solid.Solids import space.kscience.visionforge.solid.Solids
import space.kscience.visionforge.solid.ambientLight
import space.kscience.visionforge.solid.invoke
import styled.css import styled.css
import styled.styledDiv import styled.styledDiv
@ -53,6 +56,9 @@ val GDMLApp = fc<GDMLAppProps>("GDMLApp") { props ->
setAsRoot(visionManager) setAsRoot(visionManager)
console.info("Marking layers for file $name") console.info("Marking layers for file $name")
markLayers() markLayers()
ambientLight {
color(Colors.white)
}
} }
} }
name.endsWith(".json") -> visionManager.decodeFromString(data) name.endsWith(".json") -> visionManager.decodeFromString(data)

View File

@ -6,7 +6,10 @@ import react.dom.render
import space.kscience.dataforge.context.Context import space.kscience.dataforge.context.Context
import space.kscience.gdml.GdmlShowCase import space.kscience.gdml.GdmlShowCase
import space.kscience.visionforge.Application import space.kscience.visionforge.Application
import space.kscience.visionforge.Colors
import space.kscience.visionforge.gdml.toVision import space.kscience.visionforge.gdml.toVision
import space.kscience.visionforge.solid.ambientLight
import space.kscience.visionforge.solid.invoke
import space.kscience.visionforge.solid.three.ThreePlugin import space.kscience.visionforge.solid.three.ThreePlugin
import space.kscience.visionforge.startApplication import space.kscience.visionforge.startApplication
import styled.injectGlobal import styled.injectGlobal
@ -41,7 +44,11 @@ private class GDMLDemoApp : Application {
render(element) { render(element) {
child(GDMLApp) { child(GDMLApp) {
val vision = GdmlShowCase.cubes().toVision() val vision = GdmlShowCase.cubes().toVision().apply {
ambientLight {
color(Colors.white)
}
}
//println(context.plugins.fetch(VisionManager).encodeToString(vision)) //println(context.plugins.fetch(VisionManager).encodeToString(vision))
attrs { attrs {
this.context = context this.context = context