diff --git a/programs/media/voxel_editor/trunk/toolbar.png b/programs/media/voxel_editor/trunk/toolbar.png index df575e0654..68bf4e7363 100644 Binary files a/programs/media/voxel_editor/trunk/toolbar.png and b/programs/media/voxel_editor/trunk/toolbar.png differ diff --git a/programs/media/voxel_editor/trunk/vox_draw.inc b/programs/media/voxel_editor/trunk/vox_draw.inc index ea4a0ffaf4..cef0fe79b1 100644 --- a/programs/media/voxel_editor/trunk/vox_draw.inc +++ b/programs/media/voxel_editor/trunk/vox_draw.inc @@ -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 diff --git a/programs/media/voxel_editor/trunk/vox_rotate.inc b/programs/media/voxel_editor/trunk/vox_rotate.inc new file mode 100644 index 0000000000..170a4ea8f7 --- /dev/null +++ b/programs/media/voxel_editor/trunk/vox_rotate.inc @@ -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 diff --git a/programs/media/voxel_editor/trunk/voxel_editor.asm b/programs/media/voxel_editor/trunk/voxel_editor.asm index 2fcfe982d2..a343e0718d 100644 --- a/programs/media/voxel_editor/trunk/voxel_editor.asm +++ b/programs/media/voxel_editor/trunk/voxel_editor.asm @@ -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: diff --git a/programs/media/voxel_editor/utilites/toolbar.png b/programs/media/voxel_editor/utilites/toolbar.png index c2c9f8b479..df2bcae80f 100644 Binary files a/programs/media/voxel_editor/utilites/toolbar.png and b/programs/media/voxel_editor/utilites/toolbar.png differ diff --git a/programs/media/voxel_editor/utilites/toolbar_m.png b/programs/media/voxel_editor/utilites/toolbar_m.png index 9f5cf53eb9..380e8d85f6 100644 Binary files a/programs/media/voxel_editor/utilites/toolbar_m.png and b/programs/media/voxel_editor/utilites/toolbar_m.png differ diff --git a/programs/media/voxel_editor/utilites/vox_creator.asm b/programs/media/voxel_editor/utilites/vox_creator.asm index 5feec3fb24..620627cf12 100644 --- a/programs/media/voxel_editor/utilites/vox_creator.asm +++ b/programs/media/voxel_editor/utilites/vox_creator.asm @@ -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 ;§ ўҐаи ойЁ© Їа®ЎҐ« diff --git a/programs/media/voxel_editor/utilites/vox_mover.asm b/programs/media/voxel_editor/utilites/vox_mover.asm index 262e33e736..54ff8cc20e 100644 --- a/programs/media/voxel_editor/utilites/vox_mover.asm +++ b/programs/media/voxel_editor/utilites/vox_mover.asm @@ -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 ;Ї®¤ЇЁбм ®Є­