Skip to content

Commit

Permalink
[Viewer] parts filter
Browse files Browse the repository at this point in the history
  • Loading branch information
aszabo314 committed Nov 27, 2023
1 parent 0129d56 commit 947a836
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
14 changes: 11 additions & 3 deletions src/Aardvark.Rendering.PointSet/LodTreeSceneGraph.fs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,13 @@ module private DeferredPointSetShaders =
let mutable color = v.col
if not uniform?ShowColors then
color <- mapColors.[(v.partIndex+11)%11]
return { v with col = color }
let filteredPartIndex : int = uniform?FilterPartIndex
if filteredPartIndex < 0 || v.partIndex = filteredPartIndex then
return { v with col = color }
else
return {v with col = V4d.OOOO; pos = V4d(-999.0,-999.0,-999.0,-999.0); ps=0.0; vp = V4d(-999.0,-999.0,-999.0,-999.0)}
else
return v
}

let lodPointSize (v : PointVertex) =
Expand Down Expand Up @@ -761,7 +767,8 @@ type PointSetRenderConfig =

module Sg =

let pointSets (config : PointSetRenderConfig) (pointClouds : aset<LodTreeInstance>) =

let pointSetsFilter (config : PointSetRenderConfig) (pointClouds : aset<LodTreeInstance>) (filterPartIndex : aval<int>)=
let runtime = config.runtime

let largeSize =
Expand Down Expand Up @@ -817,6 +824,7 @@ module Sg =
|> Sg.uniform "ShowColors" config.colors
|> Sg.uniform "PointSize" config.pointSize
|> Sg.uniform "ViewportSize" largeSize
|> Sg.uniform "FilterPartIndex" filterPartIndex
|> Sg.viewTrafo config.viewTrafo
|> Sg.projTrafo largeProj
|> Sg.compile runtime signature
Expand Down Expand Up @@ -1011,4 +1019,4 @@ module Sg =

finalSg


let pointSets config pointClouds = pointSetsFilter config pointClouds (AVal.constant -1)
1 change: 1 addition & 0 deletions src/Apps/Viewer/CmdLine.fs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ module CmdLine =
.WithKey(id)
.WithVerbose(true)
.WithMaxChunkPointCount(10000000)
.WithPartIndexOffset(0)
//.WithMinDist(0.005)
//.WithNormalizePointDensityGlobal(true)
//.WithMinDist(match args.minDist with | None -> 0.0 | Some x -> x)
Expand Down
6 changes: 3 additions & 3 deletions src/Apps/Viewer/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ open Aardvark.Algodat.App.Viewer

[<EntryPoint>]
let main args =
//let pts = @"C:\bla\TEST DATEI_resampled.laz"
//import pts @"C:\bla\TestdateiStore\data.uds" "a" (Args.parse [||])
//let pts = @"C:\bla\pts\lowergetikum 20230321.e57"
//import pts @"C:\bla\store\lowergetikum\data.bin" "a" (Args.parse [||])
//exit 0

//view @"C:\stores\innen_store" ["a2b7e0c1-e672-48d3-8958-9ff8678f2dc4"] (Args.parse [||])
//view @"C:\Users\sm\Downloads\C_31EN2.LAZ.store" [File.readAllText @"C:\Users\sm\Downloads\C_31EN2.LAZ.key"] (Args.parse [||])
//view @"C:\Users\sm\Downloads\C_30DN2.LAZ.store" [File.readAllText @"C:\Users\sm\Downloads\C_30DN2.LAZ.key"] (Args.parse [||])
//view @"C:\Users\sm\Downloads\test.store" ["128330b1-8761-4a07-b160-76bcd7e2f70a"; "ab2f6f76-7eae-47c9-82d1-ad28b816abb9"] (Args.parse [||])

let store = @"W:\Datasets\Vgm\Stores\erdgeschoss.e57_0.0025\data.uds"
let store = @"C:\bla\store\lowergetikum\data.bin"
let key = Path.combine [System.IO.Path.GetDirectoryName store;"key.txt"] |> File.readAllText
view store [key] (Args.parse [||])

Expand Down
11 changes: 9 additions & 2 deletions src/Apps/Viewer/Rendering.fs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ module Rendering =
let p = (frustum |> AVal.map Frustum.projTrafo)

let reset = AVal.init 0
let filterPartIndex = AVal.init -1

//let filter : ModRef<Option<Hull3d>> = AVal.init None

let instances = pcs |> ASet.mapA (fun a -> a :> aval<_>)
Expand Down Expand Up @@ -203,7 +205,9 @@ module Rendering =
pickCallback = Some pick
}

let sg = Sg.pointSets renderConfig instances
let sg =
Sg.pointSetsFilter renderConfig instances filterPartIndex

let sg =
sg
|> Sg.andAlso cfg
Expand Down Expand Up @@ -332,7 +336,10 @@ module Rendering =

| Keys.D2 -> transact (fun () -> config.ssaoSharpness.Value <- min 4.0 (config.ssaoSharpness.Value + 0.1)); Log.line "sharpness: %A" config.ssaoSharpness.Value
| Keys.D1 -> transact (fun () -> config.ssaoSharpness.Value <- max 0.01 (config.ssaoSharpness.Value - 0.1)); Log.line "sharpness: %A" config.ssaoSharpness.Value


| Keys.F4 -> transact (fun _ -> filterPartIndex.Value <- -1); Log.line $"PartFilter {filterPartIndex.Value}"
| Keys.F5 -> transact (fun _ -> filterPartIndex.Value <- max (filterPartIndex.Value-1) -1); Log.line $"PartFilter {filterPartIndex.Value}"
| Keys.F6 -> transact (fun _ -> filterPartIndex.Value <- filterPartIndex.Value+1); Log.line $"PartFilter {filterPartIndex.Value}"
| Keys.L ->
transact (fun () ->
config.lighting.Value <- not config.lighting.Value
Expand Down

0 comments on commit 947a836

Please sign in to comment.