Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MeshCat core (three.js to v0.160.1) #252

Merged
merged 4 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[meshcat]
git-tree-sha1 = "15c3973b1084a231410e43e844c7714f1c41f163"
git-tree-sha1 = "7dd132db6118be7e071562fba91899d0e07e8f3a"

[[meshcat.download]]
url = "https://github.com/rdeits/meshcat/tarball/978cb8f519f9bb540e94b7f97a39ada4d7916b7c"
sha256 = "b3a5343bd0fcaabff4fcb73c0951a32d887d1cf0c69a64b52ea957704d4d1e0a"
url = "https://github.com/meshcat-dev/meshcat/tarball/3ce3dd6"
sha256 = "d5a56d2c959efd43397e0a819df1c2a61169405062f298484210d3d9ba5b30ed"
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MeshCat"
uuid = "283c5d60-a78f-5afe-a0af-af636b173e11"
authors = ["Robin Deits <[email protected]>"]
version = "0.16.1"
version = "0.16.2"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![codecov.io](https://codecov.io/github/rdeits/MeshCat.jl/coverage.svg?branch=master)](https://codecov.io/github/rdeits/MeshCat.jl?branch=master)
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://rdeits.github.com/MeshCat.jl/dev)

[MeshCat](https://github.com/rdeits/meshcat) is a remotely-controllable 3D viewer, built on top of [three.js](https://threejs.org/). The viewer contains a tree of objects and transformations (i.e. a scene graph) and allows those objects and transformations to be added and manipulated with simple commands. This makes it easy to create 3D visualizations of geometries, mechanisms, and robots. MeshCat.jl runs on macOS, Linux, and Windows.
[MeshCat](https://github.com/meshcat-dev/meshcat) is a remotely-controllable 3D viewer, built on top of [three.js](https://threejs.org/). The viewer contains a tree of objects and transformations (i.e. a scene graph) and allows those objects and transformations to be added and manipulated with simple commands. This makes it easy to create 3D visualizations of geometries, mechanisms, and robots. MeshCat.jl runs on macOS, Linux, and Windows.

The MeshCat viewer runs entirely in the browser, with no external dependencies. All files are served locally, so no internet connection is required. Communication between the browser and your Julia code is managed by [HTTP.jl](https://github.com/JuliaWeb/HTTP.jl). That means that MeshCat should work:

Expand Down Expand Up @@ -39,7 +39,7 @@ MeshCat.jl is a successor to [DrakeVisualizer.jl](https://github.com/rdeits/Drak

You may also want to check out:

* [meshcat-python](https://github.com/rdeits/meshcat-python): the Python implementation of the same protocol
* [meshcat-python](https://github.com/meshcat-dev/meshcat-python): the Python implementation of the same protocol
* [MeshCatMechanisms.jl](https://github.com/rdeits/MeshCatMechanisms.jl) extensions to MeshCat.jl for visualizing mechanisms, robots, and URDFs

# Examples
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
MeshCat = "283c5d60-a78f-5afe-a0af-af636b173e11"

[compat]
Documenter = "0.24"
Documenter = "1"
2 changes: 1 addition & 1 deletion notebooks/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ Colors = "0.9, 0.10, 0.11, 0.12"
FileIO = "1"
GeometryBasics = "0.3, 0.4"
MeshIO = "0.4"
Meshing = "0.5"
Meshing = "0.5, 0.6"
28 changes: 13 additions & 15 deletions notebooks/Static HTML Visualizers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,19 @@
"outputs": [],
"source": [
"vis = Visualizer()\n",
"setobject!(vis[:box1], \n",
" Rect(Vec(0., 0, 0), Vec(0.1, 0.2, 0.3)))\n",
"setobject!(vis[:box1], Rect(Vec(0.0, 0, 0), Vec(0.1, 0.2, 0.3)))\n",
"anim = Animation()\n",
"atframe(anim, 0) do\n",
" settransform!(vis[:box1], \n",
" Translation(0., 0, -1) ∘ LinearMap(RotZ(-π/2)))\n",
" settransform!(vis[:box1],\n",
" Translation(0.0, 0, -1) ∘ LinearMap(RotZ(-π / 2)))\n",
"end\n",
"atframe(anim, 30) do\n",
" settransform!(vis[:box1], \n",
" Translation(0., 0, 0) ∘ LinearMap(RotY(π/2)) ∘\n",
" LinearMap(RotZ(π/2)))\n",
" settransform!(vis[:box1],\n",
" Translation(0.0, 0, 0) ∘ LinearMap(RotY(π / 2)) ∘ LinearMap(RotZ(π / 2)))\n",
"end\n",
"atframe(anim, 60) do\n",
" settransform!(vis[:box1], \n",
" Translation(0., 0, 1))\n",
" settransform!(vis[:box1],\n",
" Translation(0.0, 0, 1))\n",
"end\n",
"setanimation!(vis, anim)"
]
Expand Down Expand Up @@ -112,8 +110,8 @@
"metadata": {},
"outputs": [],
"source": [
"setobject!(vis[:box1], \n",
" Rect(Vec(0., 0, 0), Vec(0.1, 0.2, 0.3)),\n",
"setobject!(vis[:box1],\n",
" Rect(Vec(0.0, 0, 0), Vec(0.1, 0.2, 0.3)),\n",
" MeshPhongMaterial(color=colorant\"red\"))"
]
},
Expand Down Expand Up @@ -167,17 +165,17 @@
"lastKernelId": null
},
"kernelspec": {
"display_name": "Julia 1.6.3",
"display_name": "Julia 1.10.2",
"language": "julia",
"name": "julia-1.6"
"name": "julia-1.10"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.6.3"
"version": "1.10.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
41 changes: 19 additions & 22 deletions notebooks/animation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@
"metadata": {},
"outputs": [],
"source": [
"setobject!(vis[:box1], \n",
" Rect(Vec(0., 0, 0), Vec(0.1, 0.2, 0.3)))"
"setobject!(vis[:box1], Rect(Vec(0, 0, 0), Vec(0.1, 0.2, 0.3)))"
]
},
{
Expand All @@ -99,11 +98,11 @@
" # `settransform!` and `setprop!` are intercepted\n",
" # and recorded in `anim` instead of having any\n",
" # effect on `vis`.\n",
" settransform!(vis[:box1], Translation(0., 0, 0))\n",
" settransform!(vis[:box1], Translation(0, 0, 0))\n",
"end\n",
"\n",
"atframe(anim, 30) do\n",
" settransform!(vis[:box1], Translation(0., 1, 0))\n",
" settransform!(vis[:box1], Translation(0, 1, 0))\n",
"end\n",
"\n",
"# `setanimation!()` actually sends the animation to the\n",
Expand Down Expand Up @@ -153,21 +152,21 @@
"anim = Animation()\n",
"\n",
"atframe(anim, 0) do\n",
" settransform!(vis[\"/Cameras/default\"], Translation(0., 0, 0))\n",
" settransform!(vis[\"/Cameras/default\"], Translation(0, 0, 0))\n",
"end\n",
"\n",
"atframe(anim, 30) do\n",
" settransform!(vis[\"/Cameras/default\"], Translation(0., 0, 1))\n",
" settransform!(vis[\"/Cameras/default\"], Translation(0, 0, 1))\n",
"end\n",
" \n",
"\n",
"setanimation!(vis, anim)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can also animate object properties. For example, let's animate the camera's `zoom` property to smoothly zoom out and then back in. Note that to do this, we have to access a deeper path in the visualizer to get to the actual camera object. For more information, see: https://github.com/rdeits/meshcat#camera-control"
"We can also animate object properties. For example, let's animate the camera's `zoom` property to smoothly zoom out and then back in. Note that to do this, we have to access a deeper path in the visualizer to get to the actual camera object. For more information, see: https://github.com/meshcat-dev/meshcat#camera-control"
]
},
{
Expand All @@ -179,17 +178,17 @@
"anim = Animation()\n",
"\n",
"atframe(anim, 0) do\n",
" setprop!(vis[\"/Cameras/default/rotated/<object>\"], \"zoom\", 1)\n",
" setprop!(vis[\"/Cameras/default/rotated/<object>\"], \"zoom\", 1.0)\n",
"end\n",
"\n",
"atframe(anim, 30) do\n",
" setprop!(vis[\"/Cameras/default/rotated/<object>\"], \"zoom\", 0.5)\n",
"end\n",
"\n",
"atframe(anim, 60) do\n",
" setprop!(vis[\"/Cameras/default/rotated/<object>\"], \"zoom\", 1)\n",
" setprop!(vis[\"/Cameras/default/rotated/<object>\"], \"zoom\", 1.0)\n",
"end\n",
" \n",
"\n",
"setanimation!(vis, anim)"
]
},
Expand All @@ -210,10 +209,8 @@
"metadata": {},
"outputs": [],
"source": [
"setobject!(vis[:box1], \n",
" Rect(Vec(0., 0, 0), Vec(0.1, 0.2, 0.3)))\n",
"setobject!(vis[:sphere],\n",
" HyperSphere(Point(0., 0, 0), 0.25))\n",
"setobject!(vis[:box1], Rect(Vec(0.0, 0, 0), Vec(0.1, 0.2, 0.3)))\n",
"setobject!(vis[:sphere], HyperSphere(Point(0.0, 0, 0), 0.25))\n",
"\n",
"# Start with the sphere hidden\n",
"setvisible!(vis[:sphere], false)"
Expand All @@ -228,17 +225,17 @@
"anim = Animation()\n",
"atframe(anim, 0) do\n",
" setvisible!(vis[:sphere], false)\n",
" settransform!(vis[:box1], Translation(0., 0, 0))\n",
" settransform!(vis[:box1], Translation(0.0, 0, 0))\n",
"end\n",
"\n",
"atframe(anim, 15) do\n",
" setvisible!(vis[:sphere], true)\n",
"end\n",
"\n",
"atframe(anim, 30) do\n",
" settransform!(vis[:box1], Translation(0., 1, 0))\n",
" settransform!(vis[:box1], Translation(0.0, 1, 0))\n",
"end\n",
" \n",
"\n",
"setanimation!(vis, anim)"
]
},
Expand Down Expand Up @@ -279,17 +276,17 @@
"lastKernelId": null
},
"kernelspec": {
"display_name": "Julia 1.6.3",
"display_name": "Julia 1.10.2",
"language": "julia",
"name": "julia-1.6"
"name": "julia-1.10"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.6.3"
"version": "1.10.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
48 changes: 20 additions & 28 deletions notebooks/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
"metadata": {},
"outputs": [],
"source": [
"# Activate the MeshCat package, and import some other \n",
"# useful functions\n",
"# Activate the MeshCat package, and import some other useful functions\n",
"using MeshCat\n",
"using CoordinateTransformations\n",
"using Rotations\n",
Expand Down Expand Up @@ -126,7 +125,7 @@
"outputs": [],
"source": [
"# First, we'll create a simple geometric object\n",
"box = HyperRectangle(Vec(0., 0, 0), Vec(1., 1, 1))"
"box = HyperRectangle(Vec(0.0, 0, 0), Vec(1.0, 1, 1))"
]
},
{
Expand All @@ -150,7 +149,7 @@
"# We can use settransform!() to tell the viewer to draw the box at a specific\n",
"# position. Translation() creates a CoordinateTransformations.Transformation\n",
"# corresponding to the given x; y; z translation.\n",
"settransform!(vis, Translation(0., 1, 0))"
"settransform!(vis, Translation(0.0, 1, 0))"
]
},
{
Expand All @@ -160,7 +159,7 @@
"outputs": [],
"source": [
"# We can also rotate the model by sending a different transformation\n",
"settransform!(vis, LinearMap(AngleAxis(pi/4, 0, 0, 1)))"
"settransform!(vis, LinearMap(AngleAxis(pi / 4, 0, 0, 1)))"
]
},
{
Expand Down Expand Up @@ -359,10 +358,9 @@
"# just simple boxes. Let's load a 3D mesh and visualize it:\n",
"using MeshIO\n",
"using FileIO\n",
"cat_mesh = load(joinpath(dirname(pathof(MeshCat)), \"..\", \"test\", \"data\", \"meshes\",\n",
" \"cat.obj\"))\n",
"cat_mesh = load(joinpath(dirname(pathof(MeshCat)), \"..\", \"test\", \"data\", \"meshes\", \"cat.obj\"))\n",
"setobject!(vis, cat_mesh)\n",
"settransform!(vis, LinearMap(AngleAxis(pi/2, 1, 0, 0)))"
"settransform!(vis, LinearMap(AngleAxis(pi / 2, 1, 0, 0)))"
]
},
{
Expand All @@ -373,19 +371,18 @@
"source": [
"delete!(vis)\n",
"\n",
"# Next, let's create a triangulated mesh by finding\n",
"# the 0-level set of some function. \n",
"# \n",
"# Next, let's create a triangulated mesh by finding the 0-level set of some function. \n",
"\n",
"# First, we'll define our function:\n",
"f = x -> sum(sin, 5 * x)\n",
"\n",
"# Then we pick a region of interest in which to sample the function.\n",
"# This region starts at (-1, -1, -1) and extends to (1, 1, 1):\n",
"lower_bound = Vec(-1.,-1,-1)\n",
"upper_bound = Vec(1., 1, 1)\n",
"lower_bound = Vec(-1.0, -1, -1)\n",
"upper_bound = Vec(1.0, 1, 1)\n",
"\n",
"# Those two pieces of information are all we need to construct a mesh geometry.\n",
"#\n",
"\n",
"# Using `Meshing.jl`, we can construct a mesh directly from our function:\n",
"using Meshing: MarchingCubes\n",
"\n",
Expand Down Expand Up @@ -475,8 +472,7 @@
"metadata": {},
"outputs": [],
"source": [
"image = PngImage(\n",
" joinpath(MeshCat.VIEWER_ROOT, \"..\", \"data\", \"HeadTextureMultisense.png\"))\n",
"image = PngImage(joinpath(MeshCat.VIEWER_ROOT, \"..\", \"data\", \"HeadTextureMultisense.png\"))\n",
"texture = Texture(image=image)\n",
"material = MeshLambertMaterial(map=texture)\n",
"geometry = load(joinpath(MeshCat.VIEWER_ROOT, \"..\", \"data\", \"head_multisense.obj\"))\n",
Expand All @@ -500,10 +496,8 @@
"outputs": [],
"source": [
"path = joinpath(@__DIR__, \"..\", \"test\", \"data\", \"meshes\", \"cube.dae\")\n",
"setobject!(vis[\"meshes\", \"dae_file_geometry\"], \n",
" MeshFileGeometry(path))\n",
"settransform!(vis[\"meshes\", \"dae_file_geometry\"], \n",
" Translation(0.0, 1.25, 0.0))"
"setobject!(vis[\"meshes\", \"dae_file_geometry\"], MeshFileGeometry(path))\n",
"settransform!(vis[\"meshes\", \"dae_file_geometry\"], Translation(0.0, 1.25, 0.0))"
]
},
{
Expand All @@ -525,10 +519,8 @@
"source": [
"path = joinpath(@__DIR__, \"..\", \"test\", \"data\", \"meshes\", \"cube.dae\")\n",
"\n",
"setobject!(vis[\"meshes\", \"dae_file_object\"], \n",
" MeshFileObject(path))\n",
"settransform!(vis[\"meshes\", \"dae_file_object\"], \n",
" Translation(0.0, 2.5, 0.0))"
"setobject!(vis[\"meshes\", \"dae_file_object\"], MeshFileObject(path))\n",
"settransform!(vis[\"meshes\", \"dae_file_object\"], Translation(0.0, 2.5, 0.0))"
]
}
],
Expand All @@ -538,17 +530,17 @@
"lastKernelId": null
},
"kernelspec": {
"display_name": "Julia 1.9.0",
"display_name": "Julia 1.10.2",
"language": "julia",
"name": "julia-1.9"
"name": "julia-1.10"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "1.9.0"
"version": "1.10.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
2 changes: 1 addition & 1 deletion src/artifact_helper.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Tar, Inflate, SHA

function artifact_helper(sha::AbstractString)
url = "https://github.com/rdeits/meshcat/tarball/$sha"
url = "https://github.com/meshcat-dev/meshcat/tarball/$sha"
filename = download(url)

println("""
Expand Down
2 changes: 1 addition & 1 deletion src/assets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ function develop_meshcat_assets(skip_confirmation=false)
end
println("Removing $meshcat_dir")
rm(meshcat_dir, force=true, recursive=true)
run(`git clone https://github.com/rdeits/meshcat $meshcat_dir`)
run(`git clone https://github.com/meshcat-dev/meshcat $meshcat_dir`)
rm(joinpath(meshcat_dir, "..", "meshcat.stamp"))
end
2 changes: 1 addition & 1 deletion src/lowering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function lower(obj::MeshFileObject)
end


# TODO: Unify these two methods once https://github.com/rdeits/meshcat/issues/50 is resolved
# TODO: Unify these two methods once https://github.com/meshcat-dev/meshcat/issues/50 is resolved
pack_mesh_file_data(s::AbstractString) = s
pack_mesh_file_data(s::AbstractVector{UInt8}) = PackedVector(s)

Expand Down
Loading
Loading