forked from kscience/visionforge
Full BM@N geometry
This commit is contained in:
parent
b50a9c590f
commit
8d7eb2c1a9
@ -24,6 +24,7 @@ private fun VisualObject3D.withPosition(
|
||||
this@withPosition.rotationX = rotation.x()
|
||||
this@withPosition.rotationY = rotation.y()
|
||||
this@withPosition.rotationZ = rotation.z()
|
||||
this@withPosition.rotationOrder=RotationOrder.ZXY
|
||||
}
|
||||
scale?.let {
|
||||
this@withPosition.scaleX = scale.x.toFloat()
|
||||
|
@ -102,7 +102,11 @@ private class GDMLDemoApp : ApplicationBase() {
|
||||
|
||||
}
|
||||
launch { message("Rendering") }
|
||||
val output = three.output(canvas)
|
||||
val output = three.output(canvas){
|
||||
"axis" to {
|
||||
"size" to 100
|
||||
}
|
||||
}
|
||||
output.render(visual)
|
||||
launch {
|
||||
message(null)
|
||||
|
@ -33,7 +33,7 @@ class Tube(
|
||||
require(radius > 0)
|
||||
require(height > 0)
|
||||
require(innerRadius >= 0)
|
||||
require(startAngle >= 0)
|
||||
//require(startAngle >= 0)
|
||||
require(angle in (0f..(PI2)))
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ enum class RotationOrder {
|
||||
*/
|
||||
var VisualObject3D.rotationOrder: RotationOrder
|
||||
get() = getProperty(VisualObject3D.rotationOrder).enum<RotationOrder>() ?: RotationOrder.XYZ
|
||||
set(value) = setProperty(VisualObject3D.rotationOrder, value)
|
||||
set(value) = setProperty(VisualObject3D.rotationOrder, value.name)
|
||||
|
||||
|
||||
/**
|
||||
@ -191,7 +191,7 @@ var VisualObject3D.rotationY: Number
|
||||
get() = rotation?.y ?: 0f
|
||||
set(value) {
|
||||
rotation().y = value.toDouble()
|
||||
propertyChanged(VisualObject3D.xRotation)
|
||||
propertyChanged(VisualObject3D.yRotation)
|
||||
}
|
||||
|
||||
var VisualObject3D.rotationZ: Number
|
||||
|
@ -37,13 +37,12 @@ interface ThreeFactory<T : VisualObject3D> {
|
||||
*/
|
||||
internal fun Object3D.updatePosition(obj: VisualObject3D) {
|
||||
visible = obj.visible ?: true
|
||||
// Matrix4().apply {
|
||||
// makeRotationFromEuler(obj.euler)
|
||||
// applyMatrix(this)
|
||||
// makeTranslation(obj.x.toDouble(), obj.y.toDouble(), obj.z.toDouble())
|
||||
// applyMatrix(this)
|
||||
// }
|
||||
position.set(obj.x, obj.y, obj.z)
|
||||
// obj.rotation?.let{
|
||||
// rotateZ(it.z)
|
||||
// rotateX(it.x)
|
||||
// rotateY(it.y)
|
||||
// }
|
||||
setRotationFromEuler(obj.euler)
|
||||
scale.set(obj.scaleX, obj.scaleY, obj.scaleZ)
|
||||
updateMatrix()
|
||||
|
@ -21,8 +21,8 @@ class ThreeOutput(val three: ThreePlugin, val meta: Meta = EmptyMeta) : Output<V
|
||||
|
||||
val scene: Scene = Scene().apply {
|
||||
add(AmbientLight())
|
||||
if (meta["axis"] != null) {
|
||||
val axesHelper = AxesHelper(meta["axis.size"].int ?: 1)
|
||||
meta["axis"]?.let {
|
||||
val axesHelper = AxesHelper(it.node["size"].int ?: 1)
|
||||
add(axesHelper)
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,9 @@ import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.math.*
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
import kotlin.random.Random
|
||||
|
||||
|
||||
@ -123,7 +125,9 @@ private class ThreeDemoApp : ApplicationBase() {
|
||||
demo("CSG.custom", "CSG with manually created object") {
|
||||
intersect {
|
||||
box(100, 100, 100)
|
||||
tube(60,10)
|
||||
tube(60, 10) {
|
||||
detail = 180
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user