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

📄 fxtris.c

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 C
📖 第 1 页 / 共 4 页
字号:
 if (ctx->Point.PointSprite) {    fx_draw_point_sprite(fxMesa, v0, psize);    return; } radius = psize / 2.0F; n = IROUND(psize * 2); /* radius x 4 */ if (n < 4) n = 4; oon = 1.0F / (GLfloat)n; /* CLIP_LOOP ?!? */ /* point coverage? */ /* we don't care about culling here (see fxSetupCull) */ vtxB = *v0; vtxC = *v0; vtxB.x += radius; for (i = 1; i <= n; i++) {     ang = M_2PI * i * oon;     vtxC.x = v0->x + radius * __GL_COSF(ang);     vtxC.y = v0->y + radius * __GL_SINF(ang);     grAADrawTriangle( v0, &vtxB, &vtxC, FXFALSE, FXTRUE, FXFALSE);     /*grDrawTriangle( v0, &vtxB, &vtxC);*/     vtxB.x = vtxC.x;     vtxB.y = vtxC.y; }}#undef __GLCOSF#undef __GLSINF#undef M_2PI#undef DO_FALLBACK#define FX_UNFILLED_BIT    0x1#define FX_OFFSET_BIT	   0x2#define FX_TWOSIDE_BIT     0x4#define FX_FLAT_BIT        0x8#define FX_TWOSTENCIL_BIT  0x10#define FX_FALLBACK_BIT    0x20#define FX_MAX_TRIFUNC     0x40static struct {   tnl_points_func	points;   tnl_line_func	line;   tnl_triangle_func	triangle;   tnl_quad_func	quad;} rast_tab[FX_MAX_TRIFUNC];#define DO_FALLBACK (IND & FX_FALLBACK_BIT)#define DO_OFFSET   (IND & FX_OFFSET_BIT)#define DO_UNFILLED (IND & FX_UNFILLED_BIT)#define DO_TWOSIDE  (IND & FX_TWOSIDE_BIT)#define DO_FLAT     (IND & FX_FLAT_BIT)#define DO_TWOSTENCIL (IND & FX_TWOSTENCIL_BIT)#define DO_TRI       1#define DO_QUAD      1#define DO_LINE      1#define DO_POINTS    1#define DO_FULL_QUAD 1#define HAVE_RGBA   1#define HAVE_SPEC   1#define HAVE_HW_FLATSHADE 0#define HAVE_BACK_COLORS  0#define VERTEX GrVertex#define TAB rast_tab#define DEPTH_SCALE 1.0#define UNFILLED_TRI unfilled_tri#define UNFILLED_QUAD unfilled_quad#define VERT_X(_v) _v->x#define VERT_Y(_v) _v->y#define VERT_Z(_v) _v->ooz#define AREA_IS_CCW( a ) IS_NEGATIVE( a )#define GET_VERTEX(e) (fxMesa->verts + e)#if FX_PACKEDCOLOR#define VERT_SET_RGBA( dst, f )			\do {						\   UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[2], f[0]);\   UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[1], f[1]);\   UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[0], f[2]);\   UNCLAMPED_FLOAT_TO_UBYTE(dst->pargb[3], f[3]);\} while (0)#define VERT_COPY_RGBA( v0, v1 ) 		\   *(GLuint *)&v0->pargb = *(GLuint *)&v1->pargb#define VERT_SAVE_RGBA( idx )  			\   *(GLuint *)&color[idx] = *(GLuint *)&v[idx]->pargb#define VERT_RESTORE_RGBA( idx )		\   *(GLuint *)&v[idx]->pargb = *(GLuint *)&color[idx]#define VERT_SET_SPEC( dst, f )			\do {						\   UNCLAMPED_FLOAT_TO_UBYTE(dst->pspec[2], f[0]);\   UNCLAMPED_FLOAT_TO_UBYTE(dst->pspec[1], f[1]);\   UNCLAMPED_FLOAT_TO_UBYTE(dst->pspec[0], f[2]);\} while (0)#define VERT_COPY_SPEC( v0, v1 ) 		\   *(GLuint *)&v0->pspec = *(GLuint *)&v1->pspec#define VERT_SAVE_SPEC( idx )  			\   *(GLuint *)&spec[idx] = *(GLuint *)&v[idx]->pspec#define VERT_RESTORE_SPEC( idx )		\   *(GLuint *)&v[idx]->pspec = *(GLuint *)&spec[idx]#define LOCAL_VARS(n)				\   fxMesaContext fxMesa = FX_CONTEXT(ctx);	\   GLubyte color[n][4], spec[n][4];		\   (void) color; (void) spec;#else  /* !FX_PACKEDCOLOR */#define VERT_SET_RGBA( dst, f )	\do {				\   CNORM(dst->r, f[0]);		\   CNORM(dst->g, f[1]);		\   CNORM(dst->b, f[2]);		\   CNORM(dst->a, f[3]);		\} while (0)#define VERT_COPY_RGBA( v0, v1 ) 		\do {						\   COPY_FLOAT(v0->r, v1->r);			\   COPY_FLOAT(v0->g, v1->g);			\   COPY_FLOAT(v0->b, v1->b);			\   COPY_FLOAT(v0->a, v1->a);			\} while (0)#define VERT_SAVE_RGBA( idx )  			\do {						\   COPY_FLOAT(color[idx][0], v[idx]->r);	\   COPY_FLOAT(color[idx][1], v[idx]->g);	\   COPY_FLOAT(color[idx][2], v[idx]->b);	\   COPY_FLOAT(color[idx][3], v[idx]->a);	\} while (0)#define VERT_RESTORE_RGBA( idx )		\do {						\   COPY_FLOAT(v[idx]->r, color[idx][0]);	\   COPY_FLOAT(v[idx]->g, color[idx][1]);	\   COPY_FLOAT(v[idx]->b, color[idx][2]);	\   COPY_FLOAT(v[idx]->a, color[idx][3]);	\} while (0)#define VERT_SET_SPEC( dst, f )	\do {				\   CNORM(dst->r1, f[0]);	\   CNORM(dst->g1, f[1]);	\   CNORM(dst->b1, f[2]);	\} while (0)#define VERT_COPY_SPEC( v0, v1 ) 		\do {						\   COPY_FLOAT(v0->r1, v1->r1);			\   COPY_FLOAT(v0->g1, v1->g1);			\   COPY_FLOAT(v0->b1, v1->b1);			\} while (0)#define VERT_SAVE_SPEC( idx )  			\do {						\   COPY_FLOAT(spec[idx][0], v[idx]->r1);	\   COPY_FLOAT(spec[idx][1], v[idx]->g1);	\   COPY_FLOAT(spec[idx][2], v[idx]->b1);	\} while (0)#define VERT_RESTORE_SPEC( idx )		\do {						\   COPY_FLOAT(v[idx]->r1, spec[idx][0]);	\   COPY_FLOAT(v[idx]->g1, spec[idx][1]);	\   COPY_FLOAT(v[idx]->b1, spec[idx][2]);	\} while (0)#define LOCAL_VARS(n)				\   fxMesaContext fxMesa = FX_CONTEXT(ctx);	\   GLfloat color[n][4], spec[n][4];		\   (void) color; (void) spec;#endif /* !FX_PACKEDCOLOR *//*********************************************************************** *            Twoside stencil                                          * ***********************************************************************/#define SETUP_STENCIL(f) if (f) fxSetupStencilFace(ctx, f)#define UNSET_STENCIL(f) if (f) fxSetupStencil(ctx)/*********************************************************************** *            Functions to draw basic unfilled primitives              * ***********************************************************************/#define RASTERIZE(x) if (fxMesa->raster_primitive != reduced_prim[x]) \                        fxRasterPrimitive( ctx, reduced_prim[x] )#define RENDER_PRIMITIVE fxMesa->render_primitive#define IND FX_FALLBACK_BIT#define TAG(x) x#include "tnl_dd/t_dd_unfilled.h"#undef IND/*********************************************************************** *                 Functions to draw GL primitives                     * ***********************************************************************/#define IND (0)#define TAG(x) x#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT)#define TAG(x) x##_offset#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT)#define TAG(x) x##_twoside#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT)#define TAG(x) x##_twoside_offset#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_UNFILLED_BIT)#define TAG(x) x##_unfilled#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT)#define TAG(x) x##_offset_unfilled#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT)#define TAG(x) x##_twoside_unfilled#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT)#define TAG(x) x##_twoside_offset_unfilled#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_FALLBACK_BIT)#define TAG(x) x##_fallback#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT)#define TAG(x) x##_offset_fallback#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT)#define TAG(x) x##_twoside_fallback#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT)#define TAG(x) x##_twoside_offset_fallback#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT)#define TAG(x) x##_unfilled_fallback#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT)#define TAG(x) x##_offset_unfilled_fallback#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT)#define TAG(x) x##_twoside_unfilled_fallback#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \	     FX_FALLBACK_BIT)#define TAG(x) x##_twoside_offset_unfilled_fallback#include "tnl_dd/t_dd_tritmp.h"/* Fx doesn't support provoking-vertex flat-shading? */#define IND (FX_FLAT_BIT)#define TAG(x) x##_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_FLAT_BIT)#define TAG(x) x##_offset_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_FLAT_BIT)#define TAG(x) x##_twoside_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FLAT_BIT)#define TAG(x) x##_twoside_offset_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_UNFILLED_BIT|FX_FLAT_BIT)#define TAG(x) x##_unfilled_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT)#define TAG(x) x##_offset_unfilled_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT)#define TAG(x) x##_twoside_unfilled_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT)#define TAG(x) x##_twoside_offset_unfilled_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_FALLBACK_BIT|FX_FLAT_BIT)#define TAG(x) x##_fallback_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)#define TAG(x) x##_offset_fallback_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)#define TAG(x) x##_twoside_fallback_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)#define TAG(x) x##_twoside_offset_fallback_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)#define TAG(x) x##_unfilled_fallback_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)#define TAG(x) x##_offset_unfilled_fallback_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT)#define TAG(x) x##_twoside_unfilled_fallback_flat#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \	     FX_FALLBACK_BIT|FX_FLAT_BIT)#define TAG(x) x##_twoside_offset_unfilled_fallback_flat#include "tnl_dd/t_dd_tritmp.h"/* 2-sided stencil begin */#define IND (FX_TWOSTENCIL_BIT)#define TAG(x) x##_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_offset_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_offset_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_UNFILLED_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_unfilled_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_offset_unfilled_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_unfilled_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_offset_unfilled_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_fallback_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_offset_fallback_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_fallback_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_offset_fallback_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_unfilled_fallback_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_offset_unfilled_fallback_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_unfilled_fallback_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT| \	     FX_FALLBACK_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_offset_unfilled_fallback_twostencil#include "tnl_dd/t_dd_tritmp.h"/* Fx doesn't support provoking-vertex flat-shading? */#define IND (FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_offset_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_offset_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_UNFILLED_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_unfilled_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_offset_unfilled_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_unfilled_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_OFFSET_BIT|FX_UNFILLED_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_offset_unfilled_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_fallback_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_OFFSET_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_offset_fallback_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"#define IND (FX_TWOSIDE_BIT|FX_FALLBACK_BIT|FX_FLAT_BIT|FX_TWOSTENCIL_BIT)#define TAG(x) x##_twoside_fallback_flat_twostencil#include "tnl_dd/t_dd_tritmp.h"

⌨️ 快捷键说明

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