home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mesa5.zip / mesa5src.zip / swrast_setup / ss_triangle1.cpp < prev    next >
Text File  |  2002-12-23  |  3KB  |  94 lines

  1.  
  2. #include "glheader.h"
  3. #include "colormac.h"
  4. //#include "macros.h"
  5. #include "mtypes.h"
  6.  
  7. #include "tnl/t_context.h"
  8.  
  9. #include "ss_triangle.h"
  10. //#include "ss_context.h"
  11.  
  12. #define SS_RGBA_BIT         0x1
  13. #define SS_OFFSET_BIT      0x2
  14. #define SS_TWOSIDE_BIT     0x4
  15. #define SS_UNFILLED_BIT            0x8
  16. #define SS_MAX_TRIFUNC      0x10
  17.  
  18. //static triangle_func tri_tab[SS_MAX_TRIFUNC];
  19. //static quad_func     quad_tab[SS_MAX_TRIFUNC];
  20.  
  21. void
  22.  _swsetup_render_line_tri( GLcontext *ctx,
  23.                                      GLuint e0, GLuint e1, GLuint e2,
  24.                                       GLuint facing );
  25.  void _swsetup_render_point_tri( GLcontext *ctx,
  26.                                       GLuint e0, GLuint e1, GLuint e2,
  27.                                        GLuint facing );
  28.  
  29. extern void
  30. _mesa_debug( const __GLcontext *ctx, const char *fmtString, ... );
  31.  
  32.  
  33.  
  34. void triangle_rgba(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
  35. {
  36. static   SWvertex *verts = ((SScontext *)ctx->swsetup_context)->verts;
  37. static   SWvertex *v[3];
  38.  
  39.    v[0] = &verts[e0];
  40.    v[1] = &verts[e1];
  41.    v[2] = &verts[e2];
  42.  
  43. //_mesa_debug( ctx, "e0=%i,e1=%i,e2=%i\n",e0,e1,e2);
  44. // _mesa_debug(ctx, "triangle_rgba call  _swrast_Triangle\n");
  45.  
  46.       _swrast_Triangle( ctx, v[0], v[1], v[2] );
  47. // _mesa_debug(ctx, "triangle_rgba Return  _swrast_Triangle\n");
  48.  
  49. }
  50.  
  51. GLcontext *ctx0000;
  52.  
  53. void _Optlink triangle_rgba_Optlink(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
  54. {
  55.    struct vertex_buffer *VB = &((TNLcontext *)(ctx->swtnl_context))->vb;
  56. static   SWvertex *verts = ((SScontext *)ctx->swsetup_context)->verts;
  57. static   SWvertex *v[3];
  58.  
  59.    GLfloat z[3];
  60.    GLfloat offset;
  61. const GLenum mode = 0x1B02;
  62.    GLuint facing = 0;
  63.  
  64. ctx0000 = ctx;
  65.  
  66.    v[0] = &verts[e0];
  67.    v[1] = &verts[e1];
  68.    v[2] = &verts[e2];
  69.  
  70. //_mesa_debug( ctx, "e0=%i,e1=%i,e2=%i\n",e0,e1,e2);
  71.  
  72.  
  73.    if (mode == 0x1B00) {
  74.       if (((0|0x1) & 0x2) && ctx->Polygon.OffsetPoint) {
  75.         v[0]->win[2] += offset;
  76.         v[1]->win[2] += offset;
  77.         v[2]->win[2] += offset;
  78.       }
  79.       _swsetup_render_point_tri( ctx, e0, e1, e2, facing );
  80.    } else if (mode == 0x1B01) {
  81.       if (((0|0x1) & 0x2) && ctx->Polygon.OffsetLine) {
  82.         v[0]->win[2] += offset;
  83.         v[1]->win[2] += offset;
  84.         v[2]->win[2] += offset;
  85.       }
  86.       _swsetup_render_line_tri( ctx, e0, e1, e2, facing );
  87.    } else {
  88. // _mesa_debug(ctx, "triangle_rgba_Optlink call  _swrast_Triangle\n");
  89.       _swrast_Triangle( ctx, v[0], v[1], v[2] );
  90. // _mesa_debug(ctx, "triangle_rgba_Optlink return  _swrast_Triangle\n");
  91.    }
  92. }
  93.  
  94.