Skip to content

Commit

Permalink
Const tile grid count (#2)
Browse files Browse the repository at this point in the history
* prove out the nested tile rendering system

* update README
  • Loading branch information
kurtlawrence authored Jul 1, 2023
1 parent 0b6def1 commit 985c217
Show file tree
Hide file tree
Showing 18 changed files with 842 additions and 594 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
/dist
/target
/pkg
/wasmpkg
/wasm-pack.log
/elm-stuff
/js/viewer-ui.js
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ crate-type = ["cdylib", "rlib"]
path = "rust/lib.rs"

[features]
default = ["console_error_panic_hook"]
err-capture = ["dep:console_error_panic_hook"]

[dependencies]
geom = { git = "https://github.com/kurtlawrence/geom", branch = "fork=dirtvz", features = ["js"] }
# geom = { path = "../geom", features = ["js"] }
rustc-hash = "1"
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = ["console"]}
Expand All @@ -21,7 +22,7 @@ web-sys = { version = "0.3", features = ["console"]}
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.6", optional = true }
console_error_panic_hook = { version = "0.1", optional = true }

# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
Expand All @@ -30,6 +31,8 @@ wee_alloc = { version = "0.4.5", optional = true }

[dev-dependencies]
wasm-bindgen-test = "0.3.13"
quickcheck = "1"
quickcheck_macros = "1"

[profile.release]
# Tell `rustc` to optimize for small code size.
Expand Down
2 changes: 1 addition & 1 deletion Notes/DEPLOY.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Note that this operation is _destructive_ so it is recommended to be done in a s

Follow [Production Building](#Production-Building).

**Step 2. Remove all but the `dist/` folder**
**Step 2. Deploy on `app-site` branch**

```sh
mkdir tmp-dirtvz-app-push
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

_Web-based, high performance 3D renderer for the mining industry._


- [App 🔎⛰🔍](https://kurtlawrence.github.io/dirtvz/)

Dirtvz is an experimental web-based 3D renderer targeted specifically at the dataset common within
Expand All @@ -15,6 +16,8 @@ Dirtvz aims to be both a utility and a practical research project. As web-based
continues to improve, dirtvz aims to explore the practical challenges and present solutions which
can be extended to other projects.

> 🧪 `dirtvz` is in a highly experimental stage, focused on prototyping technologies and
> techniques to enable high performance rendering of large mining datasets through the browser.
> Please note that dirtvz is is in very early stages of prototyping and there are no stability
> guarantees. The included app is still very rudimentary and support for various objects is
> limited.
Expand All @@ -41,15 +44,22 @@ As the project matures, Github issues will be adopted more formally.
- [ ] `p` for plan view (top down), `p` again to north up, `p` again to reset view
- [ ] UI toggle for invert mouse scroll
- [ ] UI help for interactions
- [ ] dynamic filtering tile/lod
- [x] dynamic filtering tile/lod
- [ ] apply pipeline optimisations and anti-aliasing
- [ ] ? Load raw triangles at finest lod detail
- [ ] world axis behaves poorly at zoom levels
- [ ] world axis clips on edges
- [ ] ? rework database to create a store _per object_
- [ ] progress on preprocessing
- [ ] ? support for large surfaces (progressive sampling?)
- [ ] import preprocessing performance (parallelise or cache sampling points)

# Developing commands

```sh
# Build Rust to WASM (use --debug for debugging, BUT IS VERY SLOW!)
# Build Rust to WASM
# use --debug for debugging, BUT IS VERY SLOW!
# use --features=err-capture to get Rust stack trace printed to console
wasm-pack build --out-dir wasmpkg --out-name wasm --target bundler
# Builds Elm
elm make elm/ViewerUI.elm --output=js/viewer-ui.js
Expand Down
5 changes: 4 additions & 1 deletion elm/Ports.elm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type alias HoverInfo =
, renderPt : Maybe Point3
, worldPt : Maybe Point3
, meshName : Maybe String
, tileId : Maybe Int
, lodRes : Maybe Float
}


Expand Down Expand Up @@ -48,8 +50,9 @@ hoverinfo toMsg =
|> null "render_pt" decodePoint3
|> null "world_pt" decodePoint3
|> null "mesh_name" D.string
|> null "tile_id" D.int
|> null "lod_res" D.float
)
-- >> Result.mapError (Debug.log "Decode error")
>> Result.toMaybe
>> toMsg
)
Expand Down
33 changes: 15 additions & 18 deletions elm/ViewerUI.elm
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ objectListView =


hoverInfoView : HoverInfo -> Html
hoverInfoView { pointerx, pointery, renderPt, worldPt, meshName } =
hoverInfoView info =
let
{ pointerx, pointery, renderPt, worldPt } =
info
in
div []
[ hr [] []
, div [] [ text <| "screen coordinates: (" ++ String.fromInt pointerx ++ "," ++ String.fromInt pointery ++ ")" ]
Expand All @@ -181,13 +185,7 @@ hoverInfoView { pointerx, pointery, renderPt, worldPt, meshName } =

Nothing ->
[]
, div [] <|
case meshName of
Just n ->
[ text <| "closest mesh: " ++ decomposeMeshName n ]

Nothing ->
[]
, div [] [ text <| decomposeMeshInfo info ]
, hr [] []
]

Expand All @@ -196,16 +194,15 @@ p3toString { x, y, z } =
"(" ++ String.fromFloat x ++ "," ++ String.fromFloat y ++ "," ++ String.fromFloat z ++ ")"


decomposeMeshName n =
case String.reverse n |> String.split "-" of
lod :: tile :: rem ->
"{ key = "
++ String.reverse (String.join "-" rem)
decomposeMeshInfo { meshName, tileId, lodRes } =
case (meshName, tileId, lodRes) of
(Just n, Just id, Just res) ->
"closest mesh: { key = "
++ n
++ ", tile = "
++ String.reverse tile
++ String.fromInt id
++ ", lod = "
++ String.reverse lod
++ " }"

++ String.fromFloat res
++ "m }"
_ ->
n
""
Loading

0 comments on commit 985c217

Please sign in to comment.