Roll back to basic three renderer for examples
This commit is contained in:
parent
b0cd80a4e6
commit
230cd5dc61
@ -1,10 +1,10 @@
|
||||
import space.kscience.dataforge.misc.DFExperimental
|
||||
import space.kscience.visionforge.plotly.PlotlyPlugin
|
||||
import space.kscience.visionforge.ring.ThreeWithControlsPlugin
|
||||
import space.kscience.visionforge.runVisionClient
|
||||
import space.kscience.visionforge.solid.three.ThreePlugin
|
||||
|
||||
@DFExperimental
|
||||
fun main() = runVisionClient {
|
||||
plugin(PlotlyPlugin)
|
||||
plugin(ThreeWithControlsPlugin)
|
||||
plugin(ThreePlugin)
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package space.kscience.visionforge.examples
|
||||
|
||||
import kotlinx.html.div
|
||||
import kotlinx.html.h1
|
||||
import space.kscience.dataforge.context.Context
|
||||
import space.kscience.visionforge.html.ResourceLocation
|
||||
@ -19,6 +20,7 @@ fun main() {
|
||||
resourceLocation = ResourceLocation.EMBED
|
||||
) {
|
||||
h1 { +"Happy new year!" }
|
||||
div {
|
||||
vision {
|
||||
solid {
|
||||
repeat(100) {
|
||||
@ -28,7 +30,6 @@ fun main() {
|
||||
z = random.nextDouble(-300.0, 300.0)
|
||||
material {
|
||||
color(random.nextInt())
|
||||
specularColor(random.nextInt())
|
||||
}
|
||||
detail = 16
|
||||
}
|
||||
@ -37,3 +38,4 @@ fun main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -59,12 +59,12 @@ public object ThreeMaterials {
|
||||
private val materialCache = HashMap<Meta, Material>()
|
||||
|
||||
internal fun buildMaterial(meta: Meta): Material {
|
||||
return if (meta[SolidMaterial.SPECULAR_COLOR_KEY] != null) {
|
||||
return meta[SolidMaterial.SPECULAR_COLOR_KEY]?.let { specularColor ->
|
||||
MeshPhongMaterial().apply {
|
||||
color = meta[SolidMaterial.COLOR_KEY]?.getColor() ?: DEFAULT_COLOR
|
||||
specular = meta[SolidMaterial.SPECULAR_COLOR_KEY]!!.getColor()
|
||||
specular = specularColor.getColor()
|
||||
emissive = specular
|
||||
reflectivity = 1.0
|
||||
reflectivity = 0.5
|
||||
refractionRatio = 1.0
|
||||
shininess = 100.0
|
||||
opacity = meta[SolidMaterial.OPACITY_KEY]?.double ?: 1.0
|
||||
@ -72,15 +72,14 @@ public object ThreeMaterials {
|
||||
wireframe = meta[SolidMaterial.WIREFRAME_KEY].boolean ?: false
|
||||
needsUpdate = true
|
||||
}
|
||||
} else {
|
||||
MeshBasicMaterial().apply {
|
||||
} ?: MeshBasicMaterial().apply {
|
||||
color = meta[SolidMaterial.COLOR_KEY]?.getColor() ?: DEFAULT_COLOR
|
||||
opacity = meta[SolidMaterial.OPACITY_KEY]?.double ?: 1.0
|
||||
transparent = opacity < 1.0
|
||||
wireframe = meta[SolidMaterial.WIREFRAME_KEY].boolean ?: false
|
||||
needsUpdate = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal fun cacheMaterial(meta: Meta): Material = materialCache.getOrPut(meta) {
|
||||
|
Loading…
Reference in New Issue
Block a user