0.2.0 #71
@ -1,9 +1,9 @@
|
||||
plugins {
|
||||
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")
|
||||
|
||||
allprojects {
|
||||
|
@ -20,7 +20,7 @@ kotlin {
|
||||
this.outputFileName = "js/visionforge-playground.js"
|
||||
}
|
||||
commonWebpackConfig {
|
||||
sourceMaps = false
|
||||
sourceMaps = true
|
||||
cssSupport.enabled = false
|
||||
}
|
||||
}
|
||||
@ -37,7 +37,7 @@ kotlin {
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
val jsBrowserDistribution by tasks.getting
|
||||
val jsBrowserDistribution = tasks.getByName("jsBrowserDevelopmentExecutableDistribution")
|
||||
|
||||
tasks.getByName<ProcessResources>("jvmProcessResources") {
|
||||
dependsOn(jsBrowserDistribution)
|
||||
|
@ -17,7 +17,7 @@ fun main() {
|
||||
|
||||
context.makeVisionFile(
|
||||
Paths.get("randomSpheres.html"),
|
||||
resourceLocation = ResourceLocation.EMBED
|
||||
resourceLocation = ResourceLocation.SYSTEM
|
||||
) {
|
||||
h1 { +"Happy new year!" }
|
||||
div {
|
||||
|
@ -2,16 +2,15 @@ package space.kscience.visionforge.solid
|
||||
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.names.plus
|
||||
import space.kscience.dataforge.values.MutableValueProvider
|
||||
import space.kscience.dataforge.values.Value
|
||||
import space.kscience.dataforge.values.asValue
|
||||
import space.kscience.dataforge.values.string
|
||||
import space.kscience.dataforge.values.*
|
||||
import space.kscience.visionforge.Colors
|
||||
import space.kscience.visionforge.VisionBuilder
|
||||
|
||||
@VisionBuilder
|
||||
public class ColorAccessor(private val provider: MutableValueProvider, private val colorKey: Name) :
|
||||
MutableValueProvider {
|
||||
public class ColorAccessor(
|
||||
private val provider: MutableValueProvider,
|
||||
private val colorKey: Name
|
||||
) : MutableValueProvider {
|
||||
public var value: Value?
|
||||
get() = provider.getValue(colorKey)
|
||||
set(value) {
|
||||
@ -26,7 +25,7 @@ public class ColorAccessor(private val provider: MutableValueProvider, private v
|
||||
}
|
||||
|
||||
public var ColorAccessor?.string: String?
|
||||
get() = this?.value?.string
|
||||
get() = this?.value?.let { if(it == Null) null else it.string }
|
||||
set(value) {
|
||||
this?.value = value?.asValue()
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import kotlinx.serialization.Serializable
|
||||
import space.kscience.dataforge.meta.MutableMeta
|
||||
import space.kscience.dataforge.meta.descriptors.MetaDescriptor
|
||||
import space.kscience.visionforge.VisionBase
|
||||
import space.kscience.visionforge.VisionChange
|
||||
|
||||
@Serializable
|
||||
@SerialName("solid")
|
||||
@ -14,9 +13,4 @@ public open class SolidBase : VisionBase(), Solid {
|
||||
override var properties: MutableMeta? = null
|
||||
|
||||
override val descriptor: MetaDescriptor get() = Solid.descriptor
|
||||
|
||||
override fun update(change: VisionChange) {
|
||||
updatePosition(change.properties)
|
||||
super.update(change)
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,7 @@ import info.laht.threekt.materials.Material
|
||||
import info.laht.threekt.materials.MeshBasicMaterial
|
||||
import info.laht.threekt.math.Color
|
||||
import info.laht.threekt.objects.Mesh
|
||||
import space.kscience.dataforge.meta.Meta
|
||||
import space.kscience.dataforge.meta.boolean
|
||||
import space.kscience.dataforge.meta.double
|
||||
import space.kscience.dataforge.meta.get
|
||||
import space.kscience.dataforge.meta.*
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.names.asName
|
||||
import space.kscience.dataforge.values.*
|
||||
@ -100,18 +97,23 @@ public object ThreeMaterials {
|
||||
/**
|
||||
* Compute color
|
||||
*/
|
||||
public fun Meta.threeColor(): Color = getValue(Name.EMPTY)?.let { value ->
|
||||
if (value.type == ValueType.NUMBER) {
|
||||
val int = value.int
|
||||
Color(int)
|
||||
public fun Meta.threeColor(): Color? {
|
||||
val value = getValue(Name.EMPTY)
|
||||
return if (isLeaf) {
|
||||
when {
|
||||
value == null -> null
|
||||
value === Null -> null
|
||||
value.type == ValueType.NUMBER -> Color(value.int)
|
||||
else -> Color(value.string)
|
||||
}
|
||||
} else {
|
||||
Color(value.string)
|
||||
Color(
|
||||
getValue(Colors.RED_KEY.asName())?.int ?: 0,
|
||||
getValue(Colors.GREEN_KEY.asName())?.int ?: 0,
|
||||
getValue(Colors.BLUE_KEY.asName())?.int ?: 0
|
||||
)
|
||||
}
|
||||
} ?: Color(
|
||||
getValue(Colors.RED_KEY.asName())?.int ?: 0,
|
||||
getValue(Colors.GREEN_KEY.asName())?.int ?: 0,
|
||||
getValue(Colors.BLUE_KEY.asName())?.int ?: 0
|
||||
)
|
||||
}
|
||||
|
||||
private var Material.cached: Boolean
|
||||
get() = userData["cached"] == true
|
||||
|
Loading…
Reference in New Issue
Block a user