tevdef(3G)tevdef(3G)NAMEtevdef - defines a texture mapping environment
C SPECIFICATION
void tevdef(long index, long np, float props[])
PARAMETERS
index expects the name of the environment being defined. Index 0 is
reserved as a null definition, and cannot be redefined.
np expects the number of symbols and floating point values in props,
including the termination symbol TV_NULL. If np is zero, it is
ignored. Operation over network connections is more efficient
when np is correctly specified, however.
props expects the array of floating point symbols and values that
define the texture environment. props must contain a sequence of
symbols, each followed by the appropriate number of floating
point values. The last symbol must be TV_NULL, which is itself
not followed by any values.
DESCRIPTION
Evaluation of the texture function at a pixel yields 1, 2, 3, or 4
values, depending on the value of nc passed to texdef2d when the
currently bound texture was defined. Texture environment determines how
these texture values are used, not how they are computed or filtered.
tevdef defines an environment based on options specified in the props
array. If no options are specified, a reasonable default environment is
defined.
Before the options can be defined, several conventions must be
established:
1. The color components of the incoming pixel (prior to texture
mapping) are refered to as Rin, Gin, Bin, and Ain.
2. The components of the texture function (computed at each pixel) are
refered to as I, R, G, B, and A, depending on the number of
components in the currently bound texture. For example, the single
value of a 1-component texture function is refered to as I, while
the four components of a 4-component texture are refered to as A
(value 0), B (value 1), G (value 2), and R (value 3). Refer to the
texdef2d manual page for an explanation of how texture function
values correspond to the image pixels used to define the texture.
0123 (texture function value)
1-component texture I
2-component texture AI
3-component texture BGR
4-component texture ABGR
Page 1
tevdef(3G)tevdef(3G)
3. The components of the outgoing color that results from application
of the texture function to the incoming pixel color, based on the
texture environment, are Rout, Gout, Bout, and Aout.
Texture environment options are specified as a list of symbols, each
followed by the appropriate number of floating point values, in the props
array. The last symbol must be TV_NULL.
TV_MODULATE is the default texture environment. It specifies an
environment in which incoming color components are multiplied by
texture values. No floating point values follow this token. The
exact arithmetic for 1, 2, 3, and 4 component texture functions is:
1-component: Rout=Rin*I,Gout=Gin*I,Bout=Bin*I,Aout=Ain
2-component: Rout=Rin*I,Gout=Gin*I,Bout=Bin*I,Aout=Ain*A
3-component: Rout=Rin*R,Gout=Gin*G,Bout=Bin*B,Aout=Ain
4-component: Rout=Rin*R,Gout=Gin*G,Bout=Bin*B,Aout=Ain*A
TV_ALPHA specifies a texture environment in which the texture
function affects the alpha color component. The other color
components are unaffected. No floating point values follow this
token. Only the 1-component texture function of TX_I_16 (see
texdef) has defined behavior when this environment is specified.
The exact arithmetic for these texture functions is:
1-component: Rout = Rin
Gout = Gin
Bout = Bin
Aout = Ain*I
2-component: undefined
3-component: undefined
4-component: undefined
TV_BLEND specifies a texture environment in which texture function
values are used to blend between the incoming color and the current
texture environment color constant: (Rcon,Gcon,Bcon,Acon). No
floating point values follow this token. Only 1 and 2 component
texture functions have defined behavior when this environment is
specified. The exact arithmetic for these texture functions is:
1-component: Rout = Rin*(1-I) + Rcon*I
Gout = Gin*(1-I) + Gcon*I
Bout = Bin*(1-I) + Bcon*I
Aout = Ain
2-component: Rout = Rin*(1-I) + Rcon*I
Gout = Gin*(1-I) + Gcon*I
Bout = Bin*(1-I) + Bcon*I
Aout = Ain*A
Page 2
tevdef(3G)tevdef(3G)
3-component: undefined
4-component: undefined
TV_DECAL specifies a texture environment in which texture function
alpha is used to blend between the incoming color and the texture
function color. No floating point values follow this token. Only 3
and 4-component texture functions have defined behavior when this
environment is specified. Note that the 3-component version simply
outputs the texture colors, because no alpha texture component is
available for blending. The exact arithmetic is:
1-component: undefined
2-component: undefined
3-component: Rout = R
Gout = G
Bout = B
Aout = Ain
4-component: Rout = Rin*(1-A) + R*A
Gout = Gin*(1-A) + G*A
Bout = Bin*(1-A) + B*A
Aout = Ain
TV_COLOR specifies the constant color used by the TV_BLEND
environment. Four floating point values, in the range 0.0 through
1.0, must follow this symbol. These values specify Rcon, Gcon,
Bcon, and Acon. By default, all are set to 1.0.
TV_COMPONENT_SELECT allows the use of one or two components from a
texture with more components. Some Graphics Library implementations
may allow 4 component textures with a very small component size,
such as 4bits which is smaller than the smallest addressable datum.
Thus, a 4 component texture with 4 bits per component may be used as
4 seperate 1 component textures, or two 2 component textures, etc.
The token is followed by one choice from the following:
TV_I_GETS_R uses the red component of a 4 component texture as a 1
component texture.
TV_I_GETS_G uses the green component of a 4 component texture as a
1 component texture.
TV_I_GETS_B uses the blue component of a 4 component texture as a
1 component texture.
TV_I_GETS_A uses the alpha component of a 4 or 2 component texture
as a 1 component texture.
TV_IA_GETS_RG uses the red and green components from a 4 component
texture as a 2 component texture.
TV_IA_GETS_BA uses the blue and alpha components from a 4
Page 3
tevdef(3G)tevdef(3G)
component texture as a 2 component texture.
TV_I_GETS_I uses the intensity component from a 2 component
texture as a 1 component texture.
Symbols TV_MODULATE, TV_ALPHA, TV_BLEND and TV_DECAL are exclusive; only
one should be included in the props array. If none are included,
TV_MODULATE is chosen by default.
The texture environment is used to apply the results of the texture
function to pixel color data after shading, but before fog is blended.
Conditional pixel writes based on pixel alpha are computed after texture
and fog are applied. (See afunction.) This allows texture transparency
to control the conditional writing of pixels.
Each time an index is passed to tevdef, the definition corresponding to
that index is completely respecified. Do not attempt to change a portion
of a texture environment definition.
SEE ALSO
afunction, scrsubdivide, t, tevbind, texbind, texdef2d, texgen
NOTEStevdef is immediate mode only. IRIS-4D G, GT, and GTX models, and the
Personal Iris, do not support texture mapping. tevdef is ignored by
these machines. The Iris Indy, Indigo Entry, and XL support texture
mapping except for lines. Use getgdesc to determine whether texture
mapping is supported.
IRIS-4D VGX, VGXT and SKYWRITER models do not support
TV_COMPONENT_SELECT.
IRIS-4D VGX models without alpha bitplanes do not fully support 4-
component textures. When a 4-component texture is used, it is treated by
the texture environment as though it were a 3-component texture. Use
getgdesc(GD_BITS_NORM_SNG_ALPHA) to determine whether alpha bitplanes are
available.
IRIS-4D RealityEngine models support TV_COMPONENT_SELECT only with
TX_RGBA_4 and TX_IA_8 format texels.
Only IRIS-4D RealityEngine models support TV_ALPHA.
BUGS
IRIS-4D VGX models do not support simultaneous texture mapping and
polygon antialiasing. (See polysmooth.)
Infinite Reality and Impact do not support TV_ALPHA or
TV_COMPONENT_SELECT
Page 4