forked from kscience/visionforge
Fixed rotation order in composites
This commit is contained in:
parent
39ca362aa8
commit
255261e789
@ -8,9 +8,11 @@ import hep.dataforge.names.toName
|
|||||||
import hep.dataforge.vis.common.Colors
|
import hep.dataforge.vis.common.Colors
|
||||||
import hep.dataforge.vis.common.VisualObject
|
import hep.dataforge.vis.common.VisualObject
|
||||||
import hep.dataforge.vis.common.applyStyle
|
import hep.dataforge.vis.common.applyStyle
|
||||||
|
import hep.dataforge.vis.spatial.RotationOrder
|
||||||
import hep.dataforge.vis.spatial.VisualGroup3D
|
import hep.dataforge.vis.spatial.VisualGroup3D
|
||||||
import hep.dataforge.vis.spatial.VisualObject3D
|
import hep.dataforge.vis.spatial.VisualObject3D
|
||||||
import hep.dataforge.vis.spatial.VisualObject3D.Companion.COLOR_KEY
|
import hep.dataforge.vis.spatial.VisualObject3D.Companion.COLOR_KEY
|
||||||
|
import hep.dataforge.vis.spatial.rotationOrder
|
||||||
import scientifik.gdml.*
|
import scientifik.gdml.*
|
||||||
import kotlin.collections.set
|
import kotlin.collections.set
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
@ -88,6 +90,7 @@ class GDMLTransformer(val root: GDML) {
|
|||||||
styles.forEach {
|
styles.forEach {
|
||||||
final.setStyle(it.key, it.value)
|
final.setStyle(it.key, it.value)
|
||||||
}
|
}
|
||||||
|
final.rotationOrder = RotationOrder.ZXY
|
||||||
onFinish(this@GDMLTransformer)
|
onFinish(this@GDMLTransformer)
|
||||||
return final
|
return final
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ private fun VisualObject3D.withPosition(
|
|||||||
this@withPosition.rotationX = rotation.x()
|
this@withPosition.rotationX = rotation.x()
|
||||||
this@withPosition.rotationY = rotation.y()
|
this@withPosition.rotationY = rotation.y()
|
||||||
this@withPosition.rotationZ = rotation.z()
|
this@withPosition.rotationZ = rotation.z()
|
||||||
this@withPosition.rotationOrder = RotationOrder.ZXY
|
//this@withPosition.rotationOrder = RotationOrder.ZXY
|
||||||
}
|
}
|
||||||
scale?.let {
|
scale?.let {
|
||||||
this@withPosition.scaleX = scale.x.toFloat()
|
this@withPosition.scaleX = scale.x.toFloat()
|
||||||
|
@ -11,9 +11,9 @@ import info.laht.threekt.objects.Mesh
|
|||||||
class ThreeCompositeFactory(val three: ThreePlugin) : MeshThreeFactory<Composite>(Composite::class) {
|
class ThreeCompositeFactory(val three: ThreePlugin) : MeshThreeFactory<Composite>(Composite::class) {
|
||||||
|
|
||||||
override fun buildGeometry(obj: Composite): BufferGeometry {
|
override fun buildGeometry(obj: Composite): BufferGeometry {
|
||||||
val first = three.buildObject3D(obj.first) as? Mesh ?: error("First part of composite is not a mesh")
|
val first = three.buildObject3D(obj.first.apply { parent = obj.parent }) as? Mesh ?: error("First part of composite is not a mesh")
|
||||||
first.updateMatrix()
|
first.updateMatrix()
|
||||||
val second = three.buildObject3D(obj.second) as? Mesh ?: error("Second part of composite is not a mesh")
|
val second = three.buildObject3D(obj.second.apply { parent = obj.parent }) as? Mesh ?: error("Second part of composite is not a mesh")
|
||||||
second.updateMatrix()
|
second.updateMatrix()
|
||||||
val firstCSG = CSG.fromMesh(first)
|
val firstCSG = CSG.fromMesh(first)
|
||||||
val secondCSG = CSG.fromMesh(second)
|
val secondCSG = CSG.fromMesh(second)
|
||||||
|
Loading…
Reference in New Issue
Block a user