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
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utilities.R
\name{texture}
\alias{texture}
\title{Convert an image file or uri to a three.js texture}
\usage{
texture(data)
}
\arguments{
\item{data}{A character string file name referring to an image file,
or referring to an image uri (see the examples).}
}
\value{
JSON-formatted list with image, width, and height fields
suitable for use as a three.js
texture created with the base64texture function. The image field
contains a base64 dataURI encoding of the image.
}
\description{
Convert file image representations in R into JSON-formatted arrays
suitable for use as three.js textures. This function is automatically
invoked for images used in the \code{globejs} function.
}
\note{
Due to browser
"same origin policy" security restrictions, loading textures
from a file system in three.js may lead to a security exception,
see
\url{https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally}.
References to file locations work in Shiny apps, but not in stand-alone
examples. The \code{texture} function facilitates transfer of image
texture data from R into three.js textures. Binary image data are
encoded and inserted into three.js without using files as dataURIs.
}
\examples{
\dontrun{
# A big image (may take a while to download):
img <- paste("http://eoimages.gsfc.nasa.gov/",
"images/imagerecords/73000/73909/",
"world.topo.bathy.200412.3x5400x2700.jpg", sep="")
t <- texture(img)
}
}
\references{
The threejs project \url{http://threejs.org}.
\url{https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally}.
}
|