From 336def41ce30d3284c3f1c4d6e0c596239c260bf Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Wed, 29 Dec 2021 12:42:48 +0000 Subject: [PATCH] view3ds: fixed model generation by macgub git-svn-id: svn://kolibrios.org@9521 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/demos/view3ds/data.inc | 2 +- programs/demos/view3ds/view3ds.asm | 29 +++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/programs/demos/view3ds/data.inc b/programs/demos/view3ds/data.inc index 9b3f2eef7..1b26b6256 100644 --- a/programs/demos/view3ds/data.inc +++ b/programs/demos/view3ds/data.inc @@ -19,7 +19,7 @@ yobs dw 0 ;SIZE_Y / 2 ;200 ;coordinates zobs dw -1000 - re_alloc_flag db 0 + angle_counter dw 0 piD180 dd 0.017453292519943295769236907684886 piD128 dd 0.024544 diff --git a/programs/demos/view3ds/view3ds.asm b/programs/demos/view3ds/view3ds.asm index 99dc4c55b..e0caf2ba4 100644 --- a/programs/demos/view3ds/view3ds.asm +++ b/programs/demos/view3ds/view3ds.asm @@ -74,9 +74,16 @@ START: ; start of execution jne .asc call read_tp_variables ; init points and triangles count variables cmp eax,0 - je .gen - jmp .malloc + + jne .malloc .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 jmp .opt .asc: @@ -368,11 +375,10 @@ START: ; start of execution cmp ah,18 jne .next_m2 - mov [re_alloc_flag],1 ; reallocate memory + mov bl,1 ; reallocate memory mov [triangles_count_var],20000 mov [points_count_var],20000 call alloc_mem_for_tp - mov [re_alloc_flag],0 mov bl,[generator_flag] ; or bl,bl @@ -392,6 +398,16 @@ START: ; start of execution .calc_norm: call optimize_object1 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 calc_bumpmap_coords ; bump and texture mapping call do_edges_list @@ -3286,8 +3302,9 @@ ret alloc_mem_for_tp: +;in: bl = 1 - realloc mov eax, 68 - cmp [re_alloc_flag],1 + cmp bl,1 jz @f mov ebx, 12 jmp .alloc @@ -3352,7 +3369,7 @@ alloc_mem_for_tp: mov [points_rotated_ptr], eax mov eax, 68 - mov ebx, 12 + ; mov ebx, 12 mov ecx, [points_count_var] shl ecx,2 add ecx,32