Skip to content

Commit

Permalink
Merge pull request #566 from scenerygraphics/add-object-fixes
Browse files Browse the repository at this point in the history
Fixes for add object errors
  • Loading branch information
kephale authored Mar 9, 2024
2 parents 3c528dd + 7d06e24 commit 50b2036
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ dependencies {
implementation("net.imagej:imagej-ops")
// implementation("net.imagej:imagej-launcher")
implementation("net.imagej:imagej-ui-swing")
// implementation("net.imagej:imagej-legacy")
implementation("net.imagej:imagej-legacy")
implementation("io.scif:scifio")
implementation("io.scif:scifio-bf-compat")

Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/sc/iview/SciView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import bvv.core.VolumeViewerOptions
import dev.dirs.ProjectDirectories
import graphics.scenery.*
import graphics.scenery.Scene.RaycastResult
import graphics.scenery.attribute.material.Material
import graphics.scenery.backends.Renderer
import graphics.scenery.backends.vulkan.VulkanRenderer
import graphics.scenery.controls.InputHandler
Expand Down Expand Up @@ -663,6 +664,7 @@ class SciView : SceneryBase, CalibratedRealInterval<CalibratedAxis> {
ambient = Vector3f(1.0f, 0.0f, 0.0f)
diffuse = Utils.convertToVector3f(color)
specular = Vector3f(1.0f, 1.0f, 1.0f)
cullingMode = Material.CullingMode.None
}
cyl.name = generateUniqueName("Cylinder")
return addNode(cyl, block = block)
Expand All @@ -683,6 +685,7 @@ class SciView : SceneryBase, CalibratedRealInterval<CalibratedAxis> {
ambient = Vector3f(1.0f, 0.0f, 0.0f)
diffuse = Utils.convertToVector3f(color)
specular = Vector3f(1.0f, 1.0f, 1.0f)
cullingMode = Material.CullingMode.None
}
cone.name = generateUniqueName("Cone")
return addNode(cone, block = block)
Expand Down
8 changes: 1 addition & 7 deletions src/main/kotlin/sc/iview/commands/add/AddCylinder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import sc.iview.commands.MenuWeights.ADD
import sc.iview.commands.MenuWeights.EDIT_ADD_CYLINDER

/**
* Command to add a box to the scene
* Command to add a cylinder to the scene
*
* @author Jan Tiemann
*/
Expand All @@ -52,14 +52,9 @@ import sc.iview.commands.MenuWeights.EDIT_ADD_CYLINDER
)]
)
class AddCylinder : Command {

@Parameter
private lateinit var sciView: SciView

// FIXME
// @Parameter
// private String position = "0; 0; 0";

@Parameter
private var height = 1.0f

Expand All @@ -70,7 +65,6 @@ class AddCylinder : Command {
private var color: ColorRGB = SciView.DEFAULT_COLOR;

override fun run() {
//final Vector3 pos = ClearGLVector3.parse( position );
val pos = Vector3f(0f, 0f, 0f)

sciView.addCylinder(pos,radius,height,color,20)
Expand Down
15 changes: 6 additions & 9 deletions src/main/kotlin/sc/iview/commands/add/AddOrientationCompass.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,16 @@ class AddOrientationCompass : Command {
private lateinit var sciView: SciView

@Parameter
private val axisLength = 0.1f
private var axisLength = 0.1f

@Parameter
private val AXESBARRADIUS = 0.001f
private var AXESBARRADIUS = 0.001f

@Parameter
private val xColor = Vector3f(1f, 0f, 0f)

@Parameter
private val yColor = Vector3f(0f, 1f, 0f)
private var xColor = Vector3f(1f, 0f, 0f)

@Parameter
private val zColor = Vector3f(0f, 0f, 1f)
private var yColor = Vector3f(0f, 1f, 0f)

private var zColor = Vector3f(0f, 0f, 1f)
private fun makeAxis(axisLength: Float, angleX: Float, angleY: Float, angleZ: Float, color: Vector3f): Node {
val axisNode = Cylinder(AXESBARRADIUS, axisLength, 4)
axisNode.name = "compass axis: X"
Expand Down
5 changes: 3 additions & 2 deletions src/main/kotlin/sc/iview/commands/add/AddPointLight.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ import sc.iview.commands.MenuWeights.EDIT_ADD_POINTLIGHT
)
class AddPointLight : Command {
@Parameter
private val sciView: SciView? = null
private lateinit var sciView: SciView

override fun run() {
sciView!!.addPointLight()
sciView.addPointLight()
}
}

0 comments on commit 50b2036

Please sign in to comment.