⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fxtris.c

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 C
📖 第 1 页 / 共 4 页
字号:
#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_offset_fallback_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_unfilled_fallback_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_offset_unfilled_fallback_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_unfilled_fallback_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \	     FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_offset_unfilled_fallback_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"/* 2-sided stencil end */static void init_rast_tab( void ){   init();   init_offset();   init_twoside();   init_twoside_offset();   init_unfilled();   init_offset_unfilled();   init_twoside_unfilled();   init_twoside_offset_unfilled();   init_fallback();   init_offset_fallback();   init_twoside_fallback();   init_twoside_offset_fallback();   init_unfilled_fallback();   init_offset_unfilled_fallback();   init_twoside_unfilled_fallback();   init_twoside_offset_unfilled_fallback();   init_flat();   init_offset_flat();   init_twoside_flat();   init_twoside_offset_flat();   init_unfilled_flat();   init_offset_unfilled_flat();   init_twoside_unfilled_flat();   init_twoside_offset_unfilled_flat();   init_fallback_flat();   init_offset_fallback_flat();   init_twoside_fallback_flat();   init_twoside_offset_fallback_flat();   init_unfilled_fallback_flat();   init_offset_unfilled_fallback_flat();   init_twoside_unfilled_fallback_flat();   init_twoside_offset_unfilled_fallback_flat();   /* 2-sided stencil begin */   init_twostencil();   init_offset_twostencil();   init_twoside_twostencil();   init_twoside_offset_twostencil();   init_unfilled_twostencil();   init_offset_unfilled_twostencil();   init_twoside_unfilled_twostencil();   init_twoside_offset_unfilled_twostencil();   init_fallback_twostencil();   init_offset_fallback_twostencil();   init_twoside_fallback_twostencil();   init_twoside_offset_fallback_twostencil();   init_unfilled_fallback_twostencil();   init_offset_unfilled_fallback_twostencil();   init_twoside_unfilled_fallback_twostencil();   init_twoside_offset_unfilled_fallback_twostencil();   init_flat_twostencil();   init_offset_flat_twostencil();   init_twoside_flat_twostencil();   init_twoside_offset_flat_twostencil();   init_unfilled_flat_twostencil();   init_offset_unfilled_flat_twostencil();   init_twoside_unfilled_flat_twostencil();   init_twoside_offset_unfilled_flat_twostencil();   init_fallback_flat_twostencil();   init_offset_fallback_flat_twostencil();   init_twoside_fallback_flat_twostencil();   init_twoside_offset_fallback_flat_twostencil();   init_unfilled_fallback_flat_twostencil();   init_offset_unfilled_fallback_flat_twostencil();   init_twoside_unfilled_fallback_flat_twostencil();   init_twoside_offset_unfilled_fallback_flat_twostencil();   /* 2-sided stencil end */}/**********************************************************************//*                 Render whole begin/end objects                     *//**********************************************************************//* Accelerate vertex buffer rendering when renderindex == 0 and * there is no clipping. */#define INIT(x) fxRenderPrimitive( ctx, x )static void fx_render_vb_points( GLcontext *ctx,				 GLuint start,				 GLuint count,				 GLuint flags ){   fxMesaContext fxMesa = FX_CONTEXT(ctx);   GrVertex *fxVB = fxMesa->verts;   GLint i;   (void) flags;   if (TDFX_DEBUG & VERBOSE_VARRAY) {      fprintf(stderr, "fx_render_vb_points\n");   }   INIT(GL_POINTS);   /* Adjust point coords */   for (i = start; i < count; i++) {      fxVB[i].x += PNT_X_OFFSET - TRI_X_OFFSET;      fxVB[i].y += PNT_Y_OFFSET - TRI_Y_OFFSET;   }   grDrawVertexArrayContiguous( GR_POINTS, count-start,                                fxVB + start, sizeof(GrVertex));   /* restore point coords */   for (i = start; i < count; i++) {      fxVB[i].x -= PNT_X_OFFSET - TRI_X_OFFSET;      fxVB[i].y -= PNT_Y_OFFSET - TRI_Y_OFFSET;   }}static void fx_render_vb_line_strip( GLcontext *ctx,				     GLuint start,				     GLuint count,				     GLuint flags ){   fxMesaContext fxMesa = FX_CONTEXT(ctx);   GrVertex *fxVB = fxMesa->verts;   GLint i;   (void) flags;   if (TDFX_DEBUG & VERBOSE_VARRAY) {      fprintf(stderr, "fx_render_vb_line_strip\n");   }   INIT(GL_LINE_STRIP);   /* adjust line coords */   for (i = start; i < count; i++) {      fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;      fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;   }   grDrawVertexArrayContiguous( GR_LINE_STRIP, count-start,                                fxVB + start, sizeof(GrVertex));   /* restore line coords */   for (i = start; i < count; i++) {      fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;      fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;   }}static void fx_render_vb_line_loop( GLcontext *ctx,				    GLuint start,				    GLuint count,				    GLuint flags ){   fxMesaContext fxMesa = FX_CONTEXT(ctx);   GrVertex *fxVB = fxMesa->verts;   GLint i;   GLint j = start;   (void) flags;   if (TDFX_DEBUG & VERBOSE_VARRAY) {      fprintf(stderr, "fx_render_vb_line_loop\n");   }   INIT(GL_LINE_LOOP);   if (!(flags & PRIM_BEGIN)) {      j++;   }   /* adjust line coords */   for (i = start; i < count; i++) {      fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;      fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;   }   grDrawVertexArrayContiguous( GR_LINE_STRIP, count-j,                                fxVB + j, sizeof(GrVertex));   if (flags & PRIM_END)      grDrawLine( fxVB + (count - 1),                  fxVB + start );   /* restore line coords */   for (i = start; i < count; i++) {      fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;      fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;   }}static void fx_render_vb_lines( GLcontext *ctx,				GLuint start,				GLuint count,				GLuint flags ){   fxMesaContext fxMesa = FX_CONTEXT(ctx);   GrVertex *fxVB = fxMesa->verts;   GLint i;   (void) flags;   if (TDFX_DEBUG & VERBOSE_VARRAY) {      fprintf(stderr, "fx_render_vb_lines\n");   }   INIT(GL_LINES);   /* adjust line coords */   for (i = start; i < count; i++) {      fxVB[i].x += LINE_X_OFFSET - TRI_X_OFFSET;      fxVB[i].y += LINE_Y_OFFSET - TRI_Y_OFFSET;   }   grDrawVertexArrayContiguous( GR_LINES, count-start,                                fxVB + start, sizeof(GrVertex));   /* restore line coords */   for (i = start; i < count; i++) {      fxVB[i].x -= LINE_X_OFFSET - TRI_X_OFFSET;      fxVB[i].y -= LINE_Y_OFFSET - TRI_Y_OFFSET;   }}static void fx_render_vb_triangles( GLcontext *ctx,				    GLuint start,				    GLuint count,				    GLuint flags ){   fxMesaContext fxMesa = FX_CONTEXT(ctx);   GrVertex *fxVB = fxMesa->verts;   GLuint j;   (void) flags;   if (TDFX_DEBUG & VERBOSE_VARRAY) {      fprintf(stderr, "fx_render_vb_triangles\n");   }   INIT(GL_TRIANGLES);   for (j=start+2; j<count; j+=3) {      grDrawTriangle(fxVB + (j-2), fxVB + (j-1), fxVB + j);   }}static void fx_render_vb_tri_strip( GLcontext *ctx,				    GLuint start,				    GLuint count,				    GLuint flags ){   fxMesaContext fxMesa = FX_CONTEXT(ctx);   GrVertex *fxVB = fxMesa->verts;   (void) flags;   if (TDFX_DEBUG & VERBOSE_VARRAY) {      fprintf(stderr, "fx_render_vb_tri_strip\n");   }   INIT(GL_TRIANGLE_STRIP);   /* no GR_TRIANGLE_STRIP_CONTINUE?!? */   grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP, count-start,                                fxVB + start, sizeof(GrVertex));}static void fx_render_vb_tri_fan( GLcontext *ctx,				  GLuint start,				  GLuint count,				  GLuint flags ){   fxMesaContext fxMesa = FX_CONTEXT(ctx);   GrVertex *fxVB = fxMesa->verts;   (void) flags;   if (TDFX_DEBUG & VERBOSE_VARRAY) {      fprintf(stderr, "fx_render_vb_tri_fan\n");   }   INIT(GL_TRIANGLE_FAN);   grDrawVertexArrayContiguous( GR_TRIANGLE_FAN, count-start,                                fxVB + start, sizeof(GrVertex) );}static void fx_render_vb_quads( GLcontext *ctx,				GLuint start,				GLuint count,				GLuint flags ){   fxMesaContext fxMesa = FX_CONTEXT(ctx);   GrVertex *fxVB = fxMesa->verts;   GLuint i;   (void) flags;   if (TDFX_DEBUG & VERBOSE_VARRAY) {      fprintf(stderr, "fx_render_vb_quads\n");   }   INIT(GL_QUADS);   for (i = start + 3 ; i < count ; i += 4 ) {#define VERT(x) (fxVB + (x))      GrVertex *_v_[4];      _v_[0] = VERT(i);      _v_[1] = VERT(i-3);      _v_[2] = VERT(i-2);      _v_[3] = VERT(i-1);      grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);      /*grDrawTriangle( VERT(i-3), VERT(i-2), VERT(i) );*/      /*grDrawTriangle( VERT(i-2), VERT(i-1), VERT(i) );*/#undef VERT   }}static void fx_render_vb_quad_strip( GLcontext *ctx,				     GLuint start,				     GLuint count,				     GLuint flags ){   fxMesaContext fxMesa = FX_CONTEXT(ctx);   GrVertex *fxVB = fxMesa->verts;   (void) flags;   if (TDFX_DEBUG & VERBOSE_VARRAY) {      fprintf(stderr, "fx_render_vb_quad_strip\n");   }   INIT(GL_QUAD_STRIP);   count -= (count-start)&1;   grDrawVertexArrayContiguous( GR_TRIANGLE_STRIP,                                count-start, fxVB + start, sizeof(GrVertex));}static void fx_render_vb_poly( GLcontext *ctx,				GLuint start,				GLuint count,				GLuint flags ){   fxMesaContext fxMesa = FX_CONTEXT(ctx);   GrVertex *fxVB = fxMesa->verts;   (void) flags;   if (TDFX_DEBUG & VERBOSE_VARRAY) {      fprintf(stderr, "fx_render_vb_poly\n");   }   INIT(GL_POLYGON);   grDrawVertexArrayContiguous( GR_POLYGON, count-start,                                fxVB + start, sizeof(GrVertex));}static void fx_render_vb_noop( GLcontext *ctx,				 GLuint start,				 GLuint count,				 GLuint flags ){   (void) (ctx && start && count && flags);}static void (*fx_render_tab_verts[GL_POLYGON+2])(GLcontext *,						   GLuint,						   GLuint,						   GLuint) ={   fx_render_vb_points,   fx_render_vb_lines,   fx_render_vb_line_loop,   fx_render_vb_line_strip,   fx_render_vb_triangles,   fx_render_vb_tri_strip,   fx_render_vb_tri_fan,   fx_render_vb_quads,   fx_render_vb_quad_strip,   fx_render_vb_poly,   fx_render_vb_noop,};#undef INIT/**********************************************************************//*            Render whole (indexed) begin/end objects                *//**********************************************************************/#define VERT(x) (vertptr + x)#define RENDER_POINTS( start, count )		\   for ( ; start < count ; start++)		\      grDrawPoint( VERT(ELT(start)) );#define RENDER_LINE( v0, v1 ) \   grDrawLine( VERT(v0), VERT(v1) )#define RENDER_TRI( v0, v1, v2 )  \   grDrawTriangle( VERT(v0), VERT(v1), VERT(v2) )#define RENDER_QUAD( v0, v1, v2, v3 ) \   do {	\      GrVertex *_v_[4];	\      _v_[0] = VERT(v3);\      _v_[1] = VERT(v0);\      _v_[2] = VERT(v1);\      _v_[3] = VERT(v2);\      grDrawVertexArray(GR_TRIANGLE_FAN, 4, _v_);\      /*grDrawTriangle( VERT(v0), VERT(v1), VERT(v3) );*/\      /*grDrawTriangle( VERT(v1), VERT(v2), VERT(v3) );*/\   } while (0)#define INIT(x) fxRenderPrimitive( ctx, x )#undef LOCAL_VARS#define LOCAL_VARS						\    fxMesaContext fxMesa = FX_CONTEXT(ctx);			\    GrVertex *vertptr = fxMesa->verts;		\    const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts;	\    (void) elt;#define RESET_STIPPLE#define RESET_OCCLUSION#define PRESERVE_VB_DEFS/* Elts, no clipping. */#undef ELT#undef TAG#define TAG(x) fx_##x##_elts#define ELT(x) elt[x]#include "tnl_dd/t_dd_rendertmp.h"/* Verts, no clipping. */#undef ELT#undef TAG

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -