1 ;=========================================================================
\r
3 ; make pivot table, sort, remove unused vertices, find chunks...
\r
4 ; in - some global variables
\r
6 ; ebx - chunks list ptr, every chunk as word
\r
7 ; ecx - chunks number
\r
8 ; esi - tri_ch ; vertices with triangles list
\r
9 ; edi - t_ptr ; pointers to tri_ch list
\r
16 .tri_ch equ dword[ebp-4] ; tri chunks list ptr
\r
17 .chunks equ dword[ebp-8] ; chunks ptreach tri chunk No. as word
\r
18 .endt equ dword[ebp-12] ;
\r
19 .t_ptr equ dword[ebp-16] ; pointers list
\r
20 .tri_ch1 equ dword[ebp-20] ;
\r
21 .up equ dword[ebp-24] ; upload ptr
\r
22 .chmr equ dword[ebp-28] ; bit mark list if tri stored
\r
23 .str equ dword[ebp-32] ; store ptr
\r
24 .ltch1 equ dword[ebp-36] ; end of tri_ch1 ptr
\r
25 .ch_cnt equ dword[ebp-40]
\r
26 .cntt equ dword[ebp-44]
\r
27 .cc equ dword[ebp-48]
\r
28 .lsparam equ dword[ebp-52]
\r
29 .fix_mark equ dword[ebp-56]
\r
30 .endVptr equ dword[ebp-60]
\r
32 ; some triangles have repeated indices of vertices
\r
33 ; check and remove such triangles
\r
34 call remove_dead_tri
\r
36 mov ecx,[triangles_count_var]
\r
46 mov ecx,[triangles_count_var]
\r
54 mov ecx,[points_count_var]
\r
62 mov ecx,[triangles_count_var]
\r
70 mov ecx,[triangles_count_var]
\r
76 mov .chmr,eax ; chunks mark if bit is set - tri was used
\r
80 mov ecx,[triangles_count_var]
\r
94 mov eax,[points_count_var]
\r
96 add eax,[points_ptr]
\r
102 mov esi,[triangles_ptr]
\r
109 punpckldq xmm0,xmm1
\r
110 punpckldq xmm2,xmm1
\r
116 cmp ecx,[triangles_count_var]
\r
122 mov ecx,[triangles_count_var]
\r
130 .ccc: ; ebx - vert index
\r
131 mov eax,[ebx+8] ; ebx+4 - tri index
\r
162 mov ecx,[points_count_var]
\r
177 jz .dnC ; check done
\r
194 sub [esi],edi ; fix .tri_ch pivot table list
\r
203 add ebx,[points_ptr]
\r
207 cmp edi,.endVptr ; fix points_r list
\r
216 cmp edi,.endVptr ; fix point_r list
\r
221 ; recalc tri all indices above ebx - sub edi
\r
224 mov esi,[triangles_ptr]
\r
225 mov ecx,[triangles_count_var]
\r
241 sub [points_count_var],edi
\r
245 jmp .ptCff ; again check sth found
\r
255 ;make t_ptr - table with pointers/adresses
\r
258 mov ecx,[points_count_var]
\r
268 mov eax,[esi] ; [esi] - vert ind
\r
270 cmp eax,[esi] ; [esi+4] - tri ind
\r
284 ; each dword position in .t_ptr list - adress of corresponding
\r
285 ; triangles indices, each triangles from such index contains this
\r
289 mov eax,[triangles_count_var]
\r
290 mov .cntt,eax ; temp help cnt
\r
293 mov esi,[triangles_ptr]
\r
297 mov .ltch1,eax ; last
\r
310 cmp edx,[triangles_count_var]
\r
317 bt [eax],edx ; mark
\r
318 jc @f ; tri was stored
\r
332 mov edx,[edi] ; edx - vert ind
\r
335 mov eax,[eax] ; [eax] - t ptr
\r
345 bts [esi],ebx ; mark
\r
346 jc @f ; tri was stored
\r
349 mov esi,[eax+4] ; [eax+4] - tri ind
\r
356 add esi,[triangles_ptr]
\r
399 ; for now free mem - cunks list - unused
\r