0.2.0 #71

Merged
altavir merged 139 commits from dev into master 2022-01-24 09:44:18 +03:00
6 changed files with 27 additions and 32 deletions
Showing only changes of commit f99a359e24 - Show all commits

View File

@ -1,9 +1,9 @@
plugins { plugins {
id("ru.mipt.npm.gradle.project") id("ru.mipt.npm.gradle.project")
kotlin("multiplatform") version "1.5.30-RC" apply false // kotlin("multiplatform") version "1.5.30-RC" apply false
} }
val dataforgeVersion by extra("0.5.0") val dataforgeVersion by extra("0.5.1")
val fxVersion by extra("11") val fxVersion by extra("11")
allprojects { allprojects {

View File

@ -20,7 +20,7 @@ kotlin {
this.outputFileName = "js/visionforge-playground.js" this.outputFileName = "js/visionforge-playground.js"
} }
commonWebpackConfig { commonWebpackConfig {
sourceMaps = false sourceMaps = true
cssSupport.enabled = false cssSupport.enabled = false
} }
} }
@ -37,7 +37,7 @@ kotlin {
} }
afterEvaluate { afterEvaluate {
val jsBrowserDistribution by tasks.getting val jsBrowserDistribution = tasks.getByName("jsBrowserDevelopmentExecutableDistribution")
tasks.getByName<ProcessResources>("jvmProcessResources") { tasks.getByName<ProcessResources>("jvmProcessResources") {
dependsOn(jsBrowserDistribution) dependsOn(jsBrowserDistribution)

View File

@ -17,7 +17,7 @@ fun main() {
context.makeVisionFile( context.makeVisionFile(
Paths.get("randomSpheres.html"), Paths.get("randomSpheres.html"),
resourceLocation = ResourceLocation.EMBED resourceLocation = ResourceLocation.SYSTEM
) { ) {
h1 { +"Happy new year!" } h1 { +"Happy new year!" }
div { div {

View File

@ -2,16 +2,15 @@ package space.kscience.visionforge.solid
import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.plus import space.kscience.dataforge.names.plus
import space.kscience.dataforge.values.MutableValueProvider import space.kscience.dataforge.values.*
import space.kscience.dataforge.values.Value
import space.kscience.dataforge.values.asValue
import space.kscience.dataforge.values.string
import space.kscience.visionforge.Colors import space.kscience.visionforge.Colors
import space.kscience.visionforge.VisionBuilder import space.kscience.visionforge.VisionBuilder
@VisionBuilder @VisionBuilder
public class ColorAccessor(private val provider: MutableValueProvider, private val colorKey: Name) : public class ColorAccessor(
MutableValueProvider { private val provider: MutableValueProvider,
private val colorKey: Name
) : MutableValueProvider {
public var value: Value? public var value: Value?
get() = provider.getValue(colorKey) get() = provider.getValue(colorKey)
set(value) { set(value) {
@ -26,7 +25,7 @@ public class ColorAccessor(private val provider: MutableValueProvider, private v
} }
public var ColorAccessor?.string: String? public var ColorAccessor?.string: String?
get() = this?.value?.string get() = this?.value?.let { if(it == Null) null else it.string }
set(value) { set(value) {
this?.value = value?.asValue() this?.value = value?.asValue()
} }

View File

@ -5,7 +5,6 @@ import kotlinx.serialization.Serializable
import space.kscience.dataforge.meta.MutableMeta import space.kscience.dataforge.meta.MutableMeta
import space.kscience.dataforge.meta.descriptors.MetaDescriptor import space.kscience.dataforge.meta.descriptors.MetaDescriptor
import space.kscience.visionforge.VisionBase import space.kscience.visionforge.VisionBase
import space.kscience.visionforge.VisionChange
@Serializable @Serializable
@SerialName("solid") @SerialName("solid")
@ -14,9 +13,4 @@ public open class SolidBase : VisionBase(), Solid {
override var properties: MutableMeta? = null override var properties: MutableMeta? = null
override val descriptor: MetaDescriptor get() = Solid.descriptor override val descriptor: MetaDescriptor get() = Solid.descriptor
override fun update(change: VisionChange) {
updatePosition(change.properties)
super.update(change)
}
} }

View File

@ -5,10 +5,7 @@ import info.laht.threekt.materials.Material
import info.laht.threekt.materials.MeshBasicMaterial import info.laht.threekt.materials.MeshBasicMaterial
import info.laht.threekt.math.Color import info.laht.threekt.math.Color
import info.laht.threekt.objects.Mesh import info.laht.threekt.objects.Mesh
import space.kscience.dataforge.meta.Meta import space.kscience.dataforge.meta.*
import space.kscience.dataforge.meta.boolean
import space.kscience.dataforge.meta.double
import space.kscience.dataforge.meta.get
import space.kscience.dataforge.names.Name import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.asName import space.kscience.dataforge.names.asName
import space.kscience.dataforge.values.* import space.kscience.dataforge.values.*
@ -100,18 +97,23 @@ public object ThreeMaterials {
/** /**
* Compute color * Compute color
*/ */
public fun Meta.threeColor(): Color = getValue(Name.EMPTY)?.let { value -> public fun Meta.threeColor(): Color? {
if (value.type == ValueType.NUMBER) { val value = getValue(Name.EMPTY)
val int = value.int return if (isLeaf) {
Color(int) when {
} else { value == null -> null
Color(value.string) value === Null -> null
value.type == ValueType.NUMBER -> Color(value.int)
else -> Color(value.string)
} }
} ?: Color( } else {
Color(
getValue(Colors.RED_KEY.asName())?.int ?: 0, getValue(Colors.RED_KEY.asName())?.int ?: 0,
getValue(Colors.GREEN_KEY.asName())?.int ?: 0, getValue(Colors.GREEN_KEY.asName())?.int ?: 0,
getValue(Colors.BLUE_KEY.asName())?.int ?: 0 getValue(Colors.BLUE_KEY.asName())?.int ?: 0
) )
}
}
private var Material.cached: Boolean private var Material.cached: Boolean
get() = userData["cached"] == true get() = userData["cached"] == true