Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ tevdef(3G) — IRIX 6.5.3f

Media Vault

Software Library

Restoration Projects

Artifacts Sought



tevdef(3G)                                                          tevdef(3G)



NAME
     tevdef - 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 TVNULL.  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 TVNULL, 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 TVNULL.

          TVMODULATE 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

          TVALPHA 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 TXI16 (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


          TVBLEND 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




          TVDECAL 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


          TVCOLOR 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.

          TVCOMPONENTSELECT 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:


            TVIGETSR uses the red component of a 4 component texture as a 1
            component texture.
            TVIGETSG uses the green component of a 4 component texture as a
            1 component texture.
            TVIGETSB uses the blue component of a 4 component texture as a
            1 component texture.
            TVIGETSA uses the alpha component of a 4 or 2 component texture
            as a 1 component texture.
            TVIAGETSRG uses the red and green components from a 4 component
            texture as a 2 component texture.
            TVIAGETSBA uses the blue and alpha components from a 4



                                                                        Page 3





tevdef(3G)                                                          tevdef(3G)



            component texture as a 2 component texture.
            TVIGETSI uses the intensity component from a 2 component
            texture as a 1 component texture.

     Symbols TVMODULATE, TVALPHA, TVBLEND and TVDECAL are exclusive; only
     one should be included in the props array.  If none are included,
     TVMODULATE 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

NOTES
     tevdef 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
     TVCOMPONENTSELECT.

     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(GDBITSNORMSNGALPHA) to determine whether alpha bitplanes are
     available.

     IRIS-4D RealityEngine models support TVCOMPONENTSELECT only with
     TXRGBA4 and TXIA8 format texels.

     Only IRIS-4D RealityEngine models support TVALPHA.

BUGS
     IRIS-4D VGX models do not support simultaneous texture mapping and
     polygon antialiasing.  (See polysmooth.)

     Infinite Reality and Impact do not support TVALPHA or
     TVCOMPONENTSELECT







                                                                        Page 4



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026