From 86935ce52af027c72bcf75c2b8a6e20c5f153156 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Tue, 24 May 2022 23:09:40 +0300 Subject: [PATCH] Fix light in GDML demo --- .../kscience/visionforge/gdml/demo/GDMLAppComponent.kt | 6 ++++++ .../kscience/visionforge/gdml/demo/GdmlJsDemoApp.kt | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GDMLAppComponent.kt b/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GDMLAppComponent.kt index 823297ec..c82fa60b 100644 --- a/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GDMLAppComponent.kt +++ b/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GDMLAppComponent.kt @@ -17,6 +17,7 @@ import space.kscience.dataforge.context.fetch import space.kscience.dataforge.names.Name import space.kscience.gdml.Gdml import space.kscience.gdml.decodeFromString +import space.kscience.visionforge.Colors import space.kscience.visionforge.gdml.markLayers import space.kscience.visionforge.gdml.toVision 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.solid.Solid import space.kscience.visionforge.solid.Solids +import space.kscience.visionforge.solid.ambientLight +import space.kscience.visionforge.solid.invoke import styled.css import styled.styledDiv @@ -53,6 +56,9 @@ val GDMLApp = fc("GDMLApp") { props -> setAsRoot(visionManager) console.info("Marking layers for file $name") markLayers() + ambientLight { + color(Colors.white) + } } } name.endsWith(".json") -> visionManager.decodeFromString(data) diff --git a/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GdmlJsDemoApp.kt b/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GdmlJsDemoApp.kt index 74246432..284e09f6 100644 --- a/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GdmlJsDemoApp.kt +++ b/demo/gdml/src/jsMain/kotlin/space/kscience/visionforge/gdml/demo/GdmlJsDemoApp.kt @@ -6,7 +6,10 @@ import react.dom.render import space.kscience.dataforge.context.Context import space.kscience.gdml.GdmlShowCase import space.kscience.visionforge.Application +import space.kscience.visionforge.Colors 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.startApplication import styled.injectGlobal @@ -41,7 +44,11 @@ private class GDMLDemoApp : Application { render(element) { child(GDMLApp) { - val vision = GdmlShowCase.cubes().toVision() + val vision = GdmlShowCase.cubes().toVision().apply { + ambientLight { + color(Colors.white) + } + } //println(context.plugins.fetch(VisionManager).encodeToString(vision)) attrs { this.context = context