view3ds: fixed model generation by macgub

git-svn-id: svn://kolibrios.org@9521 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2021-12-29 12:42:48 +00:00
parent c5dc86cc2c
commit 336def41ce
2 changed files with 24 additions and 7 deletions

View File

@ -19,7 +19,7 @@
yobs dw 0 ;SIZE_Y / 2 ;200 ;coordinates yobs dw 0 ;SIZE_Y / 2 ;200 ;coordinates
zobs dw -1000 zobs dw -1000
re_alloc_flag db 0
angle_counter dw 0 angle_counter dw 0
piD180 dd 0.017453292519943295769236907684886 piD180 dd 0.017453292519943295769236907684886
piD128 dd 0.024544 piD128 dd 0.024544

View File

@ -74,9 +74,16 @@ START: ; start of execution
jne .asc jne .asc
call read_tp_variables ; init points and triangles count variables call read_tp_variables ; init points and triangles count variables
cmp eax,0 cmp eax,0
je .gen
jmp .malloc jne .malloc
.gen: .gen:
; if no house.3ds on board - generate
xor bl,bl ; reallocate memory
mov [triangles_count_var],20000
mov [points_count_var],20000
call alloc_mem_for_tp
mov bl,[generator_flag]
call generate_object call generate_object
jmp .opt jmp .opt
.asc: .asc:
@ -368,11 +375,10 @@ START: ; start of execution
cmp ah,18 cmp ah,18
jne .next_m2 jne .next_m2
mov [re_alloc_flag],1 ; reallocate memory mov bl,1 ; reallocate memory
mov [triangles_count_var],20000 mov [triangles_count_var],20000
mov [points_count_var],20000 mov [points_count_var],20000
call alloc_mem_for_tp call alloc_mem_for_tp
mov [re_alloc_flag],0
mov bl,[generator_flag] mov bl,[generator_flag]
; or bl,bl ; or bl,bl
@ -392,6 +398,16 @@ START: ; start of execution
.calc_norm: .calc_norm:
call optimize_object1 call optimize_object1
call init_triangles_normals2 call init_triangles_normals2
if Ext >= SSE2
call detect_chunks
mov [chunks_number],ecx
mov [chunks_ptr],ebx
; esi - tri_ch
; edi - t_ptr - every vertice index - pointer to to all triangles
; that have this index
end if
call init_point_normals call init_point_normals
call calc_bumpmap_coords ; bump and texture mapping call calc_bumpmap_coords ; bump and texture mapping
call do_edges_list call do_edges_list
@ -3286,8 +3302,9 @@ ret
alloc_mem_for_tp: alloc_mem_for_tp:
;in: bl = 1 - realloc
mov eax, 68 mov eax, 68
cmp [re_alloc_flag],1 cmp bl,1
jz @f jz @f
mov ebx, 12 mov ebx, 12
jmp .alloc jmp .alloc
@ -3352,7 +3369,7 @@ alloc_mem_for_tp:
mov [points_rotated_ptr], eax mov [points_rotated_ptr], eax
mov eax, 68 mov eax, 68
mov ebx, 12 ; mov ebx, 12
mov ecx, [points_count_var] mov ecx, [points_count_var]
shl ecx,2 shl ecx,2
add ecx,32 add ecx,32