File: textureSource.Rd

package info (click to toggle)
rgl 1.3.34-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,968 kB
  • sloc: cpp: 23,234; ansic: 7,462; javascript: 6,125; sh: 3,555; makefile: 2
file content (56 lines) | stat: -rw-r--r-- 1,656 bytes parent folder | download | duplicates (2)
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
\name{textureSource}
\alias{textureSource}
\title{
Retrieve source code used to produce texture file.
}
\description{
Internally, \pkg{rgl} works with PNG files for textures.
If a texture is requested using a different format, a temporary
PNG file of the image will be saved.  This function allows
you to retrieve the original expression used to produce
the texture.
}
\usage{
textureSource(texture)
}
\arguments{
  \item{texture}{
The filename of a texture file.  If missing, the directory
where texture files are stored will be returned.
}
}
\details{
\pkg{rgl} creates a new file in the temporary directory
whenever a non-PNG texture is used.  It will delete them
when it knows there are no references and 
at the end of the session, but conceivably there will be 
situations where you need to delete them earlier.  Calling
\code{textureSource()} with no arguments will give
you the directory holding the textures so that they can
be deleted sooner.
}
\value{
If \code{texture} is specified and it is the name of a 
temporary PNG texture file produced by \pkg{rgl}, the 
expression used to specify the texture will be returned.  
If it is the name of some other file, \code{texture} will
be returned.

If no argument is given, the session-specific directory
holding the temporary texture files will be returned.
}

\seealso{
\code{\link{material3d}}
}
\examples{
xyz <- cbind(c(0,1,1,0), c(0,0,1,1), c(0,0,0,0))
st <- xyz[,1:2]

open3d()
id <- quads3d(xyz, texcoords = st, 
               texture = as.raster(matrix(colors()[1:120], ncol = 10)), 
               col="white")
material3d(id = id, "texture")
textureSource(material3d(id = id, "texture"))
}