convert line ends
[canaan.git] / prj / tech / libsrc / g2 / dlh816.c
blob8e2fb7ea91919134ecfd2bfda07d49dcdbe141bb
1 // $Header: x:/prj/tech/libsrc/g2/RCS/dlh816.c 1.5 1998/04/28 14:31:10 KEVIN Exp $
3 #include <g2d.h>
4 #include <trirast.h>
5 #include <plyshell.h>
6 #include <genrast.h>
7 #include <tmapd.h>
8 #include <g2tm.h>
10 extern void light_il(fix i, fix di, int n);
11 extern void flat16_flat16_opaque_light_il(uchar *dst, uchar *src, int n, uchar *ltab);
12 extern g2il_func opaque_8to8_buffer_il;
13 extern void opaque_8to8_buffer_il_init(grs_bitmap *bm);
15 static void dry_lit_haze_il(g2s_raster *r, g2s_poly_params *tp)
17 int i;
18 uchar *buffer = tmap_buffer_end - 2*r->n;
19 opaque_8to8_buffer_il(r, tp);
20 for (i= - r->n; i<0; i++) {
21 int index, c;
22 uchar *clut;
24 c = tmap_buffer_end[i];
25 index = c>>6;
26 c &= 0x3f;
27 clut = g2d_dryness_table_list[index] +
28 ((fix_int(r->d)&g2d_dryness_mask_list[index])<<7);
29 tmap_buffer_end[2*i] = clut[2*c];
30 tmap_buffer_end[2*i+1] = clut[2*c+1];
31 r->d += tp->ddx;
33 light_il(r->i, tp->dix, r->n);
34 flat16_flat16_opaque_light_il(buffer, buffer, r->n, grd_light_table);
35 light_il(r->h, tp->dhx, r->n);
36 flat16_flat16_opaque_light_il(r->p + 2*r->x, buffer, r->n, g2d_haze_table);
39 void g2_dry_lit_haze_umap_setup(grs_bitmap *bm)
41 g2d_pp.flags = PPF_IUVHD;
42 g2d_pp.canvas_row = grd_bm.row;
43 g2d_pp.bm = bm;
44 g2d_pp.i_scale = grd_light_table_size;
45 g2d_pp.u_scale = bm->w;
46 g2d_pp.v_scale = bm->h;
47 g2d_pp.h_scale = g2d_haze_table_size;
48 g2d_pp.d_scale = g2d_dryness_table_size;
49 g2d_pp.inner_loop = dry_lit_haze_il;
50 g2d_pp.raster_func = gen_raster_loop;
51 g2d_pp.right_edge_func = gen_right_edge;
52 g2d_pp.left_edge_func = gen_left_edge;
53 g2d_pp.grad_func = gen_triangle_gradients;
54 g2d_pp.poly_func = g2_umap;
55 opaque_8to8_buffer_il_init(bm);
58 void g2_dry_lit_haze_umap(grs_bitmap *bm, int n, g2s_point **vpl)
60 g2_dry_lit_haze_umap_setup(bm);
61 g2_umap(n, vpl);