- red = VB->ColorPtr->data[i][0];
- green = VB->ColorPtr->data[i][1];
- blue = VB->ColorPtr->data[i][2];
-
- switch (VB->TexCoordPtr[0]->size) {
- case 4:
- s = (VB->TexCoordPtr[0]->data[i][0]/
- VB->TexCoordPtr[0]->data[i][3]);
- t = (VB->TexCoordPtr[0]->data[i][1]/
- VB->TexCoordPtr[0]->data[i][3]);
- u = (VB->TexCoordPtr[0]->data[i][2]/
- VB->TexCoordPtr[0]->data[i][3]);
- break;
- case 3:
- s = VB->TexCoordPtr[0]->data[i][0];
- t = VB->TexCoordPtr[0]->data[i][1];
- u = VB->TexCoordPtr[0]->data[i][2];
- break;
- case 2:
- s = VB->TexCoordPtr[0]->data[i][0];
- t = VB->TexCoordPtr[0]->data[i][1];
- u = 0.0;
- break;
- case 1:
- s = VB->TexCoordPtr[0]->data[i][0];
- t = 0.0;
- u = 0.0;
- break;
- }
-
- if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
- /* Multitextured! This is probably a slow enough path that
- there's no reason to specialize the multitexture case. */
- switch (VB->TexCoordPtr[1]->size) {
- case 4:
- s1 = ( VB->TexCoordPtr[1]->data[i][0] /
- VB->TexCoordPtr[1]->data[i][3] );
- t1 = ( VB->TexCoordPtr[1]->data[i][1] /
- VB->TexCoordPtr[1]->data[i][3] );
- u1 = ( VB->TexCoordPtr[1]->data[i][2] /
- VB->TexCoordPtr[1]->data[i][3] );
- break;
- case 3:
- s1 = VB->TexCoordPtr[1]->data[i][0];
- t1 = VB->TexCoordPtr[1]->data[i][1];
- u1 = VB->TexCoordPtr[1]->data[i][2];
- break;
- case 2:
- s1 = VB->TexCoordPtr[1]->data[i][0];
- t1 = VB->TexCoordPtr[1]->data[i][1];
- u1 = 0.0;
- break;
- case 1:
- s1 = VB->TexCoordPtr[1]->data[i][0];
- t1 = 0.0;
- u1 = 0.0;
- break;
- }
- }
-
- for (y=ymin;y<=ymax;y++) {
- for (x=xmin;x<=xmax;x++) {
- GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
- GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
- GLfloat dist2 = dx*dx + dy*dy;
- if (dist2<rmax2) {
- alpha = VB->ColorPtr->data[i][3];
- if (dist2>=rmin2) {
- GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
- /* coverage is in [0,256] */
- alpha = (alpha * coverage) >> 8;
- }
- alpha = (GLint) (alpha * alphaf);
- if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
- PB_WRITE_MULTITEX_PIXEL( PB, x,y,z, red, green, blue, alpha, s, t, u, s1, t1, u1 );
- } else {
- PB_WRITE_TEX_PIXEL( PB, x,y,z, red, green, blue, alpha, s, t, u );
- }
- }
- }
- }
- PB_CHECK_FLUSH(ctx,PB);
- }
- }
- }
- else {
- /* Not texture mapped */
- for (i=first;i<=last;i++) {
- if (VB->ClipMask[i]==0) {
- GLint xmin, ymin, xmax, ymax;
- GLint x, y, z;
- GLint red, green, blue, alpha;
-
- dsize=psize*dist[i];
- if(dsize>=ctx->Point.Threshold) {
- radius=(MIN2(dsize,ctx->Point.MaxSize)*0.5F);
- alphaf=1.0;
- } else {
- radius=(MAX2(ctx->Point.Threshold,ctx->Point.MinSize)*0.5F);
- dsize/=ctx->Point.Threshold;
- alphaf=(dsize*dsize);
- }
- rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */
- rmax = radius + 0.7071F;
- rmin2 = rmin*rmin;
- rmax2 = rmax*rmax;
- cscale = 256.0F / (rmax2-rmin2);
-
- xmin = (GLint) (VB->Win.data[i][0] - radius);
- xmax = (GLint) (VB->Win.data[i][0] + radius);
- ymin = (GLint) (VB->Win.data[i][1] - radius);
- ymax = (GLint) (VB->Win.data[i][1] + radius);
- z = (GLint) (VB->Win.data[i][2] + ctx->PointZoffset);
-
- red = VB->ColorPtr->data[i][0];
- green = VB->ColorPtr->data[i][1];
- blue = VB->ColorPtr->data[i][2];
-
- for (y=ymin;y<=ymax;y++) {
- for (x=xmin;x<=xmax;x++) {
- GLfloat dx = x/*+0.5F*/ - VB->Win.data[i][0];
- GLfloat dy = y/*+0.5F*/ - VB->Win.data[i][1];
- GLfloat dist2 = dx*dx + dy*dy;
- if (dist2<rmax2) {
- alpha = VB->ColorPtr->data[i][3];
- if (dist2>=rmin2) {
- GLint coverage = (GLint) (256.0F-(dist2-rmin2)*cscale);
- /* coverage is in [0,256] */
- alpha = (alpha * coverage) >> 8;
- }
- alpha = (GLint) (alpha * alphaf);
- PB_WRITE_RGBA_PIXEL( PB, x, y, z, red, green, blue, alpha )
- ;
- }
- }
- }
- PB_CHECK_FLUSH(ctx,PB);
- }
- }
- }
-}
-
-
-/*
- * Examine the current context to determine which point drawing function
- * should be used.
- */
-void gl_set_point_function( GLcontext *ctx )
-{
- GLboolean rgbmode = ctx->Visual->RGBAflag;
-
- if (ctx->RenderMode==GL_RENDER) {
- if (ctx->NoRaster) {
- ctx->Driver.PointsFunc = null_points;
- return;
- }
- if (ctx->Driver.PointsFunc) {
- /* Device driver will draw points. */
- ctx->IndirectTriangles &= ~DD_POINT_SW_RASTERIZE;
- return;
- }
-
- if (!ctx->Point.Attenuated) {
- if (ctx->Point.SmoothFlag && rgbmode) {
- ctx->Driver.PointsFunc = antialiased_rgba_points;
- }
- else if (ctx->Texture.ReallyEnabled) {
- if (ctx->Texture.ReallyEnabled >= TEXTURE1_1D) {
- ctx->Driver.PointsFunc = multitextured_rgba_points;
- }
- else {
- ctx->Driver.PointsFunc = textured_rgba_points;
- }
- }
- else if (ctx->Point.Size==1.0) {
- /* size=1, any raster ops */
- if (rgbmode)
- ctx->Driver.PointsFunc = size1_rgba_points;
- else
- ctx->Driver.PointsFunc = size1_ci_points;
- }
- else {
- /* every other kind of point rendering */
- if (rgbmode)
- ctx->Driver.PointsFunc = general_rgba_points;
- else
- ctx->Driver.PointsFunc = general_ci_points;
- }
- }
- else if(ctx->Point.SmoothFlag && rgbmode) {
- ctx->Driver.PointsFunc = dist_atten_antialiased_rgba_points;
- }
- else if (ctx->Texture.ReallyEnabled) {
- ctx->Driver.PointsFunc = dist_atten_textured_rgba_points;
- }
- else {
- /* every other kind of point rendering */
- if (rgbmode)
- ctx->Driver.PointsFunc = dist_atten_general_rgba_points;
- else
- ctx->Driver.PointsFunc = dist_atten_general_ci_points;
- }