Ignore:
Timestamp:
May 23, 2000, 10:35:01 PM (25 years ago)
Author:
jeroen
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/opengl/mesa/pb.h

    r2938 r3597  
    1 /* $Id: pb.h,v 1.1 2000-02-29 00:48:35 sandervl Exp $ */
     1/* $Id: pb.h,v 1.2 2000-05-23 20:34:54 jeroen Exp $ */
    22
    33/*
    44 * Mesa 3-D graphics library
    5  * Version:  3.1
     5 * Version:  3.3
    66 *
    77 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
     
    3636
    3737
    38 
    3938/*
    4039 * Pixel buffer size, must be larger than MAX_WIDTH.
     
    4443
    4544struct pixel_buffer {
    46         GLint x[PB_SIZE];         /* X window coord in [0,MAX_WIDTH) */
    47         GLint y[PB_SIZE];         /* Y window coord in [0,MAX_HEIGHT) */
    48         GLdepth z[PB_SIZE];       /* Z window coord in [0,MAX_DEPTH] */
    49         GLubyte rgba[PB_SIZE][4]; /* Colors */
    50         GLubyte spec[PB_SIZE][3]; /* Separate specular colors */
    51         GLuint i[PB_SIZE];        /* Index */
    52         GLfloat s[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture S coordinates */
    53         GLfloat t[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture T coordinates */
    54         GLfloat u[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture R coordinates */
    55         GLfloat lambda[MAX_TEXTURE_UNITS][PB_SIZE];/* Texture lambda values */
    56         GLint color[4];         /* Mono color, integers! */
    57         GLuint index;           /* Mono index */
    58         GLuint count;           /* Number of pixels in buffer */
    59         GLboolean mono;         /* Same color or index for all pixels? */
    60         GLenum primitive;       /* GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP*/
     45        GLint x[PB_SIZE];         /* X window coord in [0,MAX_WIDTH) */
     46        GLint y[PB_SIZE];         /* Y window coord in [0,MAX_HEIGHT) */
     47        GLdepth z[PB_SIZE];       /* Z window coord in [0,Visual.MaxDepth] */
     48        GLubyte rgba[PB_SIZE][4]; /* Colors */
     49        GLubyte spec[PB_SIZE][3]; /* Separate specular colors */
     50        GLuint i[PB_SIZE];        /* Index */
     51        GLfloat s[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture S coordinates */
     52        GLfloat t[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture T coordinates */
     53        GLfloat u[MAX_TEXTURE_UNITS][PB_SIZE];  /* Texture R coordinates */
     54        GLfloat lambda[MAX_TEXTURE_UNITS][PB_SIZE];/* Texture lambda values */
     55        GLint color[4];         /* Mono color, integers! */
     56        GLuint index;           /* Mono index */
     57        GLuint count;           /* Number of pixels in buffer */
     58        GLboolean mono;         /* Same color or index for all pixels? */
     59        GLenum primitive;       /* GL_POINT, GL_LINE, GL_POLYGON or GL_BITMAP*/
    6160};
    62 
    63 
    6461
    6562
     
    6865 * Set the color used for all subsequent pixels in the buffer.
    6966 */
    70 #define PB_SET_COLOR( CTX, PB, R, G, B, A )                     \
    71         if ((PB)->color[RCOMP]!=(R) || (PB)->color[GCOMP]!=(G)  \
    72          || (PB)->color[BCOMP]!=(B) || (PB)->color[ACOMP]!=(A)  \
    73          || !(PB)->mono) {                                      \
    74                 gl_flush_pb( ctx );                             \
    75         }                                                               \
    76         (PB)->color[RCOMP] = R;                                 \
    77         (PB)->color[GCOMP] = G;                                 \
    78         (PB)->color[BCOMP] = B;                                 \
    79         (PB)->color[ACOMP] = A;                                 \
    80         (PB)->mono = GL_TRUE;
     67#define PB_SET_COLOR( CTX, PB, R, G, B, A )                     \
     68        if ((PB)->color[RCOMP]!=(R) || (PB)->color[GCOMP]!=(G)  \
     69         || (PB)->color[BCOMP]!=(B) || (PB)->color[ACOMP]!=(A)  \
     70         || !(PB)->mono) {                                      \
     71                gl_flush_pb( ctx );                             \
     72        }                                                       \
     73        (PB)->color[RCOMP] = R;                                 \
     74        (PB)->color[GCOMP] = G;                                 \
     75        (PB)->color[BCOMP] = B;                                 \
     76        (PB)->color[ACOMP] = A;                                 \
     77        (PB)->mono = GL_TRUE;
    8178
    8279
     
    8481 * Set the color index used for all subsequent pixels in the buffer.
    8582 */
    86 #define PB_SET_INDEX( CTX, PB, I )              \
    87         if ((PB)->index!=(I) || !(PB)->mono) {  \
    88                 gl_flush_pb( CTX );             \
    89         }                                       \
    90         (PB)->index = I;                        \
    91         (PB)->mono = GL_TRUE;
     83#define PB_SET_INDEX( CTX, PB, I )              \
     84        if ((PB)->index!=(I) || !(PB)->mono) {  \
     85                gl_flush_pb( CTX );             \
     86        }                                       \
     87        (PB)->index = I;                        \
     88        (PB)->mono = GL_TRUE;
    9289
    9390
     
    9592 * "write" a pixel using current color or index
    9693 */
    97 #define PB_WRITE_PIXEL( PB, X, Y, Z )           \
    98         (PB)->x[(PB)->count] = X;               \
    99         (PB)->y[(PB)->count] = Y;               \
    100         (PB)->z[(PB)->count] = Z;               \
    101         (PB)->count++;
     94#define PB_WRITE_PIXEL( PB, X, Y, Z )           \
     95        (PB)->x[(PB)->count] = X;               \
     96        (PB)->y[(PB)->count] = Y;               \
     97        (PB)->z[(PB)->count] = Z;               \
     98        (PB)->count++;
    10299
    103100
     
    105102 * "write" an RGBA pixel
    106103 */
    107 #define PB_WRITE_RGBA_PIXEL( PB, X, Y, Z, R, G, B, A )  \
    108         (PB)->x[(PB)->count] = X;                       \
    109         (PB)->y[(PB)->count] = Y;                       \
    110         (PB)->z[(PB)->count] = Z;                       \
    111         (PB)->rgba[(PB)->count][RCOMP] = R;             \
    112         (PB)->rgba[(PB)->count][GCOMP] = G;             \
    113         (PB)->rgba[(PB)->count][BCOMP] = B;             \
    114         (PB)->rgba[(PB)->count][ACOMP] = A;             \
    115         (PB)->count++;
     104#define PB_WRITE_RGBA_PIXEL( PB, X, Y, Z, R, G, B, A )  \
     105        (PB)->x[(PB)->count] = X;                       \
     106        (PB)->y[(PB)->count] = Y;                       \
     107        (PB)->z[(PB)->count] = Z;                       \
     108        (PB)->rgba[(PB)->count][RCOMP] = R;             \
     109        (PB)->rgba[(PB)->count][GCOMP] = G;             \
     110        (PB)->rgba[(PB)->count][BCOMP] = B;             \
     111        (PB)->rgba[(PB)->count][ACOMP] = A;             \
     112        (PB)->count++;
    116113
    117114/*
    118115 * "write" a color-index pixel
    119116 */
    120 #define PB_WRITE_CI_PIXEL( PB, X, Y, Z, I )     \
    121         (PB)->x[(PB)->count] = X;               \
    122         (PB)->y[(PB)->count] = Y;               \
    123         (PB)->z[(PB)->count] = Z;               \
    124         (PB)->i[(PB)->count] = I;               \
    125         (PB)->count++;
     117#define PB_WRITE_CI_PIXEL( PB, X, Y, Z, I )     \
     118        (PB)->x[(PB)->count] = X;               \
     119        (PB)->y[(PB)->count] = Y;               \
     120        (PB)->z[(PB)->count] = Z;               \
     121        (PB)->i[(PB)->count] = I;               \
     122        (PB)->count++;
    126123
    127124
     
    129126 * "write" an RGBA pixel with texture coordinates
    130127 */
    131 #define PB_WRITE_TEX_PIXEL( PB, X, Y, Z, R, G, B, A, S, T, U )  \
    132         (PB)->x[(PB)->count] = X;                               \
    133         (PB)->y[(PB)->count] = Y;                               \
    134         (PB)->z[(PB)->count] = Z;                               \
    135         (PB)->rgba[(PB)->count][RCOMP] = R;                     \
    136         (PB)->rgba[(PB)->count][GCOMP] = G;                     \
    137         (PB)->rgba[(PB)->count][BCOMP] = B;                     \
    138         (PB)->rgba[(PB)->count][ACOMP] = A;                     \
    139         (PB)->s[0][(PB)->count] = S;                            \
    140         (PB)->t[0][(PB)->count] = T;                            \
    141         (PB)->u[0][(PB)->count] = U;                            \
    142         (PB)->count++;
     128#define PB_WRITE_TEX_PIXEL( PB, X, Y, Z, R, G, B, A, S, T, U )  \
     129        (PB)->x[(PB)->count] = X;                               \
     130        (PB)->y[(PB)->count] = Y;                               \
     131        (PB)->z[(PB)->count] = Z;                               \
     132        (PB)->rgba[(PB)->count][RCOMP] = R;                     \
     133        (PB)->rgba[(PB)->count][GCOMP] = G;                     \
     134        (PB)->rgba[(PB)->count][BCOMP] = B;                     \
     135        (PB)->rgba[(PB)->count][ACOMP] = A;                     \
     136        (PB)->s[0][(PB)->count] = S;                            \
     137        (PB)->t[0][(PB)->count] = T;                            \
     138        (PB)->u[0][(PB)->count] = U;                            \
     139        (PB)->count++;
    143140
    144141/*
    145142 * "write" an RGBA pixel with multiple texture coordinates
    146143 */
    147 #define PB_WRITE_MULTITEX_PIXEL( PB, X, Y, Z, R, G, B, A, S, T, U, S1, T1, U1 ) \
    148         (PB)->x[(PB)->count] = X;                               \
    149         (PB)->y[(PB)->count] = Y;                               \
    150         (PB)->z[(PB)->count] = Z;                               \
    151         (PB)->rgba[(PB)->count][RCOMP] = R;                     \
    152         (PB)->rgba[(PB)->count][GCOMP] = G;                     \
    153         (PB)->rgba[(PB)->count][BCOMP] = B;                     \
    154         (PB)->rgba[(PB)->count][ACOMP] = A;                     \
    155         (PB)->s[0][(PB)->count] = S;                            \
    156         (PB)->t[0][(PB)->count] = T;                            \
    157         (PB)->u[0][(PB)->count] = U;                            \
    158         (PB)->s[1][(PB)->count] = S1;                           \
    159         (PB)->t[1][(PB)->count] = T1;                           \
    160         (PB)->u[1][(PB)->count] = U1;                           \
    161         (PB)->count++;
     144#define PB_WRITE_MULTITEX_PIXEL( PB, X, Y, Z, R, G, B, A, S, T, U, S1, T1, U1 ) \
     145        (PB)->x[(PB)->count] = X;                               \
     146        (PB)->y[(PB)->count] = Y;                               \
     147        (PB)->z[(PB)->count] = Z;                               \
     148        (PB)->rgba[(PB)->count][RCOMP] = R;                     \
     149        (PB)->rgba[(PB)->count][GCOMP] = G;                     \
     150        (PB)->rgba[(PB)->count][BCOMP] = B;                     \
     151        (PB)->rgba[(PB)->count][ACOMP] = A;                     \
     152        (PB)->s[0][(PB)->count] = S;                            \
     153        (PB)->t[0][(PB)->count] = T;                            \
     154        (PB)->u[0][(PB)->count] = U;                            \
     155        (PB)->s[1][(PB)->count] = S1;                           \
     156        (PB)->t[1][(PB)->count] = T1;                           \
     157        (PB)->u[1][(PB)->count] = U1;                           \
     158        (PB)->count++;
    162159
    163160/*
    164161 * "write" an RGBA pixel with multiple texture coordinates and specular color
    165162 */
    166 #define PB_WRITE_MULTITEX_SPEC_PIXEL( PB, X, Y, Z, R, G, B, A,  \
    167                         SR, SG, SB, S, T, U, S1, T1, U1 )       \
    168         (PB)->x[(PB)->count] = X;                               \
    169         (PB)->y[(PB)->count] = Y;                               \
    170         (PB)->z[(PB)->count] = Z;                               \
    171         (PB)->rgba[(PB)->count][RCOMP] = R;                     \
    172         (PB)->rgba[(PB)->count][GCOMP] = G;                     \
    173         (PB)->rgba[(PB)->count][BCOMP] = B;                     \
    174         (PB)->rgba[(PB)->count][ACOMP] = A;                     \
    175         (PB)->spec[(PB)->count][RCOMP] = SR;                    \
    176         (PB)->spec[(PB)->count][GCOMP] = SG;                    \
    177         (PB)->spec[(PB)->count][BCOMP] = SB;                    \
    178         (PB)->s[0][(PB)->count] = S;                            \
    179         (PB)->t[0][(PB)->count] = T;                            \
    180         (PB)->u[0][(PB)->count] = U;                            \
    181         (PB)->s[1][(PB)->count] = S1;                           \
    182         (PB)->t[1][(PB)->count] = T1;                           \
    183         (PB)->u[1][(PB)->count] = U1;                           \
    184         (PB)->count++;
     163#define PB_WRITE_MULTITEX_SPEC_PIXEL( PB, X, Y, Z, R, G, B, A,  \
     164                        SR, SG, SB, S, T, U, S1, T1, U1 )       \
     165        (PB)->x[(PB)->count] = X;                               \
     166        (PB)->y[(PB)->count] = Y;                               \
     167        (PB)->z[(PB)->count] = Z;                               \
     168        (PB)->rgba[(PB)->count][RCOMP] = R;                     \
     169        (PB)->rgba[(PB)->count][GCOMP] = G;                     \
     170        (PB)->rgba[(PB)->count][BCOMP] = B;                     \
     171        (PB)->rgba[(PB)->count][ACOMP] = A;                     \
     172        (PB)->spec[(PB)->count][RCOMP] = SR;                    \
     173        (PB)->spec[(PB)->count][GCOMP] = SG;                    \
     174        (PB)->spec[(PB)->count][BCOMP] = SB;                    \
     175        (PB)->s[0][(PB)->count] = S;                            \
     176        (PB)->t[0][(PB)->count] = T;                            \
     177        (PB)->u[0][(PB)->count] = U;                            \
     178        (PB)->s[1][(PB)->count] = S1;                           \
     179        (PB)->t[1][(PB)->count] = T1;                           \
     180        (PB)->u[1][(PB)->count] = U1;                           \
     181        (PB)->count++;
    185182
    186183
     
    189186 * Call this function at least every MAX_WIDTH pixels:
    190187 */
    191 #define PB_CHECK_FLUSH( CTX, PB )               \
    192 do {                                            \
    193         if ((PB)->count>=PB_SIZE-MAX_WIDTH) {   \
    194            gl_flush_pb( CTX );                  \
    195         }                                       \
     188#define PB_CHECK_FLUSH( CTX, PB )               \
     189do {                                            \
     190        if ((PB)->count>=PB_SIZE-MAX_WIDTH) {   \
     191           gl_flush_pb( CTX );                  \
     192        }                                       \
    196193} while(0)
    197194
Note: See TracChangeset for help on using the changeset viewer.