Changeset 3597 for trunk/src/opengl/mesa/pb.h
- Timestamp:
- May 23, 2000, 10:35:01 PM (25 years ago)
- 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 sandervlExp $ */1 /* $Id: pb.h,v 1.2 2000-05-23 20:34:54 jeroen Exp $ */ 2 2 3 3 /* 4 4 * Mesa 3-D graphics library 5 * Version: 3. 15 * Version: 3.3 6 6 * 7 7 * Copyright (C) 1999 Brian Paul All Rights Reserved. … … 36 36 37 37 38 39 38 /* 40 39 * Pixel buffer size, must be larger than MAX_WIDTH. … … 44 43 45 44 struct pixel_buffer { 46 47 48 GLdepth z[PB_SIZE]; /* Z window coord in [0,MAX_DEPTH] */49 50 51 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 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*/ 61 60 }; 62 63 64 61 65 62 … … 68 65 * Set the color used for all subsequent pixels in the buffer. 69 66 */ 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 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; 81 78 82 79 … … 84 81 * Set the color index used for all subsequent pixels in the buffer. 85 82 */ 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 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; 92 89 93 90 … … 95 92 * "write" a pixel using current color or index 96 93 */ 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 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++; 102 99 103 100 … … 105 102 * "write" an RGBA pixel 106 103 */ 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 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++; 116 113 117 114 /* 118 115 * "write" a color-index pixel 119 116 */ 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 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++; 126 123 127 124 … … 129 126 * "write" an RGBA pixel with texture coordinates 130 127 */ 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 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++; 143 140 144 141 /* 145 142 * "write" an RGBA pixel with multiple texture coordinates 146 143 */ 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 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++; 162 159 163 160 /* 164 161 * "write" an RGBA pixel with multiple texture coordinates and specular color 165 162 */ 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 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++; 185 182 186 183 … … 189 186 * Call this function at least every MAX_WIDTH pixels: 190 187 */ 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 ) \ 189 do { \ 190 if ((PB)->count>=PB_SIZE-MAX_WIDTH) { \ 191 gl_flush_pb( CTX ); \ 192 } \ 196 193 } while(0) 197 194
Note:
See TracChangeset
for help on using the changeset viewer.