1) add new program 'voxel_editor'

2) fix file menu.dat

git-svn-id: svn://kolibrios.org@2748 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2012-06-05 15:33:54 +00:00
parent 4d1662a914
commit 0b625a1233
14 changed files with 2698 additions and 30 deletions

View File

@ -118,7 +118,7 @@ Save RD image /rd/1/rdsave
#14 **** DATA PROCESSING ****
Calculator /rd/1/calc
TinyPad /rd/1/tinypad
T_Edit /rd/1/t_edit
T_Edit /rd/1/develop/t_edit
Table Processor /rd/1/table
Graph builder /rd/1/graph
Hex-Editor /rd/1/develop/heed

View File

@ -119,7 +119,7 @@ Save RD image /rd/1/rdsave
#14 **** DATA PROCESSING ****
Calculator /rd/1/calc
TinyPad /rd/1/tinypad
T_Edit /rd/1/t_edit
T_Edit /rd/1/develop/t_edit
Table Processor /rd/1/table
Graph builder /rd/1/graph
Hex-Editor /rd/1/develop/heed

View File

@ -119,7 +119,7 @@ Save RD image /rd/1/rdsave
#14 **** DATA PROCESSING ****
Calculator /rd/1/calc
TinyPad /rd/1/tinypad
T_Edit /rd/1/t_edit
T_Edit /rd/1/develop/t_edit
Table Processor /rd/1/table
Graph builder /rd/1/graph
Hex-Editor /rd/1/develop/heed

View File

@ -120,7 +120,7 @@ Eolite /rd/1/File Managers/Eolite
#14 **** Ž<><C5BD><EFBFBD>ŽŠ€ „€<E2809E><E282AC>• ****
Š «ìªã«ïâ®à /rd/1/calc
’¥ªáâ.।. Tinypad /rd/1/tinypad
’¥ªáâ.।. T_Edit /rd/1/t_edit
’¥ªáâ.।. T_Edit /rd/1/develop/t_edit
’ ¡«¨ç­ë© ¯à®æ¥áá®à /rd/1/table
<EFBFBD>®áâ஥­¨¥ £à ä¨ª®¢ /rd/1/graph
HEX-। ªâ®à /rd/1/develop/heed

View File

@ -48,6 +48,9 @@ BUF2D_BIT_OPT_CROP_LEFT equ 1
BUF2D_BIT_OPT_CROP_BOTTOM equ 2
BUF2D_BIT_OPT_CROP_RIGHT equ 3
vox_offs_tree_table equ 4
vox_offs_data equ 12
;input:
; eax = 㪠§ â¥«ì ­  äã­ªæ¨î ¢ë¤¥«¥­¨ï ¯ ¬ïâ¨
; ebx = ... ®á¢®¡®¦¤¥­¨ï ¯ ¬ïâ¨
@ -2185,33 +2188,26 @@ align 4
combine_colors:
push ax bx cx dx
mov bx,0x00ff ;---get transparent---
mov cl,byte[esi+3] ;pro
xor ch,ch
movzx cx,byte[esi+3] ;pro
sub bx,cx ;256-pro
;---blye---
xor ah,ah
mov al,byte[esi]
movzx ax,byte[esi]
imul ax,bx
xor dh,dh
mov dl,byte[edi]
movzx dx,byte[edi]
imul dx,cx
add ax,dx
mov byte[edi],ah
;---green---
xor ah,ah
mov al,byte[esi+1]
movzx ax,byte[esi+1]
imul ax,bx
xor dh,dh
mov dl,byte[edi+1]
movzx dx,byte[edi+1]
imul dx,cx
add ax,dx
mov byte[edi+1],ah
;---red---
xor ah,ah
mov al,byte[esi+2]
movzx ax,byte[esi+2]
imul ax,bx
xor dh,dh
mov dl,byte[edi+2]
movzx dx,byte[edi+2]
imul dx,cx
add ax,dx
mov byte[edi+2],ah
@ -2339,31 +2335,25 @@ combine_colors_2:
sub si,cx ;256-pro
;---blye---
mov al,bl
xor ah,ah
movzx ax,bl
shr ebx,8
imul ax,si
xor dh,dh
mov dl,byte[edi]
movzx dx,byte[edi]
imul dx,cx
add ax,dx
mov byte[edi],ah
;---green---
mov al,bl
xor ah,ah
movzx ax,bl
shr ebx,8
imul ax,si
xor dh,dh
mov dl,byte[edi+1]
movzx dx,byte[edi+1]
imul dx,cx
add ax,dx
mov byte[edi+1],ah
;---red---
mov al,bl
xor ah,ah
movzx ax,bl
imul ax,si
xor dh,dh
mov dl,byte[edi+2]
movzx dx,byte[edi+2]
imul dx,cx
add ax,dx
mov byte[edi+2],ah
@ -2806,6 +2796,162 @@ proc buf_curve_bezier, buffer:dword, coord_p0:dword,coord_p1:dword,coord_p2:dwor
ret
endp
;*** ä㭪樨 ¤«ï à ¡®âë á ¢®ªá¥«ì­®© £à ä¨ª®© ***
;ᮧ¤ ­¨¥ ¢®ªá¥«ì­ëå ª¨á⥩
align 4
proc vox_brush_create uses eax ebx ecx edi, h_br:dword, buf_z:dword
mov edi,[h_br]
movzx ecx,byte[edi+3]
add edi,4
; *** ᮧ¤ ­¨¥ ¥¤¨­¨ç­®© ª¨á⨠***
mov eax,[buf_z]
mov buf2d_data,eax
movzx eax,byte[edi-4] ;è¨à¨­  ¥¤¨­¨ç­®© ª¨áâ¨
mov buf2d_w,eax ;è¨à¨­  ¡ãä¥à 
movzx eax,byte[edi-4+1] ;¢ëá®â  ¥¤¨­¨ç­®© ª¨áâ¨
mov buf2d_h,eax ;¢ëá®â  ¡ãä¥à 
mov buf2d_size_lt,0 ;®âáâ㯠᫥¢  ¨ á¯à ¢  ¤«ï ¡ãä¥à 
mov buf2d_color,0 ;梥â ä®­  ¡ãä¥à 
mov buf2d_bits,32 ;ª®«¨ç¥á⢮ ¡¨â ¢ 1-© â®çª¥ ¨§®¡à ¦¥­¨ï
; *** ᮧ¤ ­¨¥ á«¥¤ãîé¨å ª¨á⥩ ***
cmp ecx,1
jl .end_creat
movzx ebx,byte[edi-4+2] ;¢ëá®â  ®á­®¢ ­¨ï ¥¤¨­¨ç­®© ª¨áâ¨
shr ebx,1
cld
@@:
mov eax,edi
add edi,BUF_STRUCT_SIZE
stdcall vox_create_next_brush, eax, edi, ebx
shl ebx,1
loop @b
.end_creat:
ret
endp
;㤠«¥­¨¥ ¢®ªá¥«ì­ëå ª¨á⥩
align 4
proc vox_brush_delete uses ecx edi, h_br:dword
mov edi,[h_br]
movzx ecx,byte[edi+3]
add edi,4
; *** 㤠«¥­¨¥ ª¨á⥩ ***
cmp ecx,1
jl .end_delete
cld
@@:
add edi,BUF_STRUCT_SIZE
stdcall buf_delete, edi
loop @b
.end_delete:
ret
endp
;äã­ªæ¨ï ¤«ï ᮧ¤ ­¨ï ¢®ªá¥«ï á«¥¤ãî饣® ¯®à浪 
; buf_v1 - ¡ãä¥à á ¨á室­ë¬ ¢®ªá¥«¥¬
; buf_v2 - ¡ãä¥à á 㢥«¨ç¥­ë¬ ¢®ªá¥«¥¬
; h - ¢ëá®â  ®á­®¢ ­¨ï ¨á室­®£® ¢®ªá¥«ï : 2
align 4
proc vox_create_next_brush uses eax ebx ecx edx edi, buf_v1:dword, buf_v2:dword, h:dword
mov edi,[buf_v1]
mov ebx,buf2d_h
mov ecx,buf2d_w
mov edi,[buf_v2]
mov buf2d_h,ebx
shl buf2d_h,1
mov buf2d_w,ecx
shl buf2d_w,1
mov buf2d_color,0
mov buf2d_bits,32
stdcall buf_create, [buf_v2] ;ᮧ¤ ­¨¥ ¡ãä¥à  £«ã¡¨­ë
shr ecx,1
mov edx,[h]
shl edx,1
sub ebx,edx
;ecx - è¨à¨­  ¨á室­®£® ¢®ªá¥«ï : 2
;ebx - ¢ëá®â  ¨á室­®£® ¢®ªá¥«ï (¡¥§ ®á­®¢ ­¨ï)
;edx - ¢ëá®â  ®á­®¢ ­¨ï ¨á室­®£® ¢®ªá¥«ï
stdcall vox_add, [buf_v2], [buf_v1], ecx,0,0
stdcall vox_add, [buf_v2], [buf_v1], ecx,ebx,0
mov eax,[h]
stdcall vox_add, [buf_v2], [buf_v1], 0,eax,eax
push eax ;stdcall ...
add eax,ebx
stdcall vox_add, [buf_v2], [buf_v1], 0,eax ;,...
sub eax,ebx
shl ecx,1
;ecx - è¨à¨­  ¨á室­®£® ¢®ªá¥«ï
mov eax,[h]
stdcall vox_add, [buf_v2], [buf_v1], ecx,eax,eax
push eax ;stdcall ...,[h]
add eax,ebx
stdcall vox_add, [buf_v2], [buf_v1], ecx,eax;,[h]
;sub eax,ebx
shr ecx,1
;ecx - è¨à¨­  ¨á室­®£® ¢®ªá¥«ï : 2
stdcall vox_add, [buf_v2], [buf_v1], ecx,edx,edx
add ebx,edx
stdcall vox_add, [buf_v2], [buf_v1], ecx,ebx,edx
ret
endp
;
align 4
proc vox_add uses ebx ecx, buf_v1:dword, buf_v2:dword, coord_x:dword, coord_y:dword, coord_z:dword
pushad
mov eax,[coord_x]
mov ebx,[coord_y]
mov edi,[buf_v2]
mov ecx,buf2d_h
mov esi,buf2d_w
imul ecx,esi
add esi,eax
mov edx,buf2d_data
cld
;ecx - count pixels in voxel
;edx - 㪠§ â¥«ì ­  ¤ ­­ë¥ ¢ ¢®ªá¥«ì­®¬ ¡ãä¥à¥
;edi - 㪠§ â¥«ì ­  ¢®ªá¥«ì­ë© ¡ãä¥à
;esi - width voxel buffer add coord x
.cycle:
cmp dword[edx],0
je @f
;¯à®¢¥à塞 ¡ãä¥à £«ã¡¨­ë
push eax ecx esi
mov ecx,eax
stdcall buf_get_pixel, [buf_v1],ecx,ebx
mov esi,[edx]
add esi,[coord_z]
cmp eax,esi
jge .end_draw
stdcall buf_set_pixel, [buf_v1],ecx,ebx,esi ;esi = new coord z
.end_draw:
pop esi ecx eax
@@:
add edx,4
inc eax
cmp eax,esi
jl @f
inc ebx
sub eax,buf2d_w
@@:
loop .cycle
popad
ret
endp
txt_err_n8b db 'need buffer 8 bit',13,10,0
txt_err_n24b db 'need buffer 24 bit',13,10,0
txt_err_n8_24b db 'need buffer 8 or 24 bit',13,10,0
@ -2839,6 +2985,8 @@ EXPORTS:
dd sz_buf2d_flood_fill, buf_flood_fill
dd sz_buf2d_set_pixel, buf_set_pixel
dd sz_buf2d_get_pixel, buf_get_pixel
dd sz_buf2d_vox_brush_create, vox_brush_create
dd sz_buf2d_vox_brush_delete, vox_brush_delete
dd 0,0
sz_lib_init db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
@ -2867,3 +3015,5 @@ EXPORTS:
sz_buf2d_flood_fill db 'buf2d_flood_fill',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
sz_buf2d_get_pixel db 'buf2d_get_pixel',0
sz_buf2d_vox_brush_create db 'buf2d_vox_brush_create',0
sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0

Binary file not shown.

View File

@ -0,0 +1,8 @@
if not exist bin mkdir bin
if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png
@copy *.vox bin\*.vox
if not exist bin\buf2d.obj @fasm.exe -m 16384 ..\..\..\develop\libraries\buf2d\trunk\buf2d.asm bin\buf2d.obj
@kpack bin\buf2d.obj
@fasm.exe -m 16384 voxel_editor.asm bin\voxel_editor.kex
@kpack bin\voxel_editor.kex
pause

View File

@ -0,0 +1,99 @@
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
or edx,edx
jz .exit
push esi
mov esi,[esi+4]
mov edi,s_libdir.fname
@@: lodsb
stosb
or al,al
jnz @b
mcall 68,19,s_libdir
or eax,eax
jz .fail
stdcall dll.Link,eax,edx
push eax
mov eax, [eax]
cmp dword [eax], 'lib_'
pop eax
jnz @f
stdcall dll.Init,[eax+4]
@@:
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
ret
.fail: add esp,4
xor eax,eax
inc eax
ret
endp
proc dll.Link, exp:dword,imp:dword
push eax
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
or eax,eax
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
ret
endp
proc dll.Init, dllentry:dword
pushad
mov eax,mem.Alloc
mov ebx,mem.Free
mov ecx,mem.ReAlloc
mov edx,dll.Load
stdcall [dllentry]
popad
ret
endp
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
xor eax,eax
.next: or edx,edx
jz .end
cmp dword[edx],0
jz .end
stdcall strcmp,[edx],[sz_name]
test eax,eax
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
endp
proc strcmp, str1:dword,str2:dword
push esi edi
mov esi,[str1]
mov edi,[str2]
xor eax,eax
@@: lodsb
scasb
jne .fail
or al,al
jnz @b
jmp .ok
.fail: or eax,-1
.ok: pop edi esi
ret
endp
s_libdir:
db '/sys/lib/'
.fname rb 32

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,48 @@
;-----------------------------------------------------------------------------
proc mem.Alloc,size ;/////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[size]
;*** add ecx,4
mcall 68,12
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
pop ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.ReAlloc,mptr,size ;//////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx edx
mov ecx,[size]
or ecx,ecx
jz @f
;*** add ecx,4
@@: mov edx,[mptr]
or edx,edx
jz @f
;*** add edx,-4
@@: mcall 68,20
or eax,eax
jz @f
;*** add ecx,-4
;*** mov [eax],ecx
;*** add eax,4
@@: pop edx ecx ebx
ret
endp
;-----------------------------------------------------------------------------
proc mem.Free,mptr ;//////////////////////////////////////////////////////////
;-----------------------------------------------------------------------------
push ebx ecx
mov ecx,[mptr]
or ecx,ecx
jz @f
;*** add ecx,-4
@@: mcall 68,13
pop ecx ebx
ret
endp

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff