Previous: Appearances, Up: Conventions
Some platforms support texture-mapped objects.
(On those which don't, attempts to use texture mapping are silently
ignored.) A texture is specified as part of an appearance structure,
as in See Appearances. Briefly, one provides a texture image,
which is considered to lie in a square in (s,t)
parameter space in
the range 0 <= s <= 1, 0 <= t <= 1. Then one provides a geometric primitive,
with each vertex tagged with (s,t)
texture coordinates. If texturing
is enabled, the appropriate portion of the texture image is pasted onto
each face of the textured object.
There is (currently) no provision for inheritance of part of a texture
structure; if the texture
keyword is mentioned in an appearance,
it supplants any other texture specification.
The appearance attribute texturing
controls whether textures are
used; there's no performance penalty for having texture { ... } fields
defined when texturing is off.
The available fields are:
clamp none -or- s -or- t -or- st Determines the meaning of texture coordinates outside the range 0..1. Withclamp none
, the default, coordinates are interpreted modulo 1, so (s,t) = (1.25,0), (.25,0), and (-.75,0) all refer to the same point in texture space. Withs
ort
orst
, either or both of s- or t-coordinates less than 0 or greater than 1 are clamped to 1 or 0, respectively. file filename alphafile filename Specifies image file(s) containing the texture. Thefile
file's image specifies color or lightness information; thealphafile
if present, specifies a transparency ("alpha") mask; where the mask is zero, pixels are simply not drawn. Several image file formats are available; the file type must be indicated by the last few characters of the file name: .ppm or .ppm.Z or .ppm.gz 24-bit 3-color image in PPM format .pgm or .pgm.Z or .pgm.gz 8-bit grayscale image in PGM format .sgi or .sgi.Z or .sgi.gz 8-bit, 24-bit, or 32-bit SGI image .tiff 8-bit or 24-bit TIFF image .gif GIF image (Though 4-channel TIFF images are possible, and could represent both color and transparency information in one image, that's not supported in geomview at present.) For this feature to work, some programs must be available in geomview's search path: zcat for .Z files gzip for .gz files tifftopnm for .tiff files giftoppm for .gif files If analphafile
image is supplied, it must be the same size as thefile
image. apply modulate -or- blend -or- decal Indicates how the texture image is applied to the surface. Here the "surface color" means the color that surface would have in the absence of texture mapping. Withmodulate
, the default, the texture color (or lightness, if textured by a gray-scale image) is multiplied by the surface color. Withblend
, texture blends between thebackground
color and the surface color. Thefile
parameter must specify a gray-scale image. Where the texture image is 0, the surface color is unaffected; where it's 1, the surface is painted in the color given bybackground
; and color is interpolated for intermediate values. Withdecal
, thefile
parameter must specify a 3-color image. If analphafile
parameter is present, its value interpolates between the surface color (where alpha=0) and the texture color (where alpha=1). Lighting does not affect the texture color indecal
mode; effectively the texture is constant-shaded. background R G B A Specifies a 4-component color, with R, G, B, and A floating-point numbers normally in the range 0..1, used whenapply blend
is selected. transformtransformation-matrix
Expects a list of 16 numbers, or one of the other ways of representing a transformation (: handlename
or< filename
). The 4x4 transformation matrix is applied to texture coordinates, in the sense of a 4-component row vector (s,t,0,1) multiplied on the left of the matrix, to produce new coordinates (s',t') which actually index the texture.