'voxel_editor': fix and update rotation functions

git-svn-id: svn://kolibrios.org@3969 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2013-10-03 18:47:46 +00:00
parent 1f2854e909
commit 3991fa5a52
8 changed files with 249 additions and 100 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -86,56 +86,6 @@ proc get_mouse_ev_scale uses ebx ecx edx, h_br:dword, coord_x:dword, coord_y:dwo
ret
endp
;
;x0y0 - x1y0
;x1y0 - x1y1
;x0y1 - x0y0
;x1y1 - x0y1
align 4
proc vox_obj_rot_z uses eax ebx ecx, v_obj:dword
mov ebx,[v_obj]
add ebx,vox_offs_tree_table
mov ecx,2
cld
@@:
mov eax,dword[ebx]
mov byte[ebx+1],al
mov byte[ebx+3],ah
shr eax,16
mov byte[ebx],al
mov byte[ebx+2],ah
add ebx,4
loop @b
ret
endp
;
;y0z0 - y0z1
;y0z1 - y1z1
;y1z1 - y1z0
;y1z0 - y0z0
align 4
proc vox_obj_rot_x uses eax ebx ecx, v_obj:dword
mov ebx,[v_obj]
add ebx,vox_offs_tree_table
mov eax,dword[ebx]
mov ecx,dword[ebx+4]
mov byte[ebx+4],al
mov byte[ebx+5],ah
shr eax,16
mov byte[ebx+0],al
mov byte[ebx+1],ah
mov byte[ebx+6],cl
mov byte[ebx+7],ch
shr ecx,16
mov byte[ebx+2],cl
mov byte[ebx+3],ch
ret
endp
;
;output:
; eax - ç¨á«® 㧫®¢ ¢ ®¡ê¥ªâ¥ v_obj

View File

@ -0,0 +1,199 @@
;
; Ôóíêöèè äëÿ èçìåíåíèÿ âîêñåëüíîé òàáëèöû.
; Â âîêñåëüíîé òàáëèöå ñîäåðæàòñÿ 8 öèôð,
; êîòîðûå çàäàþò íàïðàâëåíèå äëÿ ðàñïîëîæåíèÿ
; äî÷åðíèõ âîêñåëåé. Èçìåíÿÿ öèôðû â ýòîé òàáëèöå
; ìîæíî ïîëó÷èòü ïîâîðîòû è çåðêàëüíûå îòîáðàæåíèÿ
; âîêñåëüíîãî èçîáðàæåíèÿ.
;
; Ñõåìà íóìåðàöèè óãëîâ â òàáëèöå:
; 4
; 5 6
; | 7 |
; | 0 |
; 1 2
; 3
; ãäå:
; 0-1 îñü x
; 0-2 îñü y
; 0-4 îñü z
; ïîâîðîò âîêðóã îñè z
align 4
proc vox_obj_rot_z uses eax ebx ecx, v_obj:dword
mov ebx,[v_obj]
add ebx,vox_offs_tree_table
;(1)
call vox_tbl_copy
;(2)
;0 -> 1 4 -> 5
;^ | ^ |
;2 <- 3 6 <- 7
mov edx,dword[eax]
mov byte[eax+1],dl ;0->1
mov byte[eax+3],dh ;1->3
shr edx,16
mov byte[eax],dl ;2->0
mov byte[eax+2],dh ;3->2
mov edx,dword[eax+4]
mov byte[eax+5],dl ;4->5
mov byte[eax+7],dh ;5->7
shr edx,16
mov byte[eax+4],dl ;6->4
mov byte[eax+6],dh ;7->6
;(3)
call vox_tbl_paste
ret
endp
; ïîâîðîò âîêðóã îñè y
align 4
proc vox_obj_rot_y uses eax ebx ecx, v_obj:dword
mov ebx,[v_obj]
add ebx,vox_offs_tree_table
;(1)
call vox_tbl_copy
;(2)
;0 -> 4 1 -> 5
;^ | ^ |
;2 <- 6 3 <- 7
mov edx,dword[eax]
mov ecx,dword[eax+4]
mov byte[eax+4],dl ;0->4
mov byte[eax+5],dh ;1->5
shr edx,16
mov byte[eax+0],dl ;2->0
mov byte[eax+1],dh ;3->1
mov byte[eax+6],cl ;4->6
mov byte[eax+7],ch ;5->7
shr ecx,16
mov byte[eax+2],cl ;6->2
mov byte[eax+3],ch ;7->3
;(3)
call vox_tbl_paste
ret
endp
; ïîâîðîò âîêðóã îñè x
align 4
proc vox_obj_rot_x uses eax ebx ecx, v_obj:dword
mov ebx,[v_obj]
add ebx,vox_offs_tree_table
;(1)
call vox_tbl_copy
;(2)
;0 -> 4 2 -> 6
;^ | ^ |
;1 <- 5 3 <- 7
mov edx,dword[eax]
mov ecx,dword[eax+4]
mov byte[eax+4],dl ;0->4
mov byte[eax+0],dh ;1->0
shr edx,16
mov byte[eax+6],dl ;2->6
mov byte[eax+2],dh ;3->2
mov byte[eax+5],cl ;4->5
mov byte[eax+1],ch ;5->1
shr ecx,16
mov byte[eax+7],cl ;6->7
mov byte[eax+3],ch ;7->3
;(3)
call vox_tbl_paste
ret
endp
;input:
; ebx = vox_offs_tree_table
align 4
vox_tbl_copy:
;(1)
mov eax,txt_buf
movzx ecx,byte[ebx]
add ecx,eax
mov byte[ecx],0
movzx ecx,byte[ebx+1]
add ecx,eax
mov byte[ecx],1
movzx ecx,byte[ebx+2]
add ecx,eax
mov byte[ecx],2
movzx ecx,byte[ebx+3]
add ecx,eax
mov byte[ecx],3
movzx ecx,byte[ebx+4]
add ecx,eax
mov byte[ecx],4
movzx ecx,byte[ebx+5]
add ecx,eax
mov byte[ecx],5
movzx ecx,byte[ebx+6]
add ecx,eax
mov byte[ecx],6
movzx ecx,byte[ebx+7]
add ecx,eax
mov byte[ecx],7
ret
;input:
; ebx = vox_offs_tree_table
align 4
vox_tbl_paste:
movzx ecx,byte[eax]
add ecx,ebx
mov byte[ecx],0
movzx ecx,byte[eax+1]
add ecx,ebx
mov byte[ecx],1
movzx ecx,byte[eax+2]
add ecx,ebx
mov byte[ecx],2
movzx ecx,byte[eax+3]
add ecx,ebx
mov byte[ecx],3
movzx ecx,byte[eax+4]
add ecx,ebx
mov byte[ecx],4
movzx ecx,byte[eax+5]
add ecx,ebx
mov byte[ecx],5
movzx ecx,byte[eax+6]
add ecx,ebx
mov byte[ecx],6
movzx ecx,byte[eax+7]
add ecx,ebx
mov byte[ecx],7
ret

View File

@ -14,9 +14,10 @@ include '../../../../programs/proc32.inc'
include '../../../../programs/develop/libraries/box_lib/load_lib.mac'
include '../../../dll.inc'
include 'vox_draw.inc'
include 'vox_rotate.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db 'Voxel editor 16.11.12',0 ;¯®¤¯¨áì ®ª­ 
caption db 'Voxel editor 03.10.13',0 ;¯®¤¯¨áì ®ª­ 
struct FileInfoBlock
Function dd ?
@ -33,7 +34,7 @@ image_data dd 0 ;㪠
fn_toolbar db 'toolbar.png',0
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*23
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*24
image_data_toolbar dd 0
cursors_count equ 4
IMAGE_CURSORS_SIZE equ 4096*cursors_count ;à §¬¥à ª à⨭ª¨ á ªãàá®à ¬¨
@ -512,6 +513,9 @@ pushad
add ebx,25 shl 16
mov edx,25
int 0x40
add ebx,25 shl 16
mov edx,26
int 0x40
; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
mov eax,7
@ -537,10 +541,13 @@ pushad
add edx,(25 shl 16) ;camera 3g 2g
int 0x40
add ebx,IMAGE_TOOLBAR_ICON_SIZE
add edx,(25 shl 16) ;¯®¢®à®â 1
add edx,(25 shl 16) ;¯®¢®à®â z
int 0x40
add ebx,IMAGE_TOOLBAR_ICON_SIZE
add edx,(25 shl 16) ;¯®¢®à®â 2
add edx,(25 shl 16) ;¯®¢®à®â x
int 0x40
add ebx,IMAGE_TOOLBAR_ICON_SIZE
add edx,(25 shl 16) ;¯®¢®à®â y
int 0x40
add ebx,IMAGE_TOOLBAR_ICON_SIZE
add edx,(25 shl 16) ;ᤢ¨£ ¯«®áª®á⨠+
@ -717,70 +724,74 @@ button:
@@:
cmp ah,9
jne @f
call but_3
call but_r_z
@@:
cmp ah,10
jne @f
call but_4
call but_r_x
@@:
cmp ah,11
jne @f
call but_plane_inc
call but_r_y
@@:
cmp ah,12
jne @f
call but_plane_dec
call but_plane_inc
@@:
cmp ah,13
jne @f
call but_mode_pen
call but_plane_dec
@@:
cmp ah,14
jne @f
call but_mode_brush
call but_mode_pen
@@:
cmp ah,15
jne @f
call but_mode_clear
call but_mode_brush
@@:
cmp ah,16
jne @f
call but_mode_clear
@@:
cmp ah,17
jne @f
stdcall set_pen_mode,PEN_MODE_SELECT_COLOR,3,((9 shl 8)+9) shl 16
call draw_palete
@@:
cmp ah,17
cmp ah,18
jne @f
call but_light
@@:
cmp ah,18
cmp ah,19
jne @f
call but_rend_2_2
@@:
cmp ah,19
cmp ah,20
jne @f
call but_brush_copy
@@:
cmp ah,20
cmp ah,21
jne @f
call but_brush_draw
@@:
cmp ah,21
cmp ah,22
jne @f
call but_brush_clear
@@:
cmp ah,22
cmp ah,23
jne @f
call but_bru_w_m
@@:
cmp ah,23
cmp ah,24
jne @f
call but_bru_w_p
@@:
cmp ah,24
cmp ah,25
jne @f
call but_bru_h_m
@@:
cmp ah,25
cmp ah,26
jne @f
call but_bru_h_p
@@:
@ -976,17 +987,23 @@ but_zoom_m:
ret
align 4
but_3:
but_r_z:
stdcall vox_obj_rot_z, [open_file_vox]
call draw_objects
ret
align 4
but_4:
but_r_x:
stdcall vox_obj_rot_x, [open_file_vox]
call draw_objects
ret
align 4
but_r_y:
stdcall vox_obj_rot_y, [open_file_vox]
call draw_objects
ret
;ᤢ¨£ ¥¬ ¯«®áª®áâì á१ 
align 4
but_plane_inc:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -12,11 +12,15 @@ use32
include '../../../../programs/macros.inc'
include '../../../../programs/proc32.inc'
include '../../../../programs/develop/libraries/box_lib/load_lib.mac'
include '../trunk/mem.inc'
include '../trunk/dll.inc'
include '../../../../programs/dll.inc'
vox_offs_tree_table equ 4
vox_offs_data equ 12
txt_buf rb 8
include '../trunk/vox_rotate.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db 'Voxel creator 8.08.12',0 ;¯®¤¯¨áì ®ª­ 
caption db 'Voxel creator 03.10.13',0 ;¯®¤¯¨áì ®ª­ 
struct FileInfoBlock
Function dd ?
@ -386,29 +390,6 @@ need_node:
.end_f:
ret
;
;x0y0 - x1y0
;x1y0 - x1y1
;x0y1 - x0y0
;x1y1 - x0y1
align 4
proc vox_obj_rot_z uses eax ebx ecx, v_obj:dword
mov ebx,[v_obj]
add ebx,vox_offs_tree_table
mov ecx,2
cld
@@:
mov eax,dword[ebx]
mov byte[ebx+1],al
mov byte[ebx+3],ah
shr eax,16
mov byte[ebx],al
mov byte[ebx+2],ah
add ebx,4
loop @b
ret
endp
align 4
draw_window:
pushad
@ -524,6 +505,7 @@ draw_pok:
;®¡­®¢«¥­¨¥ ¯®¤¯¨á¨ à §¬¥à  ä ©« 
mov edi,txt_f_size.size
mov dword[edi],0
mov dword[edi+4],0
mov eax,dword[vox_obj_size]
mov ebx,txt_pref
.cycle:
@ -533,6 +515,7 @@ draw_pok:
add ebx,4
jmp .cycle
@@:
call convert_int_to_str
stdcall str_cat, edi,ebx
stdcall str_cat, edi,txt_space ;§ ¢¥àè î騩 ¯à®¡¥«

View File

@ -12,9 +12,9 @@ use32
include '../../../../programs/macros.inc'
include '../../../../programs/proc32.inc'
include '../../../../programs/develop/libraries/box_lib/load_lib.mac'
include '../trunk/mem.inc'
include '../trunk/dll.inc'
include '../../../../programs/dll.inc'
include '../trunk/vox_draw.inc'
include '../trunk/vox_rotate.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
caption db 'Voxel mover 13.09.12',0 ;¯®¤¯¨áì ®ª­