1 ;THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
2 ;SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
3 ;END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
4 ;ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
5 ;IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
6 ;SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
7 ;FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
8 ;CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
9 ;AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
10 ;COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
12 ; $Source: /cvs/cvsroot/d2x/texmap/tmap_flt.asm,v $
13 ; $Revision: 1.1.1.1 $
15 ; $Date: 2001-01-19 03:30:16 $
17 ; Flat shader derived from texture mapper (kind of slow)
19 ; $Log: not supported by cvs2svn $
20 ; Revision 1.1.1.1 1999/06/14 22:13:53 donut
21 ; Import of d1x 1.37 source.
23 ; Revision 1.10 1995/02/20 18:22:53 john
24 ; Put all the externs in the assembly modules into tmap_inc.asm.
25 ; Also, moved all the C versions of the inner loops into a new module,
28 ; Revision 1.9 1995/02/20 17:08:51 john
29 ; Added code so that you can build the tmapper with no assembly!
31 ; Revision 1.8 1994/12/02 23:29:21 mike
32 ; change jb/ja to jl/jg.
34 ; Revision 1.7 1994/11/12 16:39:35 mike
37 ; Revision 1.6 1994/08/09 11:27:53 john
40 ; Revision 1.5 1994/07/08 17:43:11 john
41 ; Added flat-shaded-zbuffered polygon.
43 ; Revision 1.4 1994/04/08 16:25:43 mike
44 ; optimize inner loop of flat shader.
46 ; Revision 1.3 1994/03/31 08:34:20 mike
47 ; Optimized (well, speeded-up) inner loop for tmap-based flat shader.
49 ; Revision 1.2 1993/11/22 10:24:57 mike
50 ; *** empty log message ***
52 ; Revision 1.1 1993/09/08 17:29:46 mike
60 global _asm_tmap_scanline_flat
61 global asm_tmap_scanline_flat
65 %include "tmap_inc.asm"
69 ; --------------------------------------------------------------------------------------------------
71 ; _xleft fixed point left x coordinate
72 ; _xright fixed point right x coordinate
73 ; _y fixed point y coordinate
74 ;**; _pixptr address of source pixel map
76 ; for (x = (int) xleft; x <= (int) xright; x++) {
77 ; _setcolor(read_pixel_from_tmap(srcb,((int) (u/z)) & 63,((int) (v/z)) & 63));
84 _asm_tmap_scanline_flat:
85 asm_tmap_scanline_flat:
88 ; Setup for loop: _loop_count iterations = (int) xright - (int) xleft
89 ;**; esi source pixel pointer = pixptr
90 ; edi initial row pointer = y*320+x
92 ; set esi = pointer to start of texture map data
95 ; set edi = address of first pixel to modify
97 cmp edi,[_window_bottom]
100 imul edi,[_bytes_per_row]
107 add edi,[_write_buffer]
109 ; set _loop_count = # of iterations
112 cmp eax,[_window_right]
114 mov eax,[_window_right]
115 eax_ok1: cmp eax,[_window_left]
117 mov eax,[_window_left]
123 cmp eax,[_window_width]
125 mov eax,[_window_width]
130 ; edi = destination pixel pointer
131 cmp dword [_tmap_flat_cthru_table], 0
134 mov al,[_tmap_flat_color]
148 _no_full_words: adc ecx,ecx ; if cy set, then write one more pixel (ecx == 0)
149 rep stosb ; write 0 or 1 pixel
155 mov esi, [_tmap_flat_cthru_table]
159 ; edi = dest, esi = table, ecx = count
162 mov al, [edi] ; get already drawn pixel
163 mov al, [eax+esi] ; xlat thru cthru table
164 mov [edi],al ; write it