Rev 2984 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2984 | Rev 6619 | ||
---|---|---|---|
Line 10... | Line 10... | ||
10 | mov dword .y,0 |
10 | mov dword .y,0 |
11 | mov esi,[screen_ptr] |
11 | mov esi,[screen_ptr] |
12 | mov edi,[Zbuffer_ptr] |
12 | mov edi,[Zbuffer_ptr] |
13 | push edi |
13 | push edi |
14 | ; clear Zbuffer temporally used as image buffer |
14 | ; clear Zbuffer temporally used as image buffer |
- | 15 | movzx ecx,word[size_x_var] |
|
- | 16 | movzx eax,word[size_y_var] |
|
15 | mov ecx,SIZE_X*SIZE_Y |
17 | imul ecx,eax ;SIZE_X*SIZE_Y |
16 | xor eax,eax |
18 | xor eax,eax |
17 | cld |
19 | cld |
18 | rep stosd |
20 | rep stosd |
19 | pop edi |
21 | pop edi |
20 | ; movzx eax,[sinus_flag] |
22 | ; movzx eax,[sinus_flag] |
Line 65... | Line 67... | ||
65 | fistp dword .new_y |
67 | fistp dword .new_y |
66 | end if |
68 | end if |
67 | mov eax,.new_y |
69 | mov eax,.new_y |
68 | or eax,eax |
70 | or eax,eax |
69 | jl .skip |
71 | jl .skip |
- | 72 | movzx ebx,word[size_y_var] |
|
70 | cmp eax,SIZE_Y |
73 | cmp eax,ebx ;SIZE_Y |
71 | jg .skip |
74 | jg .skip |
72 | ; mov edx,SIZE_X |
75 | movzx edx,word[size_x_var] |
73 | ; mul edx |
76 | mul edx |
74 | shl eax,9 |
77 | ; shl eax,9 |
75 | add eax,dword .x |
78 | add eax,dword .x |
76 | lea ebx,[eax*3] |
79 | lea ebx,[eax*3] |
77 | mov eax,[esi] |
80 | mov eax,[esi] |
78 | mov [edi+ebx],eax |
81 | mov [edi+ebx],eax |
79 | .skip: |
82 | .skip: |
80 | add esi,3 |
83 | add esi,3 |
81 | inc dword .x |
84 | inc dword .x |
- | 85 | movzx edx,word[size_x_var] |
|
82 | cmp dword .x,SIZE_X |
86 | cmp dword .x,edx ;SIZE_X |
83 | jl .again |
87 | jl .again |
84 | mov dword .x,0 |
88 | mov dword .x,0 |
85 | inc dword .y |
89 | inc dword .y |
- | 90 | movzx edx,word[size_y_var] |
|
86 | cmp dword .y,SIZE_Y |
91 | cmp dword .y,edx ;SIZE_Y |
87 | jl .again |
92 | jl .again |
Line 88... | Line 93... | ||
88 | 93 | ||
89 | ; copy from temporary buffer -> Zbuffer to screen |
94 | ; copy from temporary buffer -> Zbuffer to screen |
90 | mov esi,[Zbuffer_ptr] |
95 | mov esi,[Zbuffer_ptr] |
- | 96 | mov edi,[screen_ptr] |
|
- | 97 | movzx ecx,word[size_x_var] |
|
- | 98 | movzx eax,word[size_y_var] |
|
- | 99 | imul ecx,eax |
|
- | 100 | lea ecx,[ecx*3] |
|
91 | mov edi,[screen_ptr] |
101 | shr ecx,2 |
92 | mov ecx,SIZE_X*SIZE_Y*3/4 |
102 | ; mov ecx,SIZE_X*SIZE_Y*3/4 |
93 | cld |
103 | cld |
Line 94... | Line 104... | ||
94 | rep movsd |
104 | rep movsd |
Line 110... | Line 120... | ||
110 | shr eax,16 ; bx = x , ax = y |
120 | shr eax,16 ; bx = x , ax = y |
111 | or ax,ax |
121 | or ax,ax |
112 | jl @f |
122 | jl @f |
113 | or bx,bx |
123 | or bx,bx |
114 | jl @f |
124 | jl @f |
115 | cmp ax,SIZE_Y |
125 | cmp ax,[size_y_var] ;SIZE_Y |
116 | jge @f |
126 | jge @f |
117 | cmp bx,SIZE_X |
127 | cmp bx,[size_x_var] ;SIZE_X |
118 | jge @f |
128 | jge @f |
119 | mov edx,SIZE_X ; SIZE_X not only power of 2 -> 256,512,... |
129 | movzx edx,word[size_x_var] ;SIZE_X ; SIZE_X not only power of 2 -> 256,512,... |
120 | mul edx |
130 | mul edx |
121 | add eax,ebx |
131 | add eax,ebx |
122 | mov edi,[screen_ptr] |
132 | mov edi,[screen_ptr] |
123 | lea eax,[eax*3] |
133 | lea eax,[eax*3] |
124 | add edi,eax |
134 | add edi,eax |
Line 128... | Line 138... | ||
128 | @@: |
138 | @@: |
129 | loop .drw |
139 | loop .drw |
Line 130... | Line 140... | ||
130 | 140 | ||
Line -... | Line 141... | ||
- | 141 | ret |
|
- | 142 | ||
- | 143 | do_emboss: ; sse2 version only |
|
- | 144 | if Ext >= SSE2 |
|
- | 145 | movzx ecx,[bumps_deep_flag] |
|
- | 146 | inc ecx |
|
- | 147 | call blur_screen ;blur n times |
|
- | 148 | ||
- | 149 | mov eax,[size_y_var] ;load both x, y |
|
- | 150 | mov ebx,eax |
|
- | 151 | shr ebx,16 |
|
- | 152 | cwde |
|
- | 153 | mul ebx |
|
- | 154 | mov ecx,eax |
|
- | 155 | sub ecx,ebx |
|
- | 156 | sub ecx,ebx |
|
- | 157 | mov esi,[screen_ptr] |
|
- | 158 | mov edi,[Zbuffer_ptr] |
|
- | 159 | lea ebx,[ebx*3] |
|
- | 160 | mov edx,esi |
|
- | 161 | add esi,ebx |
|
- | 162 | lea ebx,[ebx+esi] |
|
- | 163 | pxor xmm0,xmm0 |
|
- | 164 | push eax |
|
- | 165 | @@: |
|
- | 166 | movlps xmm1,[esi+3] |
|
- | 167 | movhps xmm1,[esi+6] |
|
- | 168 | punpcklbw xmm1,xmm0 |
|
- | 169 | movlps xmm2,[esi-3] |
|
- | 170 | movhps xmm2,[esi] |
|
- | 171 | punpcklbw xmm2,xmm0 |
|
- | 172 | movlps xmm3,[ebx] |
|
- | 173 | movhps xmm3,[ebx+3] |
|
- | 174 | movlps xmm4,[edx] |
|
- | 175 | movhps xmm4,[edx+3] |
|
- | 176 | punpcklbw xmm3,xmm0 |
|
- | 177 | punpcklbw xmm4,xmm0 |
|
- | 178 | psubsw xmm1,xmm2 |
|
- | 179 | paddw xmm1,[.bias] |
|
- | 180 | psubsw xmm3,xmm4 |
|
- | 181 | paddw xmm3,[.bias] |
|
- | 182 | pmulhw xmm1,xmm3 |
|
- | 183 | movaps xmm7,xmm1 |
|
- | 184 | movaps xmm6,xmm1 |
|
- | 185 | psrlq xmm7,2*8 |
|
- | 186 | psrlq xmm6,4*8 |
|
- | 187 | pmaxsw xmm1,xmm7 |
|
- | 188 | pmaxsw xmm1,xmm6 |
|
- | 189 | ||
- | 190 | if 0 |
|
- | 191 | movaps xmm7,xmm3 |
|
- | 192 | movaps xmm6,xmm3 |
|
- | 193 | psrlq xmm7,2*8 |
|
- | 194 | psrlq xmm6,4*8 |
|
- | 195 | pmaxsw xmm3,xmm7 |
|
- | 196 | pmaxsw xmm3,xmm6 |
|
- | 197 | end if |
|
- | 198 | pmaxsw xmm1,xmm3 |
|
- | 199 | ||
- | 200 | movd eax,xmm1 |
|
- | 201 | movzx eax,al |
|
- | 202 | lea eax,[eax*3+envmap_cub] |
|
- | 203 | mov eax,[eax] |
|
- | 204 | mov [edi],eax ;xmm1 |
|
- | 205 | psrldq xmm1,8 |
|
- | 206 | movd eax,xmm1 |
|
- | 207 | movzx eax,al |
|
- | 208 | lea eax,[eax*3+envmap_cub] |
|
- | 209 | mov eax,[eax] |
|
- | 210 | mov [edi+4],eax |
|
- | 211 | ||
- | 212 | ||
- | 213 | add edi,8 |
|
- | 214 | add esi,6 |
|
- | 215 | add ebx,6 |
|
- | 216 | add edx,6 |
|
- | 217 | sub ecx,2 |
|
- | 218 | jnc @b |
|
- | 219 | ||
- | 220 | ||
- | 221 | pop ecx ;,eax |
|
- | 222 | mov edi,[screen_ptr] |
|
- | 223 | mov esi,[Zbuffer_ptr] |
|
- | 224 | @@: |
|
- | 225 | movsd |
|
- | 226 | dec edi |
|
- | 227 | loop @b |
|
- | 228 | end if |
|
- | 229 | ret |
|
131 | ret |
230 | |
- | 231 | align 16 |
|
- | 232 | .bias: |
|
- | 233 | dw 128, 128, 128, 128, 128, 128, 128, 128 |
|
- | 234 | ||
132 | 235 | if 0 ; old emb proc |
|
133 | do_emboss: |
236 | |
134 | ; emboss - after drawing all, |
237 | ; emboss - after drawing all, |
135 | ; transfer screen buffer into bump map |
238 | ; transfer screen buffer into bump map |
136 | ; and draw two bump triangles |
239 | ; and draw two bump triangles |
Line 225... | Line 328... | ||
225 | mov edi,screen |
328 | mov edi,screen |
226 | call bump_triangle |
329 | call bump_triangle |
Line 227... | Line 330... | ||
227 | 330 | ||
228 | pop ebp |
331 | pop ebp |
- | 332 | ret |
|
229 | ret |
333 | end if |
Line 230... | Line 334... | ||
230 | ;********************************EMBOSS DONE******************************* |
334 | ;********************************EMBOSS DONE******************************* |
231 | 335 |