deepstone
diff src/mglrast.c @ 3:0e781cc43178
adding textures
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 21 Nov 2011 10:16:09 +0200 |
parents | f04884489bad |
children | bce78aaafc68 |
line diff
1.1 --- a/src/mglrast.c Mon Nov 21 10:15:37 2011 +0200 1.2 +++ b/src/mglrast.c Mon Nov 21 10:16:09 2011 +0200 1.3 @@ -32,6 +32,7 @@ 1.4 #define SCAN_LINE scan_line_flat 1.5 #undef INTERP_DEPTH 1.6 #undef INTERP_ENERGY 1.7 +#undef INTERP_TEX 1.8 #include "scantmpl.h" 1.9 #undef SCAN_EDGE 1.10 #undef SCAN_LINE 1.11 @@ -40,6 +41,7 @@ 1.12 #define SCAN_LINE scan_line_z 1.13 #define INTERP_DEPTH 1.14 #undef INTERP_ENERGY 1.15 +#undef INTERP_TEX 1.16 #include "scantmpl.h" 1.17 #undef SCAN_EDGE 1.18 #undef SCAN_LINE 1.19 @@ -48,6 +50,7 @@ 1.20 #define SCAN_LINE scan_line_e 1.21 #undef INTERP_DEPTH 1.22 #define INTERP_ENERGY 1.23 +#undef INTERP_TEX 1.24 #include "scantmpl.h" 1.25 #undef SCAN_EDGE 1.26 #undef SCAN_LINE 1.27 @@ -56,10 +59,48 @@ 1.28 #define SCAN_LINE scan_line_ze 1.29 #define INTERP_DEPTH 1.30 #define INTERP_ENERGY 1.31 +#undef INTERP_TEX 1.32 #include "scantmpl.h" 1.33 #undef SCAN_EDGE 1.34 #undef SCAN_LINE 1.35 1.36 +#define SCAN_EDGE scan_edge_t 1.37 +#define SCAN_LINE scan_line_t 1.38 +#undef INTERP_DEPTH 1.39 +#undef INTERP_ENERGY 1.40 +#define INTERP_TEX 1.41 +#include "scantmpl.h" 1.42 +#undef SCAN_EDGE 1.43 +#undef SCAN_LINE 1.44 + 1.45 +#define SCAN_EDGE scan_edge_zt 1.46 +#define SCAN_LINE scan_line_zt 1.47 +#define INTERP_DEPTH 1.48 +#undef INTERP_ENERGY 1.49 +#define INTERP_TEX 1.50 +#include "scantmpl.h" 1.51 +#undef SCAN_EDGE 1.52 +#undef SCAN_LINE 1.53 + 1.54 +#define SCAN_EDGE scan_edge_et 1.55 +#define SCAN_LINE scan_line_et 1.56 +#undef INTERP_DEPTH 1.57 +#define INTERP_ENERGY 1.58 +#define INTERP_TEX 1.59 +#include "scantmpl.h" 1.60 +#undef SCAN_EDGE 1.61 +#undef SCAN_LINE 1.62 + 1.63 +#define SCAN_EDGE scan_edge_zet 1.64 +#define SCAN_LINE scan_line_zet 1.65 +#define INTERP_DEPTH 1.66 +#define INTERP_ENERGY 1.67 +#define INTERP_TEX 1.68 +#include "scantmpl.h" 1.69 +#undef SCAN_EDGE 1.70 +#undef SCAN_LINE 1.71 + 1.72 + 1.73 static void (*scan_edge)(struct vertex*, struct vertex*); 1.74 static void (*scan_line)(int, unsigned char*); 1.75 1.76 @@ -91,19 +132,32 @@ 1.77 void mgl_rast_prepare(void) 1.78 { 1.79 static void (*sedge[])(struct vertex*, struct vertex*) = { 1.80 - scan_edge_flat, /* 00 */ 1.81 - scan_edge_z, /* 01 */ 1.82 - scan_edge_e, /* 10 */ 1.83 - scan_edge_ze /* 11 */ 1.84 + /* tez */ 1.85 + scan_edge_flat, /* 000 */ 1.86 + scan_edge_z, /* 001 */ 1.87 + scan_edge_e, /* 010 */ 1.88 + scan_edge_ze, /* 011 */ 1.89 + scan_edge_t, /* 100 */ 1.90 + scan_edge_zt, /* 101 */ 1.91 + scan_edge_et, /* 110 */ 1.92 + scan_edge_zet /* 111 */ 1.93 }; 1.94 static void (*sline[])(int, unsigned char*) = { 1.95 - scan_line_flat, /* 00 */ 1.96 - scan_line_z, /* 01 */ 1.97 - scan_line_e, /* 10 */ 1.98 - scan_line_ze /* 11 */ 1.99 + /* tez */ 1.100 + scan_line_flat, /* 000 */ 1.101 + scan_line_z, /* 001 */ 1.102 + scan_line_e, /* 010 */ 1.103 + scan_line_ze, /* 011 */ 1.104 + scan_line_t, /* 100 */ 1.105 + scan_line_zt, /* 101 */ 1.106 + scan_line_et, /* 110 */ 1.107 + scan_line_zet /* 111 */ 1.108 }; 1.109 int bits = 0; 1.110 1.111 + if((st->flags & MGL_TEXTURE_2D) && st->tex.pixels) { 1.112 + bits |= 4; 1.113 + } 1.114 if(st->flags & MGL_SMOOTH) { 1.115 bits |= 2; 1.116 }