From c7a374145ef3e69c78ebcfafd961349d00a53365 Mon Sep 17 00:00:00 2001 From: laura Date: Thu, 21 Nov 2024 12:30:33 +0100 Subject: [PATCH] 4.26.0-prerelease3 --- PRODUCT_RELEASE_NOTES.md | 6 +++ TEST_RELEASE_NOTES.md | 6 +++ aardium/package.json | 8 ++-- src/PRo3D.Core/Drawing/Drawing.Sg.fs | 2 +- src/PRo3D.Core/Surface-Model.fs | 18 ++++++++- src/PRo3D.Core/Surface.fs | 6 ++- src/PRo3D.Core/Surface/SurfaceApp.fs | 5 ++- src/PRo3D.Core/TransformationApp.fs | 10 +++-- src/PRo3D.Core/Traverse-Model.fs | 19 +++++++++ src/PRo3D.Viewer/Scene.fs | 2 +- src/PRo3D.Viewer/TraverseApp.fs | 6 ++- src/PRo3D.Viewer/Viewer/Viewer-Utils.fs | 8 +++- src/PRo3D.Viewer/Viewer/Viewer.fs | 52 ++++++++----------------- 13 files changed, 96 insertions(+), 52 deletions(-) diff --git a/PRODUCT_RELEASE_NOTES.md b/PRODUCT_RELEASE_NOTES.md index da845dfb..e5b5db29 100644 --- a/PRODUCT_RELEASE_NOTES.md +++ b/PRODUCT_RELEASE_NOTES.md @@ -1,3 +1,9 @@ +## 4.26.0-prerelease3 +- surface priority tested +- trajectories visibility priorities fixes +- trajectories line width adjustable +- bugfix: #439 surface jumping fixed by use of pivot + ## 4.26.0-prerelease1 - fixed surface priority - improved handling of large trajectories diff --git a/TEST_RELEASE_NOTES.md b/TEST_RELEASE_NOTES.md index 20d6657b..f823ddd9 100644 --- a/TEST_RELEASE_NOTES.md +++ b/TEST_RELEASE_NOTES.md @@ -1,3 +1,9 @@ +## 4.26.0-prerelease3 +- surface priority tested +- trajectories visibility priorities fixes +- trajectories line width adjustable +- bugfix: #439 surface jumping fixed by use of pivot + ## 4.26.0-prerelease2 - fixed surface priority - improved handling of large trajectories diff --git a/aardium/package.json b/aardium/package.json index 2c8b1a91..82c247ca 100644 --- a/aardium/package.json +++ b/aardium/package.json @@ -1,7 +1,7 @@ { "name": "PRo3D", "productName": "PRo3D.Viewer", - "version": "4.26.0-prerelease1", + "version": "4.26.0-prerelease3", "description": "PRo3D, short for Planetary Robotics 3D Viewer, is an interactive 3D visualization tool to allow planetary scientists to work with high-resolution 3D reconstructions of the Martian surface.", "license": "AGPL", "copyright": "VRVis Zentrum für Virtual Reality und Visualisierung Forschungs-GmbH", @@ -20,7 +20,7 @@ "dist:darwin:arm64": "bash ./signbuild.sh && electron-builder --c.buildVersion=$BUILD_VERSION --c.artifactName='${productName}-${buildVersion}-${arch}.${ext}' --publish always", "dist::win32": "electron-builder --c.buildVersion='%BUILD_VERSION%' --c.artifactName='${productName}-${buildVersion}-${arch}.${ext}' --publish always", "dist:linux:x64": "electron-builder --c.buildVersion=$BUILD_VERSION --c.artifactName='${productName}-${buildVersion}-${arch}.${ext}' --publish always" - }, + }, "main": "main.js", "repository": "https://github.com/electron/electron-quick-start", "dependencies": { @@ -31,7 +31,7 @@ "node-shared-mem": "1.0.12", "nodejs-websocket": "^1.7.2" }, - "devDependencies": { + "devDependencies": { "dotenv": "^16.0.0", "electron": "^18.1.0", "electron-builder": "^23.0.3", @@ -48,7 +48,7 @@ "win": { "icon": "build/icon.ico", "target": "nsis" - }, + }, "nsis": { "installerIcon": "build/icon.ico", "installerHeaderIcon": "build/icon.ico", diff --git a/src/PRo3D.Core/Drawing/Drawing.Sg.fs b/src/PRo3D.Core/Drawing/Drawing.Sg.fs index de2763fc..c90d9b47 100644 --- a/src/PRo3D.Core/Drawing/Drawing.Sg.fs +++ b/src/PRo3D.Core/Drawing/Drawing.Sg.fs @@ -568,7 +568,7 @@ module Sg = |> IndexedGeometryPrimitives.lines |> Sg.ofIndexedGeometry |> Sg.uniform "LineWidth" (AVal.constant width) - |> Sg.uniform "DepthOffset" (AVal.constant 0.0001) + |> Sg.uniform "DepthOffset"(AVal.constant 0.0000000001) |> Sg.blendMode (AVal.constant BlendMode.None) |> Sg.effect [ toEffect Aardvark.UI.Trafos.Shader.stableTrafo diff --git a/src/PRo3D.Core/Surface-Model.fs b/src/PRo3D.Core/Surface-Model.fs index 747bd007..6673ddb3 100644 --- a/src/PRo3D.Core/Surface-Model.fs +++ b/src/PRo3D.Core/Surface-Model.fs @@ -594,6 +594,22 @@ module Init = z = { translationInput with value = v.Z } value = v } + + let pivotInput = { + value = 0.0 + min = -10000000.0 + max = 10000000.0 + step = 0.001 + format = "{0:0.000}" + } + + let initPivot (v : V3d) = { + x = { pivotInput with value = v.X } + y = { pivotInput with value = v.Y } + z = { pivotInput with value = v.Z } + value = v + } + let transformations = { version = Transformations.current useTranslationArrows = false @@ -602,7 +618,7 @@ module Init = yaw = Transformations.Initial.yaw pitch = Transformations.Initial.pitch roll = Transformations.Initial.roll - pivot = initTranslation (V3d.OOO) + pivot = initPivot (V3d.OOO) oldPivot = V3d.OOO showPivot = false pivotChanged = false diff --git a/src/PRo3D.Core/Surface.fs b/src/PRo3D.Core/Surface.fs index 6e94fcd7..e066687c 100644 --- a/src/PRo3D.Core/Surface.fs +++ b/src/PRo3D.Core/Surface.fs @@ -224,7 +224,11 @@ module SurfaceIntersection = match observedSystem surf.guid, observerSystem with | Some observed, Some observer -> Some observed, Some observer | _ -> None, None - + //let sgSurf = activeSgSurfaces |> List.tryFind(fun sg -> sg.surface = surf.guid) + //let gBB = + // match sgSurf with + // | Some sg -> sg.globalBB.Center + // | None -> V3d.Zero let fullTrafo = TransformationApp.fullTrafo' surf.transformation refSys observedSystem observerSystem //SurfaceTransformations.fullTrafo' surf refSys //get bbs that are hit let hitBoxes = diff --git a/src/PRo3D.Core/Surface/SurfaceApp.fs b/src/PRo3D.Core/Surface/SurfaceApp.fs index 647339bd..77c2e8bb 100644 --- a/src/PRo3D.Core/Surface/SurfaceApp.fs +++ b/src/PRo3D.Core/Surface/SurfaceApp.fs @@ -55,7 +55,7 @@ module SurfaceUtils = /// creates a surface from opc folder path let mk (stype:SurfaceType) (preferredLoader : MeshLoaderType) (maxTriangleSize : float) path = - + let transform = Init.transformations let names = Files.getOPCNames path { version = Surface.current @@ -88,7 +88,8 @@ module SurfaceUtils = colorCorrection = Init.initColorCorrection homePosition = None - transformation = Init.transformations + + transformation = transform //{transform with pivot = V3d.Zero} opcxPath = None radiometry = Init.initRadiometry diff --git a/src/PRo3D.Core/TransformationApp.fs b/src/PRo3D.Core/TransformationApp.fs index 9e177fdc..133e8c07 100644 --- a/src/PRo3D.Core/TransformationApp.fs +++ b/src/PRo3D.Core/TransformationApp.fs @@ -166,6 +166,7 @@ module TransformationApp = let fullTrafo + //(bbCenter : V3d) (transform : AdaptiveTransformations) (refsys : AdaptiveReferenceSystem) (observedSystem : aval>) @@ -191,14 +192,15 @@ module TransformationApp = // getNorthAndUpFromPivot transf refSys // else // north, up, north.Cross(up) - - let newTrafo = calcFullTrafo translation yaw pitch roll (if usePivot then pivot else V3d.Zero) refSys observedSystem observerSystem scale mode + // (if (pivot = V3d.Zero) then bbCenter else pivot ) + let newTrafo = calcFullTrafo translation yaw pitch roll (if usePivot then pivot else V3d.Zero) refSys observedSystem observerSystem scale mode // return newTrafo } let fullTrafo' (transform : Transformations) + //(bbCenter : V3d) (refsys : ReferenceSystem) (observedSystem : Option) (observerSystem : Option) = @@ -208,7 +210,7 @@ module TransformationApp = // getNorthAndUpFromPivot transform refsys // else // refsys.northO, refsys.up.value, refsys.northO.Cross(refsys.up.value) - + //let pivot = (if (transform.pivot.value = V3d.Zero) then bbCenter else transform.pivot.value ) calcFullTrafo transform.translation.value transform.yaw.value @@ -291,7 +293,7 @@ module TransformationApp = let p' = Vector3d.update model.pivot p //let m' = updateTransformationForNewPivot model //{ m' with pivot = p'; oldPivot = p'.value; trafoChanged = false} - let fulTrafo : Trafo3d = fullTrafo' model refSys None None + //let fulTrafo : Trafo3d = fullTrafo' model refSys None None { model with pivot = p'; oldPivot = p'.value; trafoChanged = false} else model | SetPickedPivotPoint p -> // world space....... diff --git a/src/PRo3D.Core/Traverse-Model.fs b/src/PRo3D.Core/Traverse-Model.fs index 5587b989..cbc4cba6 100644 --- a/src/PRo3D.Core/Traverse-Model.fs +++ b/src/PRo3D.Core/Traverse-Model.fs @@ -18,6 +18,7 @@ type TraversePropertiesAction = | ToggleShowDots | SetTraverseName of string | SetSolTextsize of Numeric.Action + | SetLineWidth of Numeric.Action | SetTraverseColor of ColorPicker.Action type TraverseAction = @@ -41,6 +42,13 @@ module InitTraverseParams = step = 0.001 format = "{0:0.000}" } + let tLineW (w : float) = + { value = w + min = 0.001 + max = 10.0 + step = 0.001 + format = "{0:0.000}" } + type Sol = { version: int @@ -137,6 +145,7 @@ type Traverse = showLines: bool showText: bool tTextSize: NumericInput + tLineWidth: NumericInput showDots: bool isVisibleT: bool color: ColorInput } @@ -174,6 +183,7 @@ module Traverse = showLines = true showText = false tTextSize = InitTraverseParams.tText + tLineWidth = InitTraverseParams.tLineW 1.5 showDots = false isVisibleT = true color = { c = C4b.White } @@ -198,6 +208,7 @@ module Traverse = showLines = showLines showText = showText tTextSize = InitTraverseParams.tText + tLineWidth = InitTraverseParams.tLineW 1.5 showDots = showDots isVisibleT = true color = { c = C4b.White } } @@ -211,10 +222,16 @@ module Traverse = let! showLines = Json.read "showLines" let! showText = Json.read "showText" let! tTextSize = Json.readWith Ext.fromJson "tTextSize" + let! tLWidth = Json.tryRead "tLineWidth" let! showDots = Json.read "showDots" let! isVisibleT = Json.read "isVisibleT" let! color = Json.readWith Ext.fromJson "color" + let tLineWidth = + match tLWidth with + | Some w -> InitTraverseParams.tLineW w + | None -> InitTraverseParams.tLineW 1.5 + return { version = current guid = guid |> Guid @@ -224,6 +241,7 @@ module Traverse = showLines = showLines showText = showText tTextSize = tTextSize + tLineWidth = tLineWidth showDots = showDots isVisibleT = isVisibleT color = color } @@ -253,6 +271,7 @@ type Traverse with do! Json.write "showDots" x.showDots do! Json.write "isVisibleT" x.isVisibleT do! Json.writeWith (Ext.toJson) "color" x.color + do! Json.write "tLineWidth" x.tLineWidth.value } [] diff --git a/src/PRo3D.Viewer/Scene.fs b/src/PRo3D.Viewer/Scene.fs index c760077d..d156d9d1 100644 --- a/src/PRo3D.Viewer/Scene.fs +++ b/src/PRo3D.Viewer/Scene.fs @@ -183,7 +183,7 @@ module SceneLoader = |> Sg.createSgSurfaces runtime signature |> HashMap.union m.scene.surfacesModel.sgSurfaces |> Files.expandLazyKdTreePaths m.scene.scenePath surfaceMap - |> (flip <| Optic.set (_surfaceModelLens >-> SurfaceModel.sgSurfaces_)) m + |> (flip <| Optic.set (_surfaceModelLens >-> SurfaceModel.sgSurfaces_)) m m.scene.surfacesModel |> SurfaceModel.triggerSgGrouping diff --git a/src/PRo3D.Viewer/TraverseApp.fs b/src/PRo3D.Viewer/TraverseApp.fs index 8e86a857..7e5e6cb1 100644 --- a/src/PRo3D.Viewer/TraverseApp.fs +++ b/src/PRo3D.Viewer/TraverseApp.fs @@ -62,6 +62,8 @@ module TraversePropertiesApp = { model with tTextSize = Numeric.update model.tTextSize s} | SetTraverseColor tc -> { model with color = ColorPicker.update model.color tc } + | SetLineWidth w -> + { model with tLineWidth = Numeric.update model.tLineWidth w} let computeSolRotation (sol : Sol) (referenceSystem : ReferenceSystem) : Trafo3d = @@ -112,6 +114,7 @@ module TraversePropertiesApp = Html.row "Show Lines:" [GuiEx.iconCheckBox m.showLines ToggleShowLines] Html.row "Show Dots:" [GuiEx.iconCheckBox m.showDots ToggleShowDots] Html.row "Color:" [ColorPicker.view m.color |> UI.map SetTraverseColor ] + Html.row "Linewidth:" [Numeric.view' [NumericInputType.InputBox] m.tLineWidth |> UI.map SetLineWidth ] ] ) @@ -580,11 +583,12 @@ module TraverseApp = adaptive { let! sols = model.sols let! c = model.color.c + let! w = model.tLineWidth.value let lines = sols |> List.map(fun x -> x.location) |> List.toArray - |> PRo3D.Core.Drawing.Sg.lines c 2.0 + |> PRo3D.Core.Drawing.Sg.lines c w return lines } diff --git a/src/PRo3D.Viewer/Viewer/Viewer-Utils.fs b/src/PRo3D.Viewer/Viewer/Viewer-Utils.fs index aee63684..6101d36c 100644 --- a/src/PRo3D.Viewer/Viewer/Viewer-Utils.fs +++ b/src/PRo3D.Viewer/Viewer/Viewer-Utils.fs @@ -197,12 +197,14 @@ module ViewerUtils = let getLodParameters (surf:aval) + (globalBB : aval) (refsys:AdaptiveReferenceSystem) (observedSystem : aval>) (observerSystem : aval>) (frustum : aval) = adaptive { let! s = surf + let! gBB = globalBB let! frustum = frustum let sizes = V2i(1024,768) let! quality = s.quality.value @@ -308,6 +310,7 @@ module ViewerUtils = let trafo = adaptive { + let! gBB = globalBB let! fullTrafo = TransformationApp.fullTrafo surf.transformation refsys observedSystem observerSystem let! preTransform = surf.preTransform let! flipZ = surf.transformation.flipZ @@ -436,7 +439,7 @@ module ViewerUtils = |> Sg.noEvents |> Sg.texture (Sym.ofString "ColorMapTexture") (AVal.constant colormap) |> Sg.texture (Sym.ofString "FootPrintTexture") fp.projTex - |> Sg.LodParameters ( getLodParameters (AVal.constant surf) refsys observedSystem observerSystem frustum ) + |> Sg.LodParameters ( getLodParameters (AVal.constant surf) globalBB refsys observedSystem observerSystem frustum ) |> Sg.AttributeParameters( attributeParameters (AVal.constant surf) ) |> SecondaryTexture.Sg.applySecondaryTextureId ( @@ -545,6 +548,7 @@ module ViewerUtils = let trafo = adaptive { + let! gBB = surface.globalBB let! fullTrafo = TransformationApp.fullTrafo surf.transformation refsys observedSystem observerSystem let! preTransform = surf.preTransform let! flipZ = surf.transformation.flipZ @@ -593,7 +597,7 @@ module ViewerUtils = |> Sg.trafo trafo |> Sg.uniform "TriangleSize" triangleFilter |> Sg.onOff (surf.isVisible) - |> Sg.LodParameters( getLodParameters (AVal.constant surf) refsys observedSystem observerSystem frustum ) + |> Sg.LodParameters( getLodParameters (AVal.constant surf) surface.globalBB refsys observedSystem observerSystem frustum ) |> Sg.noEvents |> Sg.effect [ triangleFilterX |> toEffect diff --git a/src/PRo3D.Viewer/Viewer/Viewer.fs b/src/PRo3D.Viewer/Viewer/Viewer.fs index 3a4a88a1..fd71955b 100644 --- a/src/PRo3D.Viewer/Viewer/Viewer.fs +++ b/src/PRo3D.Viewer/Viewer/Viewer.fs @@ -429,7 +429,7 @@ module ViewerApp = let surface = m.scene.surfacesModel.surfaces.flat |> HashMap.find id |> Leaf.toSurface let observedSystem = Gis.GisApp.getSpiceReferenceSystem m.scene.gisApp id let observerSystem = Gis.GisApp.getObserverSystem m.scene.gisApp - let fullTrafo = TransformationApp.fullTrafo' surface.transformation m.scene.referenceSystem observedSystem observerSystem //SurfaceTransformations.fullTrafo' surface m.scene.referenceSystem + //SurfaceTransformations.fullTrafo' surface m.scene.referenceSystem match surface.homePosition with | Some hp -> let animationMessage = @@ -438,6 +438,7 @@ module ViewerApp = | None -> match surf with | Some s -> + let fullTrafo = TransformationApp.fullTrafo' surface.transformation m.scene.referenceSystem observedSystem observerSystem let bb = s.globalBB.Transformed(fullTrafo.Forward) let view = CameraView.lookAt bb.Max bb.Center m.scene.referenceSystem.up.value let animationMessage = @@ -1888,15 +1889,12 @@ module ViewerApp = m.scene.referenceSystem let traverse = - [ - TraverseApp.Sg.viewLines m.scene.traverses - TraverseApp.Sg.viewText - view - m.scene.config.nearPlane.value - m.scene.traverses - ] - |> Sg.ofList + TraverseApp.Sg.viewText + view + m.scene.config.nearPlane.value + m.scene.traverses |> Sg.map TraverseMessage + [ exploreCenter; refSystem; @@ -1943,12 +1941,16 @@ module ViewerApp = mrefConfig m.scene.referenceSystem |> Sg.map ScaleBarsMessage - - let traverses = - TraverseApp.Sg.view - m.navigation.camera.view - m.scene.referenceSystem - m.scene.traverses + + let traverses = + [ + TraverseApp.Sg.viewLines m.scene.traverses + TraverseApp.Sg.view + view //m.navigation.camera.view + m.scene.referenceSystem + m.scene.traverses + ] + |> Sg.ofList |> Sg.map TraverseMessage [ @@ -2027,16 +2029,6 @@ module ViewerApp = // m.correlationPlot // (allowLogPicking m) - //let traverse = - // [ - // TraverseApp.Sg.viewLines m.scene.traverses - // TraverseApp.Sg.viewText - // m.navigation.camera.view - // m.scene.config.nearPlane.value - // m.scene.traverses - // ] - // |> Sg.ofList - // |> Sg.map TraverseMessage let heightValidation = HeightValidatorApp.view m.heighValidation |> Sg.map HeightValidation @@ -2047,9 +2039,7 @@ module ViewerApp = [ overL; viewPlans; - // solText; heightValidation; - //traverse //gisEntities ] |> Sg.ofList // (correlationLogs |> Sg.map CorrelationPanelMessage); (finishedLogs |> Sg.map CorrelationPanelMessage)] |> Sg.ofList // (*;orientationCube*) //solText @@ -2095,13 +2085,6 @@ module ViewerApp = |> Sg.map GeologicSurfacesMessage - //let traverses = - // TraverseApp.Sg.view - // m.navigation.camera.view - // m.scene.referenceSystem - // m.scene.traverses - // |> Sg.map TraverseMessage - let depthTested = [ // linkingSg; @@ -2110,7 +2093,6 @@ module ViewerApp = heightValidationDiscs; sceneObjects; geologicSurfacesSg - //traverses gisEntities ] |> Sg.ofList