-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
92 lines (71 loc) · 2.96 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
rgl2gltf: Read and write .gltf and .glb files
=======================================================
```{r include=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README"
)
options(rgl.useNULL=FALSE)
suppressPackageStartupMessages(library(rgl))
if (!requireNamespace("rmarkdown", quietly = TRUE) ||
!rmarkdown::pandoc_available("1.14")) {
warning(call. = FALSE, "These vignettes assume rmarkdown and pandoc version 1.14. These were not found. Older versions will not work.")
knitr::knit_exit()
}
setupKnitr(autoprint = FALSE)
```
This R package contains functions to read, write and display
`.gltf` and `.glb` files containing 3D models, following the
[official spec at khronos.org](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html) . It also contains functions to convert
`rgl` scenes and `mesh3d` objects to and from glTF objects.
It is still in active development. Please add issues or pull requests if something
important to you is missing.
A `pkgdown` website is here: https://dmurdoch.github.io/rgl2gltf/dev/
To install from CRAN, run
```r
install.packages("rgl2gltf")
```
To install the development version, run
```r
remotes::install_github("dmurdoch/rgl2gltf")
```
Sample code:
```{r}
library(rgl)
library(rgl2gltf)
gltf <- readGLB("https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/2CylinderEngine/glTF-Binary/2CylinderEngine.glb?raw=true")
mesh <- as.mesh3d(gltf)
plot3d(gltf)
snapshot3d(webshot = FALSE, filename = "man/figures/engine.png")
```
![](man/figures/engine.png)
Copyright
---------
Most of this package is written by Duncan Murdoch and licensed
under GPL 2.0.
Sample files in `inst/glb` and `inst/localtests`
are unmodified copies of files from https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0,
and have details of copyright and licenses listed there. All
have permissive licenses, some requiring acknowledgment.
Files in `inst/localtests` are in the Github repository, but
are not included in the package tarball.
Briefly,
- `2CylinderEngine.glb` was produced by Okino Computer Graphics.
- `AlphaBlendModeTest.glb`, `NormalTangentTest.glb` and `NormalTangentMirrorTest.glb` were created
by Ed Mackey and are owned by Analytical Graphics, Inc., licensed under
CC-BY 4.0 https://creativecommons.org/licenses/by/4.0/.
- `AntiqueCamera.glb` was produced by Maximilian Kamps and UX3D.
- `Avocado.glb` was produced by Microsoft.
- `BarramundiFish.glb` was produced by Microsoft.
- `BoxAnimated.glb` and `RiggedSimple.glb` were produced by Cesium.
- `BrainStem.glb` was created by Keith Hunter and is owned by Smith Micro Software, Inc.
- `DamagedHelmet.glb` was created by theblueturtle_.
Files `src/mikktspace.c` and `src/mikktspace.h` are written by Morten
S. Mikkelsen and used under the permissive license included
within them, with slight modifications for C99
compatibility.