Subversion Repositories Kolibri OS

Rev

Rev 5159 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5159 Rev 8069
Line 23... Line 23...
23
endl
23
endl
24
pushad
24
pushad
Line 25... Line 25...
25
 
25
 
26
	mov eax,[p1]
26
	mov eax,[p1]
27
	mov ebx,[p2]
27
	mov ebx,[p2]
28
	mov ecx,[ebx+offs_zbup_y]
28
	mov ecx,[ebx+ZBufferPoint.y]
29
	cmp [eax+offs_zbup_y], ecx ;if (p1.y > p2.y)
29
	cmp [eax+ZBufferPoint.y], ecx ;if (p1.y > p2.y)
30
	jg @f
30
	jg @f
31
	jl .end_0 ;if (p1.y != p2.y)
31
	jl .end_0 ;if (p1.y != p2.y)
32
	mov ecx,[ebx+offs_zbup_x]
32
	mov ecx,[ebx+ZBufferPoint.x]
33
	cmp [eax+offs_zbup_x], ecx ;if (p1.x > p2.x)
33
	cmp [eax+ZBufferPoint.x], ecx ;if (p1.x > p2.x)
34
	jle .end_0 ;if (p1.x <= p2.x)
34
	jle .end_0 ;if (p1.x <= p2.x)
35
	@@: ;if (p1.y > p2.y || (p1.y == p2.y && p1.x > p2.x))
35
	@@: ;if (p1.y > p2.y || (p1.y == p2.y && p1.x > p2.x))
36
		mov [p1],ebx
36
		mov [p1],ebx
37
		mov [p2],eax
37
		mov [p2],eax
Line 38... Line 38...
38
	.end_0:
38
	.end_0:
39
 
39
 
40
	mov eax,[zb]
40
	mov eax,[zb]
41
	mov edx,[eax+offs_zbuf_xsize]
41
	mov edx,[eax+ZBuffer.xsize]
42
	mov [sx],edx
42
	mov [sx],edx
43
	mov ecx,[p1]
43
	mov ecx,[p1]
44
	mov edi,[eax+offs_zbuf_linesize]
44
	mov edi,[eax+ZBuffer.linesize]
45
	imul edi,[ecx+offs_zbup_y]
45
	imul edi,[ecx+ZBufferPoint.y]
46
	mov edx,[ecx+offs_zbup_x]
46
	mov edx,[ecx+ZBufferPoint.x]
47
	imul edx,PSZB
47
	imul edx,PSZB
48
	add edi,edx
48
	add edi,edx
49
	add edi,[eax+offs_zbuf_pbuf] ;edi = (zb.pbuf + zb.linesize*p1.y + p1.x*PSZB)
49
	add edi,[eax+ZBuffer.pbuf] ;edi = (zb.pbuf + zb.linesize*p1.y + p1.x*PSZB)
50
if INTERP_Z eq 1
50
if INTERP_Z eq 1
51
	mov edx,[ecx+offs_zbup_y]
51
	mov edx,[ecx+ZBufferPoint.y]
52
	imul edx,[sx]
52
	imul edx,[sx]
53
	add edx,[ecx+offs_zbup_x]
53
	add edx,[ecx+ZBufferPoint.x]
54
	shl edx,1
54
	shl edx,1
55
	add edx,[eax+offs_zbuf_zbuf]
55
	add edx,[eax+ZBuffer.zbuf]
56
	mov [pz],edx ;pz = zb.zbuf + (p1.y*sx + p1.x)
56
	mov [pz],edx ;pz = zb.zbuf + (p1.y*sx + p1.x)
57
	mov edx,[ecx+offs_zbup_z]
57
	mov edx,[ecx+ZBufferPoint.z]
Line 58... Line 58...
58
	mov [z],edx ;z = p1.z
58
	mov [z],edx ;z = p1.z
59
end if
59
end if
60
 
60
 
61
	mov ebx,[p2]
61
	mov ebx,[p2]
62
	mov eax,[ebx+offs_zbup_x]
62
	mov eax,[ebx+ZBufferPoint.x]
63
	sub eax,[ecx+offs_zbup_x]
63
	sub eax,[ecx+ZBufferPoint.x]
64
	mov [d_x],eax ;d_x = p2.x - p1.x
64
	mov [d_x],eax ;d_x = p2.x - p1.x
Line 65... Line 65...
65
	mov eax,[ebx+offs_zbup_y]
65
	mov eax,[ebx+ZBufferPoint.y]
66
	sub eax,[ecx+offs_zbup_y]
66
	sub eax,[ecx+ZBufferPoint.y]
67
	mov [d_y],eax ;d_y = p2.y - p1.y
67
	mov [d_y],eax ;d_y = p2.y - p1.y
68
 
68
 
69
	mov eax,[ecx+offs_zbup_r]
69
	mov eax,[ecx+ZBufferPoint.r]
70
	shl eax,8
70
	shl eax,8
71
	mov [r],eax ;r = p1.r << 8
71
	mov [r],eax ;r = p1.r << 8
72
	mov eax,[ecx+offs_zbup_g]
72
	mov eax,[ecx+ZBufferPoint.g]
73
	shl eax,8
73
	shl eax,8
Line 74... Line 74...
74
	mov [g],eax ;g = p1.g << 8
74
	mov [g],eax ;g = p1.g << 8
75
	mov eax,[ecx+offs_zbup_b]
75
	mov eax,[ecx+ZBufferPoint.b]
Line 132... Line 132...
132
	mov [n],eax
132
	mov [n],eax
Line 133... Line 133...
133
 
133
 
134
	mov ebx,[p1]
134
	mov ebx,[p1]
135
	mov ecx,[p2]
135
	mov ecx,[p2]
136
if INTERP_Z eq 1
136
if INTERP_Z eq 1
137
	mov eax,[ecx+offs_zbup_z]
137
	mov eax,[ecx+ZBufferPoint.z]
138
	cmp eax,[ebx+offs_zbup_z]
138
	cmp eax,[ebx+ZBufferPoint.z]
139
	jg .mz_0
139
	jg .mz_0
140
	je .mz_1
140
	je .mz_1
141
		;if(p2.z
141
		;if(p2.z
142
		sub eax,[ebx+offs_zbup_z]
142
		sub eax,[ebx+ZBufferPoint.z]
143
		neg eax
143
		neg eax
144
		inc eax
144
		inc eax
145
		xor edx,edx
145
		xor edx,edx
146
		div dword[n]
146
		div dword[n]
147
		neg eax
147
		neg eax
148
		inc eax
148
		inc eax
149
		jmp .mz_2
149
		jmp .mz_2
150
	.mz_0:
150
	.mz_0:
151
	sub eax,[ebx+offs_zbup_z]
151
	sub eax,[ebx+ZBufferPoint.z]
152
	xor edx,edx
152
	xor edx,edx
153
	div dword[n]
153
	div dword[n]
154
	jmp .mz_2
154
	jmp .mz_2
155
	.mz_1:
155
	.mz_1:
156
		xor eax,eax
156
		xor eax,eax
157
	.mz_2:
157
	.mz_2:
158
	mov [zinc],eax ;zinc=(p2.z-p1.z)/n
158
	mov [zinc],eax ;zinc=(p2.z-p1.z)/n
Line 159... Line 159...
159
end if
159
end if
160
 
160
 
161
	;ebx=&p1, ecx=&p2
161
	;ebx=&p1, ecx=&p2
162
	mov eax,[ecx+offs_zbup_r]
162
	mov eax,[ecx+ZBufferPoint.r]
163
	cmp eax,[ebx+offs_zbup_r]
163
	cmp eax,[ebx+ZBufferPoint.r]
164
	jg .mr_0
164
	jg .mr_0
165
	je .mr_1
165
	je .mr_1
166
		;if(p2.r
166
		;if(p2.r
167
		sub eax,[ebx+offs_zbup_r]
167
		sub eax,[ebx+ZBufferPoint.r]
168
		neg eax
168
		neg eax
169
		inc eax
169
		inc eax
170
		shl eax,8
170
		shl eax,8
171
		xor edx,edx
171
		xor edx,edx
172
		div dword[n]
172
		div dword[n]
173
		neg eax
173
		neg eax
174
		inc eax
174
		inc eax
175
		jmp .mr_2
175
		jmp .mr_2
176
	.mr_0:
176
	.mr_0:
177
	sub eax,[ebx+offs_zbup_r]
177
	sub eax,[ebx+ZBufferPoint.r]
178
	shl eax,8
178
	shl eax,8
179
	xor edx,edx
179
	xor edx,edx
180
	div dword[n]
180
	div dword[n]
181
	jmp .mr_2
181
	jmp .mr_2
182
	.mr_1:
182
	.mr_1:
183
		xor eax,eax
183
		xor eax,eax
Line 184... Line 184...
184
	.mr_2:
184
	.mr_2:
185
	mov [rinc],eax ;rinc=((p2.r-p1.r)<<8)/n
185
	mov [rinc],eax ;rinc=((p2.r-p1.r)<<8)/n
186
 
186
 
187
	mov eax,[ecx+offs_zbup_g]
187
	mov eax,[ecx+ZBufferPoint.g]
188
	cmp eax,[ebx+offs_zbup_g]
188
	cmp eax,[ebx+ZBufferPoint.g]
189
	jg .mg_0
189
	jg .mg_0
190
	je .mg_1
190
	je .mg_1
191
		;if(p2.g
191
		;if(p2.g
192
		sub eax,[ebx+offs_zbup_g]
192
		sub eax,[ebx+ZBufferPoint.g]
193
		neg eax
193
		neg eax
194
		inc eax
194
		inc eax
195
		shl eax,8
195
		shl eax,8
196
		xor edx,edx
196
		xor edx,edx
197
		div dword[n]
197
		div dword[n]
198
		neg eax
198
		neg eax
199
		inc eax
199
		inc eax
200
		jmp .mg_2
200
		jmp .mg_2
201
	.mg_0:
201
	.mg_0:
202
	sub eax,[ebx+offs_zbup_g]
202
	sub eax,[ebx+ZBufferPoint.g]
203
	shl eax,8
203
	shl eax,8
204
	xor edx,edx
204
	xor edx,edx
205
	div dword[n]
205
	div dword[n]
206
	jmp .mg_2
206
	jmp .mg_2
207
	.mg_1:
207
	.mg_1:
Line 208... Line 208...
208
		xor eax,eax
208
		xor eax,eax
209
	.mg_2:
209
	.mg_2:
210
	mov [ginc],eax ;ginc=((p2.g-p1.g)<<8)/n
210
	mov [ginc],eax ;ginc=((p2.g-p1.g)<<8)/n
211
 
211
 
212
	mov eax,[ecx+offs_zbup_b]
212
	mov eax,[ecx+ZBufferPoint.b]
213
	cmp eax,[ebx+offs_zbup_b]
213
	cmp eax,[ebx+ZBufferPoint.b]
214
	jg .mb_0
214
	jg .mb_0
215
	je .mb_1
215
	je .mb_1
216
		;if(p2.b
216
		;if(p2.b
217
		sub eax,[ebx+offs_zbup_b]
217
		sub eax,[ebx+ZBufferPoint.b]
218
		neg eax
218
		neg eax
219
		inc eax
219
		inc eax
220
		shl eax,8
220
		shl eax,8
221
		xor edx,edx
221
		xor edx,edx
222
		div dword[n]
222
		div dword[n]
223
		neg eax
223
		neg eax
224
		inc eax
224
		inc eax
225
		jmp .mb_2
225
		jmp .mb_2
226
	.mb_0:
226
	.mb_0:
227
	sub eax,[ebx+offs_zbup_b]
227
	sub eax,[ebx+ZBufferPoint.b]
228
	shl eax,8
228
	shl eax,8