'info3ds' can open *.stl files

git-svn-id: svn://kolibrios.org@7610 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2019-03-14 11:41:53 +00:00
parent a9cbcfc200
commit 9b2415c6ea
8 changed files with 654 additions and 154 deletions

View File

@ -147,7 +147,6 @@ extra_files = {
{"HD_Load/USB_boot_old/", PROGS .. "/hd_load/usb_boot_old/usb_boot_1251.txt"}, {"HD_Load/USB_boot_old/", PROGS .. "/hd_load/usb_boot_old/usb_boot_1251.txt"},
{"kolibrios/3D/info3ds/INFO3DS.INI", PROGS .. "/develop/info3ds/info3ds.ini"}, {"kolibrios/3D/info3ds/INFO3DS.INI", PROGS .. "/develop/info3ds/info3ds.ini"},
{"kolibrios/3D/info3ds/OBJECTS.PNG", PROGS .. "/develop/info3ds/objects.png"}, {"kolibrios/3D/info3ds/OBJECTS.PNG", PROGS .. "/develop/info3ds/objects.png"},
{"kolibrios/3D/info3ds/TL_SYS_16.PNG", PROGS .. "/develop/info3ds/tl_sys_16.png"},
{"kolibrios/3D/info3ds/TOOLBAR.PNG", PROGS .. "/develop/info3ds/toolbar.png"}, {"kolibrios/3D/info3ds/TOOLBAR.PNG", PROGS .. "/develop/info3ds/toolbar.png"},
{"kolibrios/3D/info3ds/FONT8X9.BMP", PROGS .. "/fs/kfar/trunk/font8x9.bmp"}, {"kolibrios/3D/info3ds/FONT8X9.BMP", PROGS .. "/fs/kfar/trunk/font8x9.bmp"},
{"kolibrios/3D/md2view/", "common/3d/md2view/*"}, {"kolibrios/3D/md2view/", "common/3d/md2view/*"},

View File

@ -3,11 +3,8 @@ if not exist bin mkdir bin
@echo lang fix en >lang.inc @echo lang fix en >lang.inc
@copy objects.png bin\objects.png @copy objects.png bin\objects.png
if not exist bin\info3ds.ini @copy info3ds.ini bin\info3ds.ini if not exist bin\info3ds.ini @copy info3ds.ini bin\info3ds.ini
if not exist bin\tl_sys_16.png @copy tl_sys_16.png bin\tl_sys_16.png
if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png
if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp
@fasm.exe -m 16384 ..\libraries\TinyGL\asm_fork\tinygl.asm bin\tinygl.obj
@kpack bin\tinygl.obj
@fasm.exe -m 16384 info3ds.asm bin\info3ds.kex @fasm.exe -m 16384 info3ds.asm bin\info3ds.kex
@kpack bin\info3ds.kex @kpack bin\info3ds.kex
@fasm.exe -m 16384 info3ds_u.asm bin\info3ds_u.kex @fasm.exe -m 16384 info3ds_u.asm bin\info3ds_u.kex

View File

@ -3,11 +3,8 @@ if not exist bin mkdir bin
@echo lang fix ru >lang.inc @echo lang fix ru >lang.inc
@copy objects.png bin\objects.png @copy objects.png bin\objects.png
if not exist bin\info3ds.ini @copy info3ds.ini bin\info3ds.ini if not exist bin\info3ds.ini @copy info3ds.ini bin\info3ds.ini
if not exist bin\tl_sys_16.png @copy tl_sys_16.png bin\tl_sys_16.png
if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png
if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp
@fasm.exe -m 16384 ..\libraries\TinyGL\asm_fork\tinygl.asm bin\tinygl.obj
@kpack bin\tinygl.obj
@fasm.exe -m 16384 info3ds.asm bin\info3ds.kex @fasm.exe -m 16384 info3ds.asm bin\info3ds.kex
@kpack bin\info3ds.kex @kpack bin\info3ds.kex
@fasm.exe -m 16384 info3ds_u.asm bin\info3ds_u.kex @fasm.exe -m 16384 info3ds_u.asm bin\info3ds_u.kex

View File

@ -0,0 +1,459 @@
;
; ”㭪樨 ¤«ï ¯à¥®¡à §®¢ ­¨ï ä ©«  *.stl ¢ *.3ds
;
; ‘âàãªâãà  á®§¤ ¢ ¥¬®£® ä ©«  *.3ds:
; CHUNK_MAIN (40+n+v+f)
; + CHUNK_OBJMESH (34+n+v+f)
; + CHUNK_OBJBLOCK (28+n+v+f)
; + CHUNK_TRIMESH (22+v+f)
; + CHUNK_VERTLIST (8+v)
; + CHUNK_FACELIST (8+f)
;
; ¢ ᪮¡ª å 㪠§ ­ë à §¬¥àë ¡«®ª®¢:
; n - ¯ ¬ïâì ¤«ï ¨¬¥­¨ ®¡ê¥ªâ 
; v - ¯ ¬ïâì ¤«ï ¢¥à設
; f - ¯ ¬ïâì ¤«ï £à ­¥©
; ”®à¬ â ¡¨­ à­®£® *.stl:
; char[80] - § £®«®¢®ª
; uint32 - ç¨á«® £à ­¥©
; ¤«ï ª ¦¤®© £à ­¨:
; float[3] - ¢¥ªâ®à ­®à¬ «¨
; float[9] - ¢¥à設ë 1,2,3
; uint16 -  âਡãâë
if lang eq ru
txt_err_stl_open:
db '"STL',13,10
db '” ©« *.stl ®ç¥­ì ¡®«ì让." -tW',0
txt_err_stl_null_v:
db '"STL',13,10
db '‚¥àè¨­ë ­¥ ­ ©¤¥­ë." -tE',0
else
txt_err_stl_open:
db '"STL',13,10
db 'File *.stl is very large." -tW',0
txt_err_stl_null_v:
db '"STL',13,10
db 'Vertexes not found." -tE',0
end if
;output:
; eax - 㪠§ â¥«ì ­  áä®à¬¨à®¢ ­ë© ä ©« 3ds (¢ á«ãç ¥ ­¥ã¤ ç¨ 0)
; ecx - à §¬¥à áä®à¬¨à®¢ ­®£® ä ©«  3ds
align 4
proc convert_stl_3ds uses ebx edx edi esi, f_data:dword, f_size:dword
locals
c_mem dd ? ;¯ ¬ïâì ¤«ï ¯à¥®¡à §®¢ ­¨ï (convert memory)
c_size dd ? ;à §¬¥à ¯ ¬ï⨠¤«ï ¯à¥®¡à §®¢ ­¨© (convert memory size)
vert_c dd ? ;ç¨á«® ¢¥à設 (vertex count)
face_c dd ? ;ç¨á«® £à ­¥© (faces count)
endl
xor eax,eax
mov esi,[f_data]
cmp dword[esi],'soli'
jne .bin_stl
cmp word[esi+4],'d '
jne .bin_stl
jmp @f
.bin_stl:
;¯à®¢¥à塞 ä ©« ­  ¡¨­ à­ë© ä®à¬ â
mov ecx,[esi+80]
imul ecx,50
add ecx,84 ;§ £®«®¢®ª
cmp ecx,[f_size]
jne .no_stl
call convert_binary_stl
jmp .no_stl
@@:
;¢ ­ ç «¥ ­ ©¤¥­® 'solid '
stdcall txt_next_line, 80
mov eax,[f_data]
sub eax,esi
add eax,[f_size]
stdcall get_stl_vertex_count, esi,eax
or eax,eax
jnz @f
notify_window_run txt_err_stl_null_v
jmp .no_stl
@@:
cmp eax,0xffff
jle @f
notify_window_run txt_err_stl_open
mov eax,0xffff
@@:
mov [vert_c],eax
mov ecx,3
xor edx,edx
div ecx
mov [face_c],eax
shl eax,3
mov ecx,[vert_c]
imul ecx,12
lea ecx,[ecx+eax+40]
lea edx,[esi-6]
sub edx,[f_data]
cmp edx,2
jge @f
mov edx,2 ;¬¨­¨¬ «ì­ë© à §¬¥à ¤«ï ¨¬¥­¨ ®¡ê¥ªâ 
@@:
add ecx,edx ;for object name
mov [c_size],ecx
stdcall mem.Alloc,ecx
mov [c_mem],eax
mov ebx,eax
mov word[ebx],CHUNK_MAIN
mov dword[ebx+2],ecx
add ebx,6
;3d3d
mov word[ebx],CHUNK_OBJMESH
sub ecx,6
mov dword[ebx+2],ecx
add ebx,6
;4000
mov word[ebx],CHUNK_OBJBLOCK
sub ecx,6
mov dword[ebx+2],ecx
add ebx,6
push ecx esi
mov ecx,edx
mov edi,ebx
mov esi,[f_data]
add esi,6 ;¯à®¯ã᪠¥¬ 'solid '
rep movsb ;ª®¯¨à㥬 ¨¬ï ®¡ê¥ªâ 
mov byte[edi-1],0
add ebx,edx
pop esi ecx
;4100
mov word[ebx],CHUNK_TRIMESH
sub ecx,6
mov dword[ebx+2],ecx
add ebx,6
;4110
mov word[ebx],CHUNK_VERTLIST
mov dword[ebx+2],8 ;+ ç¨á«® ¢¥à設 * 12
add ebx,6
mov edx,ebx
mov word[edx],0 ;ª®«. ¢¥à設
add ebx,2
finit
.cycle0:
call txt_ignore_space
cmp dword[esi],'face'
jne .end_v
stdcall txt_next_line, 80
call txt_ignore_space
cmp dword[esi],'oute'
jne .end_v
stdcall txt_next_line, 80
mov ecx,3 ;3 â®çª¨ ­  1 £à ­ì
@@:
stdcall stl_vertex_init, ebx
or eax,eax
jz .end_v
add ebx,12
inc word[edx]
loop @b
mov eax,[vert_c]
cmp word[edx],ax
jge .end_v
call txt_ignore_space
cmp dword[esi],'endl'
jne .end_v
stdcall txt_next_line, 80
call txt_ignore_space
cmp dword[esi],'endf'
jne .end_v
stdcall txt_next_line, 80
jmp .cycle0
.end_v:
movzx eax,word[edx]
imul eax,12
add [edx-4],eax ;¨á¯à ¢«ï¥¬ à §¬¥à ¡«®ª  4110
;4120
mov word[ebx],CHUNK_FACELIST
mov ecx,[face_c]
mov edx,ecx
shl edx,3 ;ª®«. £à ­¥© * 8
add edx,8
mov [ebx+2],edx
add ebx,6
mov [ebx],cx ;ª®«. £à ­¥©
add ebx,2
xor eax,eax
@@:
mov [ebx],ax
inc eax
mov [ebx+2],ax
inc eax
mov [ebx+4],ax
inc eax
mov word[ebx+6],0 ; âਡãâë
add ebx,8
loop @b
mov eax,[c_mem]
mov ecx,[c_size]
.no_stl:
ret
endp
;input:
; esi - 㪠§ â¥«ì ­  ­ ç «® ä ©« 
; ecx - à §¬¥à ä ©« 
align 4
proc convert_binary_stl
locals
c_mem dd ? ;¯ ¬ïâì ¤«ï ¯à¥®¡à §®¢ ­¨ï (convert memory)
c_size dd ? ;à §¬¥à ¯ ¬ï⨠¤«ï ¯à¥®¡à §®¢ ­¨© (convert memory size)
vert_c dd ? ;ç¨á«® ¢¥à設 (vertex count)
face_c dd ? ;ç¨á«® £à ­¥© (faces count)
endl
mov eax,[esi+80]
or eax,eax
jnz @f
notify_window_run txt_err_stl_null_v
jmp .no_stl
@@:
cmp eax,0xffff/3
jle @f
notify_window_run txt_err_stl_open
mov eax,0xffff/3
@@:
mov [face_c],eax
mov ecx,eax
imul eax,3
mov [vert_c],eax
shl ecx,3
imul eax,12
lea ecx,[ecx+eax+40+4] ;+4 à §¬¥à ¤«ï ¨¬¥­¨ ®¡ê¥ªâ 
mov [c_size],ecx
stdcall mem.Alloc,ecx
mov [c_mem],eax
mov ebx,eax
mov word[ebx],CHUNK_MAIN
mov dword[ebx+2],ecx
add ebx,6
;3d3d
mov word[ebx],CHUNK_OBJMESH
sub ecx,6
mov dword[ebx+2],ecx
add ebx,6
;4000
mov word[ebx],CHUNK_OBJBLOCK
sub ecx,6
mov dword[ebx+2],ecx
add ebx,6
mov dword[ebx],'Stl' ;¨¬ï ®¡ê¥ªâ 
add ebx,4
;4100
mov word[ebx],CHUNK_TRIMESH
sub ecx,6
mov dword[ebx+2],ecx
add ebx,6
;4110
mov word[ebx],CHUNK_VERTLIST
mov dword[ebx+2],8 ;+ ç¨á«® ¢¥à設 * 12
add ebx,6
mov edx,ebx
mov ecx,[vert_c]
mov word[edx],cx ;ª®«. ¢¥à設
add ebx,2
add esi,80+4+12 ;¯à®¯ã᪠§ £®«®¢ª , ç¨á«  £à ­¥©, 1-£® ¢¥ªâ®à  ­®à¬ «¥©
mov edi,ebx
mov eax,[face_c]
@@: ;横« ¯® £à ­ï¬
mov ecx,9
rep movsd ;ª®¯¨à㥬 ª®®à¤¨­ âë 3-å ¢¥à設
add esi,14 ;¯à®¯ã᪠¢¥ªâ®à  ­®à¬ «¥© ¨  âਡã⮢
dec eax
jnz @b
mov ebx,edi
movzx eax,word[edx]
imul eax,12
add [edx-4],eax ;¨á¯à ¢«ï¥¬ à §¬¥à ¡«®ª  4110
;4120
mov word[ebx],CHUNK_FACELIST
mov ecx,[face_c]
mov edx,ecx
shl edx,3 ;ª®«. £à ­¥© * 8
add edx,8
mov [ebx+2],edx
add ebx,6
mov [ebx],cx ;ª®«. £à ­¥©
add ebx,2
xor eax,eax
@@:
mov [ebx],ax
inc eax
mov [ebx+2],ax
inc eax
mov [ebx+4],ax
inc eax
mov word[ebx+6],0 ; âਡãâë
add ebx,8
loop @b
mov eax,[c_mem]
mov ecx,[c_size]
.no_stl:
ret
endp
;output:
; eax - vertex count
align 4
proc get_stl_vertex_count uses ebx ecx edi, f_data:dword, f_size:dword
mov al,'v'
xor ebx,ebx
mov ecx,[f_size]
mov edi,[f_data]
.cycle0:
repne scasb
cmp dword[edi],'erte'
jne @f
inc ebx
add edi,4
sub ecx,4
cmp ecx,4
jg .cycle0
@@:
mov eax,ebx
ret
endp
;input:
; esi - input description text
; ppoi - pointer to vertex struct
;output:
; eax - 0 (if error init) or 1
; esi - output description text
align 4
proc stl_vertex_init uses ebx ecx edi, ppoi:dword
call txt_ignore_space
cmp dword[esi],'vert'
jne .err_init
cmp word[esi+4],'ex'
jne .err_init
add esi,6
mov ebx,[ppoi]
call txt_copy_data
call String_to_DoubleFloat
fld qword[Data_Double]
fstp dword[ebx] ;coord X
call txt_copy_data
call String_to_DoubleFloat
fld qword[Data_Double]
fstp dword[ebx+4] ;coord X
call txt_copy_data
call String_to_DoubleFloat
fld qword[Data_Double]
fstp dword[ebx+8] ;coord Z
stdcall txt_next_line, 80
jmp @f
.err_init:
xor eax,eax
jmp .end_f
@@:
xor eax,eax
inc eax
.end_f:
ret
endp
;input:
; esi - 㪠§ â¥«ì ­  ­ ç «® áâப¨ á ¯à®¡¥« ¬¨
;output:
; al - destroy
; ecx - destroy
; esi - 㪠§ â¥«ì ­  ¯¥à¢ë© ­¥¯à®¡¥«ì­ë© ᨬ¢®«
align 4
txt_ignore_space:
mov ecx,64 ;§ é¨â  ®â § æ¨ª«¨¢ ­¨ï
@@:
lodsb
cmp al,' '
jne @f
loop @b
@@:
dec esi
ret
;input:
; esi - 㪠§ â¥«ì ­  áâபã á ç¨á«®¬ (¯à®¡¥«ë ¢ ­ ç «¥ áâப¨ ¨£­®à¨àãîâìáï)
;output:
; al - destroy
; ecx - destroy
; edi - destroy
; esi - 㪠§ â¥«ì ­  ª®­¥æ ª®¯¨à®¢ ­­®£® ç¨á« 
; Data_String - áâப  á ç¨á«®¬ ¨§ esi
align 4
txt_copy_data:
call txt_ignore_space
mov ecx,32
mov edi,esi
@@:
lodsb
or al,al
jz @f
cmp al,' '
je @f
cmp al,13
je @f
loop @b
@@:
mov esi,edi
sub ecx,32
neg ecx
mov edi,Data_String
rep movsb
mov byte[edi],0
ret
;input:
; esi - text pointer
align 4
proc txt_next_line uses eax ecx edi, mlen:dword
mov al,13
mov ecx,[mlen]
mov edi,esi
repne scasb
cmp byte[edi],10
jne @f
inc edi
@@:
mov esi,edi
ret
endp

View File

@ -291,7 +291,9 @@ end if
if lang eq ru if lang eq ru
txt_open_3ds db 'Žâªàëâ ä ©«:',0 txt_open_3ds db 'Žâªàëâ ä ©«:',0
txt_no_3ds db 'Žâªàëâë© ä ©« ­¥ ¢ ä®à¬ â¥ *.3ds',0 txt_no_3ds: db 'Žâªàëâë© ä ©« ­¥ ¢ ä®à¬ â¥ *.3ds ',39
.zag: rb 8
db 39,0
txt_3ds_err_sizes db '‚®§¬®¦­® ä ©« ¯®¢à¥¦¤¥­',0 txt_3ds_err_sizes db '‚®§¬®¦­® ä ©« ¯®¢à¥¦¤¥­',0
txt_count db 'Š®«¨ç¥á⢮',0 txt_count db 'Š®«¨ç¥á⢮',0
txt_3ds_offs: txt_3ds_offs:
@ -300,10 +302,13 @@ txt_3ds_offs:
db ' <20> §¬¥à: ' db ' <20> §¬¥à: '
.siz: rb 8 .siz: rb 8
db 0 db 0
txt_mat_null db 'Œ â¥à¨ «ë ­¥ ­ ©¤¥­ë',0
else else
txt_open_3ds db 'Open file:',0 txt_open_3ds db 'Open file:',0
txt_no_3ds db 'Žâªàëâë© ä ©« ­¥ ¢ ä®à¬ â¥ *.3ds',0 txt_no_3ds: db 'Open file not in format *.3ds ',39
txt_3ds_err_sizes db '‚®§¬®¦­® ä ©« ¯®¢à¥¦¤¥­',0 .zag: rb 8
db 39,0
txt_3ds_err_sizes db 'File may be corrupted',0
txt_count db 'Count',0 txt_count db 'Count',0
txt_3ds_offs: txt_3ds_offs:
db 'Offset: ' db 'Offset: '
@ -311,4 +316,5 @@ txt_3ds_offs:
db ' Size: ' db ' Size: '
.siz: rb 8 .siz: rb 8
db 0 db 0
txt_mat_null db 'No materials found',0
end if end if

View File

@ -1,5 +1,5 @@
use32 use32
org 0x0 org 0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 1, start, i_end, mem, stacktop, file_name, sys_path dd 1, start, i_end, mem, stacktop, file_name, sys_path
@ -16,6 +16,7 @@ include 'lang.inc'
include 'info_fun_float.inc' include 'info_fun_float.inc'
include 'info_menu.inc' include 'info_menu.inc'
include 'data.inc' include 'data.inc'
include 'convert_stl_3ds.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
@ -70,8 +71,8 @@ start:
mov edi,openfile_path mov edi,openfile_path
@@: @@:
lodsd lodsd
cmp eax,0 or eax,eax
je @f ;¢ë室, ¥á«¨ 0 jz @f ;¢ë室, ¥á«¨ 0
stosd stosd
jmp @b jmp @b
@@: @@:
@ -137,9 +138,9 @@ start:
stdcall [ksubmenu_add], [main_menu], eax stdcall [ksubmenu_add], [main_menu], eax
mov dword[w_scr_t1.type],1 mov dword[w_scr_t1.type],1
stdcall dword[tl_data_init], tree1 stdcall [tl_data_init], tree1
;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list ;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list
load_image_file 'tl_sys_16.png', icon_tl_sys include_image_file 'tl_sys_16.png', icon_tl_sys
;¥á«¨ ¨§®¡à ¦¥­¨¥ ­¥ ®âªàë«®áì, â® ¢ icon_tl_sys ¡ã¤ãâ ;¥á«¨ ¨§®¡à ¦¥­¨¥ ­¥ ®âªàë«®áì, â® ¢ icon_tl_sys ¡ã¤ãâ
;­¥ ¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥, ­® ®è¨¡ª¨ ­¥ ¡ã¤¥â, â. ª. ¡ãä¥à ­ã¦­®£® à §¬¥à  ;­¥ ¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥, ­® ®è¨¡ª¨ ­¥ ¡ã¤¥â, â. ª. ¡ãä¥à ­ã¦­®£® à §¬¥à 
mov eax,dword[icon_tl_sys] mov eax,dword[icon_tl_sys]
@ -256,8 +257,8 @@ still:
@@: @@:
sub ebx,eax sub ebx,eax
mcall SF_WAIT_EVENT_TIMEOUT mcall SF_WAIT_EVENT_TIMEOUT
cmp eax,0 or eax,eax
je timer_funct jz timer_funct
cmp al,1 cmp al,1
jne @f jne @f
@ -443,7 +444,7 @@ pushad
int 0x40 int 0x40
mov dword[w_scr_t1.all_redraw],1 mov dword[w_scr_t1.all_redraw],1
stdcall [tl_draw],dword tree1 stdcall [tl_draw], tree1
stdcall [buf2d_draw], buf_0 stdcall [buf2d_draw], buf_0
@ -568,7 +569,17 @@ align 4
init_tree: init_tree:
stdcall [tl_info_clear], tree1 ;®ç¨á⪠ ᯨ᪠ ®¡ê¥ªâ®¢ stdcall [tl_info_clear], tree1 ;®ç¨á⪠ ᯨ᪠ ®¡ê¥ªâ®¢
mov esi,dword[open_file_data] mov esi,[open_file_data]
stdcall convert_stl_3ds, esi,[open_file_size] ;¯à®¢¥à塞 ä ©« ä®à¬ â  *.stl ?
or eax,eax
jz @f
;¥á«¨ ä ©« ¢ ä®à¬ â¥ *.stl
mov [open_file_size],ecx
mov esi,eax
stdcall mem.Free,[open_file_data]
mov [open_file_data],esi
mov byte[can_save],1
@@:
cmp word[esi],CHUNK_MAIN cmp word[esi],CHUNK_MAIN
je @f je @f
stdcall buf_draw_beg, buf_0 stdcall buf_draw_beg, buf_0
@ -583,8 +594,8 @@ init_tree:
stdcall add_3ds_object, ID_ICON_CHUNK_MAIN,0,dword[esi+2],0 stdcall add_3ds_object, ID_ICON_CHUNK_MAIN,0,dword[esi+2],0
call block_children ;¢å®¤ ¢ ¤®ç¥à­¨© ¡«®ª call block_children ;¢å®¤ ¢ ¤®ç¥à­¨© ¡«®ª
mov edi,dword[file_3ds.offs] mov edi,[file_3ds.offs]
add edi,dword[file_3ds.size] add edi,[file_3ds.size]
.cycle_main: .cycle_main:
cmp dword[level_stack],0 cmp dword[level_stack],0
jle .end_cycle jle .end_cycle
@ -592,7 +603,7 @@ init_tree:
cmp esi,edi ;¥á«¨ ª®­¥æ ä ©«  cmp esi,edi ;¥á«¨ ª®­¥æ ä ©« 
jge .end_cycle jge .end_cycle
mov edx,dword[esi+2] ;à §¬¥à ¡«®ª  mov edx,[esi+2] ;à §¬¥à ¡«®ª 
call block_analiz call block_analiz
cmp dword[bl_found],0 cmp dword[bl_found],0
jne @f jne @f
@ -756,9 +767,9 @@ block_children:
mov dword[level_stack],FILE_ERROR_CHUNK_SIZE mov dword[level_stack],FILE_ERROR_CHUNK_SIZE
jmp .end_f jmp .end_f
@@: @@:
mov dword[eax],esi ;㪠§ â¥«ì ­  ­ ç «® ¡«®ª  mov [eax],esi ;㪠§ â¥«ì ­  ­ ç «® ¡«®ª 
mov ebx,dword[esi+2] mov ebx,[esi+2]
mov dword[eax+4],ebx ;à §¬¥à ¡«®ª  mov [eax+4],ebx ;à §¬¥à ¡«®ª 
add esi,6 ;¯¥à¥å®¤¨¬ ª ¤ ­­ë¬ ¡«®ª  add esi,6 ;¯¥à¥å®¤¨¬ ª ¤ ­­ë¬ ¡«®ª 
inc dword[level_stack] inc dword[level_stack]
add eax,8 add eax,8
@ -815,10 +826,12 @@ popad
;input: ;input:
; esi - 㪠§ â¥«ì ­   ­ «¨§¨àã¥¬ë¥ ¤ ­­ë¥ ; esi - 㪠§ â¥«ì ­   ­ «¨§¨àã¥¬ë¥ ¤ ­­ë¥
; icon - ­®¬¥à ¨ª®­ª¨
; level - ã஢¥­ì ¢«®¦¥­­®á⨠㧫  ; level - ã஢¥­ì ¢«®¦¥­­®á⨠㧫 
; size_bl - à §¬¥à ¡«®ª  ; size_bl - à §¬¥à ¡«®ª 
; info_bl - áâப  á ®¯¨á ­¨¥¬ ¡«®ª 
align 4 align 4
proc add_3ds_object, icon:dword,level:dword,size_bl:dword,info_bl:dword proc add_3ds_object, icon:dword, level:dword, size_bl:dword, info_bl:dword
pushad pushad
mov bx,word[icon] mov bx,word[icon]
shl ebx,16 shl ebx,16
@ -830,8 +843,8 @@ proc add_3ds_object, icon:dword,level:dword,size_bl:dword,info_bl:dword
mov ecx,dword[size_bl] mov ecx,dword[size_bl]
mov dword[buffer+4],ecx ;à §¬¥à ¡«®ª  (¨á¯®«ì§ã¥âáï ¢ ä㭪樨 buf_draw_hex_table ¤«ï à¨á®¢ ­¨ï «¨­¨¨) mov dword[buffer+4],ecx ;à §¬¥à ¡«®ª  (¨á¯®«ì§ã¥âáï ¢ ä㭪樨 buf_draw_hex_table ¤«ï à¨á®¢ ­¨ï «¨­¨¨)
mov ecx,dword[bl_found] mov ecx,dword[bl_found]
cmp ecx,0 or ecx,ecx
je @f jz @f
;... §¤¥áì ­ã¦¥­ ¤à㣮©  «£®à¨â¬ § é¨âë ®â 㤠«¥­¨ï ;... §¤¥áì ­ã¦¥­ ¤à㣮©  «£®à¨â¬ § é¨âë ®â 㤠«¥­¨ï
mov cl,byte[ecx+4] mov cl,byte[ecx+4]
@@: @@:
@ -842,8 +855,8 @@ proc add_3ds_object, icon:dword,level:dword,size_bl:dword,info_bl:dword
mov dword[buffer+list_offs_p_data],ecx mov dword[buffer+list_offs_p_data],ecx
stdcall hex_in_str, buffer+list_offs_text,dword[esi+1],2 stdcall hex_in_str, buffer+list_offs_text,dword[esi+1],2
stdcall hex_in_str, buffer+list_offs_text+2,dword[esi],2 ;ª®¤ 3ds ¡«®ª  stdcall hex_in_str, buffer+list_offs_text+2,dword[esi],2 ;ª®¤ 3ds ¡«®ª 
cmp ecx,0 or ecx,ecx
jne @f jnz @f
mov byte[buffer+list_offs_text+4],0 ;0 - ᨬ¢®« ª®­æ  áâப¨ mov byte[buffer+list_offs_text+4],0 ;0 - ᨬ¢®« ª®­æ  áâப¨
jmp .no_capt jmp .no_capt
@@: @@:
@ -880,7 +893,7 @@ endp
align 4 align 4
.str: .str:
mov ecx,0x0a mov ecx,10
cmp eax,ecx cmp eax,ecx
jb @f jb @f
xor edx,edx xor edx,edx
@ -1023,6 +1036,7 @@ Filter:
dd Filter.end - Filter.1 dd Filter.end - Filter.1
.1: .1:
db '3DS',0 db '3DS',0
db 'STL',0
db 'PNG',0 db 'PNG',0
.end: .end:
db 0 db 0
@ -1046,38 +1060,38 @@ lib_name_6 db 'libini.obj',0
if lang eq ru if lang eq ru
head_f_i: head_f_i:
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0 head_f_l db '"‘¨á⥬­ ï ®è¨¡ª ',0
err_msg_found_lib_0 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,0 err_msg_found_lib_0 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,'" -tE',0
err_msg_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,0 err_msg_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,'" -tW',0
err_msg_found_lib_1 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,0 err_msg_found_lib_1 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,'" -tE',0
err_msg_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0 err_msg_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,'" -tW',0
err_msg_found_lib_2 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'box_lib.obj',39,0 err_msg_found_lib_2 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'box_lib.obj',39,'" -tE',0
err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'box_lib',39,0 err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'box_lib',39,'" -tW',0
err_msg_found_lib_3 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0 err_msg_found_lib_3 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0 err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,'" -tW',0
err_msg_found_lib_4 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'kmenu.obj',39,0 err_msg_found_lib_4 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'kmenu.obj',39,'" -tE',0
err_msg_import_4 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'kmenu',39,0 err_msg_import_4 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'kmenu',39,'" -tW',0
err_msg_found_lib_5 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'tinygl.obj',39,0 err_msg_found_lib_5 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'tinygl.obj',39,'" -tE',0
err_msg_import_5 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'tinygl',39,0 err_msg_import_5 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'tinygl',39,'" -tW',0
err_msg_found_lib_6 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libini.obj',39,0 err_msg_found_lib_6 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libini.obj',39,'" -tE',0
err_msg_import_6 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libini',39,0 err_msg_import_6 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libini',39,'" -tW',0
else else
head_f_i: head_f_i:
head_f_l db 'System error',0 head_f_l db '"System error',0
err_msg_found_lib_0 db 'Sorry I cannot found library ',39,'proc_lib.obj',39,0 err_msg_found_lib_0 db 'Sorry I cannot found library ',39,'proc_lib.obj',39,'" -tE',0
err_msg_import_0 db 'Error on load import library ',39,'proc_lib.obj',39,0 err_msg_import_0 db 'Error on load import library ',39,'proc_lib.obj',39,'" -tW',0
err_msg_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,0 err_msg_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,'" -tE',0
err_msg_import_1 db 'Error on load import library ',39,'libimg.obj',39,0 err_msg_import_1 db 'Error on load import library ',39,'libimg.obj',39,'" -tW',0
err_msg_found_lib_2 db 'Sorry I cannot found library ',39,'box_lib.obj',39,0 err_msg_found_lib_2 db 'Sorry I cannot found library ',39,'box_lib.obj',39,'" -tE',0
err_msg_import_2 db 'Error on load import library ',39,'box_lib.obj',39,0 err_msg_import_2 db 'Error on load import library ',39,'box_lib.obj',39,'" -tW',0
err_msg_found_lib_3 db 'Sorry I cannot found library ',39,'buf2d.obj',39,0 err_msg_found_lib_3 db 'Sorry I cannot found library ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_3 db 'Error on load import library ',39,'buf2d.obj',39,0 err_msg_import_3 db 'Error on load import library ',39,'buf2d.obj',39,'" -tW',0
err_msg_found_lib_4 db 'Sorry I cannot found library ',39,'kmenu.obj',39,0 err_msg_found_lib_4 db 'Sorry I cannot found library ',39,'kmenu.obj',39,'" -tE',0
err_msg_import_4 db 'Error on load import library ',39,'kmenu.obj',39,0 err_msg_import_4 db 'Error on load import library ',39,'kmenu.obj',39,'" -tW',0
err_msg_found_lib_5 db 'Sorry I cannot found library ',39,'tinygl.obj',39,0 err_msg_found_lib_5 db 'Sorry I cannot found library ',39,'tinygl.obj',39,'" -tE',0
err_msg_import_5 db 'Error on load import library ',39,'tinygl',39,0 err_msg_import_5 db 'Error on load import library ',39,'tinygl',39,'" -tW',0
err_msg_found_lib_6 db 'Sorry I cannot found library ',39,'libini.obj',39,0 err_msg_found_lib_6 db 'Sorry I cannot found library ',39,'libini.obj',39,'" -tE',0
err_msg_import_6 db 'Error on load import library ',39,'libini',39,0 err_msg_import_6 db 'Error on load import library ',39,'libini',39,'" -tW',0
end if end if
align 4 align 4
@ -1373,9 +1387,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ;
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
if lang eq ru if lang eq ru
capt db 'info 3ds ¢¥àá¨ï 10.12.17',0 ;¯®¤¯¨áì ®ª­  capt db 'info 3ds ¢¥àá¨ï 14.03.19',0 ;¯®¤¯¨áì ®ª­ 
else else
capt db 'info 3ds version 10.12.17',0 ;window caption capt db 'info 3ds version 14.03.19',0 ;window caption
end if end if
align 16 align 16

View File

@ -16,6 +16,7 @@ include 'lang.inc'
include 'info_fun_float.inc' include 'info_fun_float.inc'
include 'info_menu.inc' include 'info_menu.inc'
include 'data.inc' include 'data.inc'
include 'convert_stl_3ds.inc'
3d_wnd_l equ 205 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  á«¥¢  3d_wnd_l equ 205 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  á«¥¢ 
3d_wnd_t equ 47 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  ᢥàåã 3d_wnd_t equ 47 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  ᢥàåã
@ -78,8 +79,8 @@ start:
mov edi,openfile_path mov edi,openfile_path
@@: @@:
lodsd lodsd
cmp eax,0 or eax,eax
je @f ;¢ë室, ¥á«¨ 0 jz @f ;¢ë室, ¥á«¨ 0
stosd stosd
jmp @b jmp @b
@@: @@:
@ -130,9 +131,9 @@ start:
stdcall [ksubmenu_add], [main_menu], eax stdcall [ksubmenu_add], [main_menu], eax
mov dword[w_scr_t1.type],1 mov dword[w_scr_t1.type],1
stdcall dword[tl_data_init], tree1 stdcall [tl_data_init], tree1
;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list ;á¨á⥬­ë¥ ¨ª®­ª¨ 16*16 ¤«ï tree_list
load_image_file 'tl_sys_16.png', icon_tl_sys include_image_file 'tl_sys_16.png', icon_tl_sys
;¥á«¨ ¨§®¡à ¦¥­¨¥ ­¥ ®âªàë«®áì, â® ¢ icon_tl_sys ¡ã¤ãâ ;¥á«¨ ¨§®¡à ¦¥­¨¥ ­¥ ®âªàë«®áì, â® ¢ icon_tl_sys ¡ã¤ãâ
;­¥ ¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥, ­® ®è¨¡ª¨ ­¥ ¡ã¤¥â, â. ª. ¡ãä¥à ­ã¦­®£® à §¬¥à  ;­¥ ¨­¨æ¨ «¨§¨à®¢ ­­ë¥ ¤ ­­ë¥, ­® ®è¨¡ª¨ ­¥ ¡ã¤¥â, â. ª. ¡ãä¥à ­ã¦­®£® à §¬¥à 
mov eax,dword[icon_tl_sys] mov eax,dword[icon_tl_sys]
@ -252,8 +253,8 @@ still:
@@: @@:
sub ebx,eax sub ebx,eax
mcall SF_WAIT_EVENT_TIMEOUT mcall SF_WAIT_EVENT_TIMEOUT
cmp eax,0 or eax,eax
je timer_funct jz timer_funct
cmp al,1 cmp al,1
jne @f jne @f
@ -284,8 +285,8 @@ mouse:
jne .end_m jne .end_m
stdcall [tl_node_get_data],tree1 stdcall [tl_node_get_data],tree1
cmp eax,0 or eax,eax
je .end_d jz .end_d
mov ebx,dword[eax] mov ebx,dword[eax]
add ebx,dword[open_file_data] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ï⨠add ebx,dword[open_file_data] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ ¯ ¬ïâ¨
cmp word[ebx],CHUNK_OBJBLOCK cmp word[ebx],CHUNK_OBJBLOCK
@ -375,8 +376,8 @@ timer_funct:
;¯à®á¬ âਢ ¥¬ ¢ë¤¥«¥­­ë© ¡«®ª ¤ ­­ëå ;¯à®á¬ âਢ ¥¬ ¢ë¤¥«¥­­ë© ¡«®ª ¤ ­­ëå
stdcall [tl_node_get_data],tree1 stdcall [tl_node_get_data],tree1
cmp eax,0 or eax,eax
je .end_f jz .end_f
mov edi,eax mov edi,eax
add edi,list_offs_obj3d add edi,list_offs_obj3d
mov ebx,eax mov ebx,eax
@ -422,8 +423,8 @@ timer_funct:
stdcall buf_draw_beg, buf_ogl stdcall buf_draw_beg, buf_ogl
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_3ds_offs,5,35,0xb000 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_3ds_offs,5,35,0xb000
mov edx,dword[ebx+list_offs_p_data] mov edx,dword[ebx+list_offs_p_data]
cmp edx,0 ;ᬮâਬ ¥áâì «¨ ®¯¨á ­¨¥ ¡«®ª  or edx,edx ;ᬮâਬ ¥áâì «¨ ®¯¨á ­¨¥ ¡«®ª 
je .no_info jz .no_info
stdcall [buf2d_draw_text], buf_ogl, buf_1,edx,5,45,0xb000 stdcall [buf2d_draw_text], buf_ogl, buf_1,edx,5,45,0xb000
.no_info: .no_info:
stdcall [buf2d_draw], buf_ogl ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥ stdcall [buf2d_draw], buf_ogl ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
@ -508,8 +509,8 @@ key:
fadd dword[delt_size] fadd dword[delt_size]
fstp dword[angle_x] fstp dword[angle_x]
stdcall [tl_node_get_data],tree1 stdcall [tl_node_get_data],tree1
cmp eax,0 or eax,eax
je .end jz .end
add eax,list_offs_obj3d add eax,list_offs_obj3d
stdcall draw_3d, eax stdcall draw_3d, eax
jmp .end jmp .end
@ -520,8 +521,8 @@ key:
fsub dword[delt_size] fsub dword[delt_size]
fstp dword[angle_x] fstp dword[angle_x]
stdcall [tl_node_get_data],tree1 stdcall [tl_node_get_data],tree1
cmp eax,0 or eax,eax
je .end jz .end
add eax,list_offs_obj3d add eax,list_offs_obj3d
stdcall draw_3d, eax stdcall draw_3d, eax
jmp .end jmp .end
@ -532,8 +533,8 @@ key:
fadd dword[delt_size] fadd dword[delt_size]
fstp dword[angle_y] fstp dword[angle_y]
stdcall [tl_node_get_data],tree1 stdcall [tl_node_get_data],tree1
cmp eax,0 or eax,eax
je .end jz .end
add eax,list_offs_obj3d add eax,list_offs_obj3d
stdcall draw_3d, eax stdcall draw_3d, eax
jmp .end jmp .end
@ -544,8 +545,8 @@ key:
fsub dword[delt_size] fsub dword[delt_size]
fstp dword[angle_y] fstp dword[angle_y]
stdcall [tl_node_get_data],tree1 stdcall [tl_node_get_data],tree1
cmp eax,0 or eax,eax
je .end jz .end
add eax,list_offs_obj3d add eax,list_offs_obj3d
stdcall draw_3d, eax stdcall draw_3d, eax
;jmp .end ;jmp .end
@ -627,17 +628,17 @@ button:
align 4 align 4
but_new_file: but_new_file:
push eax ebx push eax ebx
stdcall dword[tl_node_poi_get_info], tree1,0 stdcall [tl_node_poi_get_info], tree1,0
@@: @@:
cmp eax,0 or eax,eax
je @f jz @f
mov ebx,eax mov ebx,eax
stdcall [tl_node_poi_get_data], tree1,ebx stdcall [tl_node_poi_get_data], tree1,ebx
add eax,list_offs_obj3d add eax,list_offs_obj3d
stdcall obj_clear_param, eax stdcall obj_clear_param, eax
stdcall dword[tl_node_poi_get_next_info], tree1,ebx stdcall [tl_node_poi_get_next_info], tree1,ebx
cmp eax,0 or eax,eax
jne @b jnz @b
@@: @@:
pop ebx eax pop ebx eax
stdcall [tl_info_clear], tree1 ;®ç¨á⪠ ᯨ᪠ ®¡ê¥ªâ®¢ stdcall [tl_info_clear], tree1 ;®ç¨á⪠ ᯨ᪠ ®¡ê¥ªâ®¢
@ -694,25 +695,38 @@ but_open_file:
align 4 align 4
init_tree: init_tree:
;ç¨á⨬ ¯ ¬ïâì § ­ïâãî ®¡ê¥ªâ ¬¨ ;ç¨á⨬ ¯ ¬ïâì § ­ïâãî ®¡ê¥ªâ ¬¨
stdcall dword[tl_node_poi_get_info], tree1,0 stdcall [tl_node_poi_get_info], tree1,0
@@: @@:
cmp eax,0 or eax,eax
je @f jz @f
mov ebx,eax mov ebx,eax
stdcall [tl_node_poi_get_data], tree1,ebx stdcall [tl_node_poi_get_data], tree1,ebx
cmp eax,0 or eax,eax
je @f jz @f
add eax,list_offs_obj3d add eax,list_offs_obj3d
stdcall obj_clear_param, eax stdcall obj_clear_param, eax
stdcall dword[tl_node_poi_get_next_info], tree1,ebx stdcall [tl_node_poi_get_next_info], tree1,ebx
cmp eax,0 or eax,eax
jne @b jnz @b
@@: @@:
stdcall [tl_info_clear], tree1 ;®ç¨á⪠ ᯨ᪠ ®¡ê¥ªâ®¢ stdcall [tl_info_clear], tree1 ;®ç¨á⪠ ᯨ᪠ ®¡ê¥ªâ®¢
mov esi,dword[open_file_data] mov esi,[open_file_data]
stdcall convert_stl_3ds, esi,[open_file_size] ;¯à®¢¥à塞 ä ©« ä®à¬ â  *.stl ?
or eax,eax
jz @f
;¥á«¨ ä ©« ¢ ä®à¬ â¥ *.stl
mov [open_file_size],ecx
mov esi,eax
stdcall mem.Free,[open_file_data]
mov [open_file_data],esi
mov byte[can_save],1
@@:
cmp word[esi],CHUNK_MAIN cmp word[esi],CHUNK_MAIN
je @f je @f
mov eax,[esi]
bswap eax
stdcall hex_in_str, txt_no_3ds.zag, eax,8
stdcall buf_draw_beg, buf_ogl stdcall buf_draw_beg, buf_ogl
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_no_3ds,5,25,0xff0000 ;à¨á㥬 áâபã á ⥪á⮬ stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_no_3ds,5,25,0xff0000 ;à¨á㥬 áâபã á ⥪á⮬
jmp .end_open jmp .end_open
@ -725,8 +739,8 @@ init_tree:
stdcall add_3ds_object, ID_ICON_CHUNK_MAIN,0,dword[esi+2],0 stdcall add_3ds_object, ID_ICON_CHUNK_MAIN,0,dword[esi+2],0
call block_children ;¢å®¤ ¢ ¤®ç¥à­¨© ¡«®ª call block_children ;¢å®¤ ¢ ¤®ç¥à­¨© ¡«®ª
mov edi,dword[file_3ds.offs] mov edi,[file_3ds.offs]
add edi,dword[file_3ds.size] add edi,[file_3ds.size]
.cycle_main: .cycle_main:
cmp dword[level_stack],0 cmp dword[level_stack],0
jle .end_cycle jle .end_cycle
@ -734,7 +748,7 @@ init_tree:
cmp esi,edi ;¥á«¨ ª®­¥æ ä ©«  cmp esi,edi ;¥á«¨ ª®­¥æ ä ©« 
jge .end_cycle jge .end_cycle
mov edx,dword[esi+2] ;à §¬¥à ¡«®ª  mov edx,[esi+2] ;à §¬¥à ¡«®ª 
call block_analiz call block_analiz
cmp word[esi],CHUNK_MATERIAL cmp word[esi],CHUNK_MATERIAL
je @f je @f
@ -796,8 +810,8 @@ init_tree:
; esi - new memory pointer ; esi - new memory pointer
align 4 align 4
proc block_analiz_data uses ebx ecx edx edi proc block_analiz_data uses ebx ecx edx edi
mov dx,word[esi] mov dx,[esi]
mov ecx,dword[esi+2] mov ecx,[esi+2]
sub ecx,6 ;à §¬¥à ¤ ­­ëå ¢ ¡«®ª¥ sub ecx,6 ;à §¬¥à ¤ ­­ëå ¢ ¡«®ª¥
add esi,6 add esi,6
mov ebx,dword[level_stack] mov ebx,dword[level_stack]
@ -902,20 +916,19 @@ align 4
block_children: block_children:
push ecx push ecx
;¯à®¢¥àª  ¯à ¢¨«ì­®á⨠ࠧ¬¥à®¢ ¤®ç¥à­¥£® ¡«®ª  ;¯à®¢¥àª  ¯à ¢¨«ì­®á⨠ࠧ¬¥à®¢ ¤®ç¥à­¥£® ¡«®ª 
mov ebx,esi lea ebx,[esi+6] ;¯¥à¥å®¤ ­  ­ ç «® ¤®ç¥à­¥£® ¡«®ª 
add ebx,6 ;¯¥à¥å®¤ ­  ­ ç «® ¤®ç¥à­¥£® ¡«®ª  add ebx,[ebx+2] ;¤®¡ ¢«ï¥¬ à §¬¥à ¤®ç¥à­¥£® ¡«®ª 
add ebx,dword[ebx+2] ;¤®¡ ¢«ï¥¬ à §¬¥à ¤®ç¥à­¥£® ¡«®ª 
mov ecx,esi mov ecx,esi
add ecx,dword[esi+2] ;¤®¡ ¢«ï¥¬ à §¬¥à த¨â¥«ì᪮£® ¡«®ª  add ecx,[esi+2] ;¤®¡ ¢«ï¥¬ à §¬¥à த¨â¥«ì᪮£® ¡«®ª 
cmp ebx,ecx ;ãç¨â뢠âì § £®«®¢ª¨ ­¥ ­ã¦­®, â. ª. áà ¢­¨¢ îâáï ⮫쪮 ¤ ­­ë¥ ¡«®ª®¢ cmp ebx,ecx ;ãç¨â뢠âì § £®«®¢ª¨ ­¥ ­ã¦­®, â. ª. áà ¢­¨¢ îâáï ⮫쪮 ¤ ­­ë¥ ¡«®ª®¢
jle @f jle @f
;¤¨ £­®áâ¨à®¢ «¨ ®è¨¡ªã ä ©« , ¤®ç¥à­¨© ¡«®ª ¢ë室¨â §  ¯à¥¤¥«ë த¨â¥«ì᪮£® ;¤¨ £­®áâ¨à®¢ «¨ ®è¨¡ªã ä ©« , ¤®ç¥à­¨© ¡«®ª ¢ë室¨â §  ¯à¥¤¥«ë த¨â¥«ì᪮£®
mov dword[level_stack],FILE_ERROR_CHUNK_SIZE mov dword[level_stack],FILE_ERROR_CHUNK_SIZE
jmp .end_f jmp .end_f
@@: @@:
mov dword[eax],esi ;㪠§ â¥«ì ­  ­ ç «® ¡«®ª  mov [eax],esi ;㪠§ â¥«ì ­  ­ ç «® ¡«®ª 
mov ebx,dword[esi+2] mov ebx,[esi+2]
mov dword[eax+4],ebx ;à §¬¥à ¡«®ª  mov [eax+4],ebx ;à §¬¥à ¡«®ª 
add esi,6 ;¯¥à¥å®¤¨¬ ª ¤ ­­ë¬ ¡«®ª  add esi,6 ;¯¥à¥å®¤¨¬ ª ¤ ­­ë¬ ¡«®ª 
inc dword[level_stack] inc dword[level_stack]
add eax,8 add eax,8
@ -972,10 +985,12 @@ popad
;input: ;input:
; esi - 㪠§ â¥«ì ­   ­ «¨§¨àã¥¬ë¥ ¤ ­­ë¥ ; esi - 㪠§ â¥«ì ­   ­ «¨§¨àã¥¬ë¥ ¤ ­­ë¥
; icon - ­®¬¥à ¨ª®­ª¨
; level - ã஢¥­ì ¢«®¦¥­­®á⨠㧫  ; level - ã஢¥­ì ¢«®¦¥­­®á⨠㧫 
; size_bl - à §¬¥à ¡«®ª  ; size_bl - à §¬¥à ¡«®ª 
; info_bl - áâப  á ®¯¨á ­¨¥¬ ¡«®ª 
align 4 align 4
proc add_3ds_object, icon:dword,level:dword,size_bl:dword,info_bl:dword proc add_3ds_object, icon:dword, level:dword, size_bl:dword, info_bl:dword
pushad pushad
mov bx,word[icon] mov bx,word[icon]
shl ebx,16 shl ebx,16
@ -987,8 +1002,8 @@ proc add_3ds_object, icon:dword,level:dword,size_bl:dword,info_bl:dword
mov ecx,dword[size_bl] mov ecx,dword[size_bl]
mov dword[buffer+4],ecx ;à §¬¥à ¡«®ª  (¨á¯®«ì§ã¥âáï ¢ ä㭪樨 buf_draw_hex_table ¤«ï à¨á®¢ ­¨ï «¨­¨¨) mov dword[buffer+4],ecx ;à §¬¥à ¡«®ª  (¨á¯®«ì§ã¥âáï ¢ ä㭪樨 buf_draw_hex_table ¤«ï à¨á®¢ ­¨ï «¨­¨¨)
mov ecx,dword[bl_found] mov ecx,dword[bl_found]
cmp ecx,0 or ecx,ecx
je @f jz @f
;... §¤¥áì ­ã¦¥­ ¤à㣮©  «£®à¨â¬ § é¨âë ®â 㤠«¥­¨ï ;... §¤¥áì ­ã¦¥­ ¤à㣮©  «£®à¨â¬ § é¨âë ®â 㤠«¥­¨ï
mov cl,byte[ecx+4] mov cl,byte[ecx+4]
@@: @@:
@ -999,8 +1014,8 @@ proc add_3ds_object, icon:dword,level:dword,size_bl:dword,info_bl:dword
mov dword[buffer+list_offs_p_data],ecx mov dword[buffer+list_offs_p_data],ecx
stdcall hex_in_str, buffer+list_offs_text,dword[esi+1],2 stdcall hex_in_str, buffer+list_offs_text,dword[esi+1],2
stdcall hex_in_str, buffer+list_offs_text+2,dword[esi],2 ;ª®¤ 3ds ¡«®ª  stdcall hex_in_str, buffer+list_offs_text+2,dword[esi],2 ;ª®¤ 3ds ¡«®ª 
cmp ecx,0 or ecx,ecx
jne @f jnz @f
mov byte[buffer+list_offs_text+4],0 ;0 - ᨬ¢®« ª®­æ  áâப¨ mov byte[buffer+list_offs_text+4],0 ;0 - ᨬ¢®« ª®­æ  áâப¨
jmp .no_capt jmp .no_capt
@@: @@:
@ -1042,7 +1057,7 @@ endp
align 4 align 4
.str: .str:
mov ecx,0x0a mov ecx,10
cmp eax,ecx cmp eax,ecx
jb @f jb @f
xor edx,edx xor edx,edx
@ -1094,6 +1109,7 @@ Filter:
dd Filter.end - Filter.1 dd Filter.end - Filter.1
.1: .1:
db '3DS',0 db '3DS',0
db 'STL',0
db 'PNG',0 db 'PNG',0
.end: .end:
db 0 db 0
@ -1117,38 +1133,38 @@ lib_name_6 db 'libini.obj',0
if lang eq ru if lang eq ru
head_f_i: head_f_i:
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0 head_f_l db '"‘¨á⥬­ ï ®è¨¡ª ',0
err_msg_found_lib_0 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,0 err_msg_found_lib_0 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,'" -tE',0
err_msg_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,0 err_msg_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,'" -tW',0
err_msg_found_lib_1 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,0 err_msg_found_lib_1 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,'" -tE',0
err_msg_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0 err_msg_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,'" -tW',0
err_msg_found_lib_2 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'box_lib.obj',39,0 err_msg_found_lib_2 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'box_lib.obj',39,'" -tE',0
err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'box_lib',39,0 err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'box_lib',39,'" -tW',0
err_msg_found_lib_3 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0 err_msg_found_lib_3 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0 err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,'" -tW',0
err_msg_found_lib_4 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'kmenu.obj',39,0 err_msg_found_lib_4 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'kmenu.obj',39,'" -tE',0
err_msg_import_4 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'kmenu',39,0 err_msg_import_4 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'kmenu',39,'" -tW',0
err_msg_found_lib_5 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'tinygl.obj',39,0 err_msg_found_lib_5 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'tinygl.obj',39,'" -tE',0
err_msg_import_5 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'tinygl',39,0 err_msg_import_5 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'tinygl',39,'" -tW',0
err_msg_found_lib_6 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libini.obj',39,0 err_msg_found_lib_6 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libini.obj',39,'" -tE',0
err_msg_import_6 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libini',39,0 err_msg_import_6 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libini',39,'" -tW',0
else else
head_f_i: head_f_i:
head_f_l db 'System error',0 head_f_l db '"System error',0
err_msg_found_lib_0 db 'Sorry I cannot found library ',39,'proc_lib.obj',39,0 err_msg_found_lib_0 db 'Sorry I cannot found library ',39,'proc_lib.obj',39,'" -tE',0
err_msg_import_0 db 'Error on load import library ',39,'proc_lib.obj',39,0 err_msg_import_0 db 'Error on load import library ',39,'proc_lib.obj',39,'" -tW',0
err_msg_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,0 err_msg_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,'" -tE',0
err_msg_import_1 db 'Error on load import library ',39,'libimg.obj',39,0 err_msg_import_1 db 'Error on load import library ',39,'libimg.obj',39,'" -tW',0
err_msg_found_lib_2 db 'Sorry I cannot found library ',39,'box_lib.obj',39,0 err_msg_found_lib_2 db 'Sorry I cannot found library ',39,'box_lib.obj',39,'" -tE',0
err_msg_import_2 db 'Error on load import library ',39,'box_lib.obj',39,0 err_msg_import_2 db 'Error on load import library ',39,'box_lib.obj',39,'" -tW',0
err_msg_found_lib_3 db 'Sorry I cannot found library ',39,'buf2d.obj',39,0 err_msg_found_lib_3 db 'Sorry I cannot found library ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_3 db 'Error on load import library ',39,'buf2d.obj',39,0 err_msg_import_3 db 'Error on load import library ',39,'buf2d.obj',39,'" -tW',0
err_msg_found_lib_4 db 'Sorry I cannot found library ',39,'kmenu.obj',39,0 err_msg_found_lib_4 db 'Sorry I cannot found library ',39,'kmenu.obj',39,'" -tE',0
err_msg_import_4 db 'Error on load import library ',39,'kmenu.obj',39,0 err_msg_import_4 db 'Error on load import library ',39,'kmenu.obj',39,'" -tW',0
err_msg_found_lib_5 db 'Sorry I cannot found library ',39,'tinygl.obj',39,0 err_msg_found_lib_5 db 'Sorry I cannot found library ',39,'tinygl.obj',39,'" -tE',0
err_msg_import_5 db 'Error on load import library ',39,'tinygl',39,0 err_msg_import_5 db 'Error on load import library ',39,'tinygl',39,'" -tW',0
err_msg_found_lib_6 db 'Sorry I cannot found library ',39,'libini.obj',39,0 err_msg_found_lib_6 db 'Sorry I cannot found library ',39,'libini.obj',39,'" -tE',0
err_msg_import_6 db 'Error on load import library ',39,'libini',39,0 err_msg_import_6 db 'Error on load import library ',39,'libini',39,'" -tW',0
end if end if
align 4 align 4
@ -1439,9 +1455,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ;
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
if lang eq ru if lang eq ru
capt db 'info 3ds [user] ¢¥àá¨ï 18.04.17',0 ;¯®¤¯¨áì ®ª­  capt db 'info 3ds [user] ¢¥àá¨ï 14.03.19',0 ;¯®¤¯¨áì ®ª­ 
else else
capt db 'info 3ds [user] version 18.04.17',0 ;window caption capt db 'info 3ds [user] version 14.03.19',0 ;window caption
end if end if
align 16 align 16

View File

@ -348,7 +348,7 @@ pushad
je .end je .end
finit finit
imul eax,12 imul eax,12
stdcall mem.Alloc, eax stdcall mem.Alloc,eax
mov [ecx+obj_3d.normals_tri_data],eax mov [ecx+obj_3d.normals_tri_data],eax
mov edx,[ecx+obj_3d.tri_data] mov edx,[ecx+obj_3d.tri_data]
@ -638,6 +638,8 @@ proc obj_init, o_data:dword
;¯®¨áª ¬ â¥à¨ «®¢ £à ­¥© ;¯®¨áª ¬ â¥à¨ «®¢ £à ­¥©
shl edx,3 shl edx,3
add esi,edx add esi,edx
cmp esi,ecx
jge .end_points ;¥á«¨ ­¥â ¡«®ª  á ¬ â¥à¨ «®¬
cmp word[esi],CHUNK_FACEMAT cmp word[esi],CHUNK_FACEMAT
jne .end_points jne .end_points
mov [edi+obj_3d.mat1_data],esi mov [edi+obj_3d.mat1_data],esi
@ -825,20 +827,26 @@ if version_edit eq 0
bt dword[draw_mode],bit_faces_mat bt dword[draw_mode],bit_faces_mat
jnc @f jnc @f
mov eax,[edi+obj_3d.mat1_data] mov eax,[edi+obj_3d.mat1_data]
or eax,eax
jnz .b_found
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_mat_null,5,3,[color_select]
jmp .mat_null ;¥á«¨ ­¥â ¬ â¥à¨ « , à¨á㥬 ¢á¥ £à ­¨ ®¤­¨¬ 梥⮬
.b_found: .b_found:
cmp eax,0
je .end_points
mov ebx,eax mov ebx,eax
stdcall get_mat_color, eax stdcall get_mat_color, eax
stdcall draw_3d_faces_color, edi,ebx,eax stdcall draw_3d_faces_color, edi,ebx,eax
stdcall found_mat_faces, ebx stdcall found_mat_faces, ebx
jmp .b_found or eax,eax
jnz .b_found
jmp .end_points
@@: @@:
end if end if
;à¨á®¢ ­¨¥ £à ­¥© ¡¥§ 梥⮢ ¬ â¥à¨ «®¢ ;à¨á®¢ ­¨¥ £à ­¥© ¡¥§ 梥⮢ ¬ â¥à¨ «®¢
bt dword[draw_mode],bit_faces bt dword[draw_mode],bit_faces
jnc .end_triangles jnc .end_triangles
.mat_null:
cmp dword[edi+obj_3d.tri_count],0 cmp dword[edi+obj_3d.tri_count],0
je .end_triangles je .end_triangles
cmp dword[edi+obj_3d.poi_count],0 cmp dword[edi+obj_3d.poi_count],0
@ -935,6 +943,8 @@ align 4
@@: @@:
bt dword[draw_mode],bit_light bt dword[draw_mode],bit_light
jnc .norm0 jnc .norm0
or edx,edx
jz .norm0 ;¥á«¨ ­®à¬ «¥© ­¥â
stdcall [glNormal3fv], edx stdcall [glNormal3fv], edx
add edx,12 add edx,12
.norm0: .norm0:
@ -977,7 +987,7 @@ if version_edit eq 1
je .end_select je .end_select
mov ecx,dword[obj_poi_sel_c] mov ecx,dword[obj_poi_sel_c]
stdcall [glColor3ub],[color_select+2],[color_select+1],[color_select] stdcall [glColor3ub],[color_select+2],[color_select+1],[color_select]
stdcall dword[tl_node_poi_get_info], tree3,0 stdcall [tl_node_poi_get_info], tree3,0
align 4 align 4
@@: @@:
cmp eax,0 cmp eax,0
@ -994,7 +1004,7 @@ align 4
dec ecx dec ecx
jz .end_select jz .end_select
.next_sel: .next_sel:
stdcall dword[tl_node_poi_get_next_info], tree3,ebx stdcall [tl_node_poi_get_next_info], tree3,ebx
jmp @b jmp @b
.end_select: .end_select:
end if end if
@ -1170,6 +1180,8 @@ pop ebx eax
align 4 align 4
proc found_mat_faces uses ebx, p_mat:dword proc found_mat_faces uses ebx, p_mat:dword
mov eax,[p_mat] mov eax,[p_mat]
or eax,eax
jz @f
add eax,[eax+2] add eax,[eax+2]
cmp word[eax],CHUNK_FACEMAT cmp word[eax],CHUNK_FACEMAT
je @f je @f