From 259e8f219c22da601b86a200242bb1f8688e058c Mon Sep 17 00:00:00 2001 From: IgorA Date: Mon, 5 Sep 2016 20:55:35 +0000 Subject: [PATCH] add smooth, update ini file git-svn-id: svn://kolibrios.org@6513 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/info3ds/info3ds.asm | 29 +- programs/develop/info3ds/info3ds.ini | 6 +- programs/develop/info3ds/info3ds_u.asm | 42 ++- programs/develop/info3ds/info_menu.inc | 2 +- programs/develop/info3ds/info_o3d.inc | 349 +++++++++++++++---- programs/develop/info3ds/info_wnd_coords.inc | 15 +- programs/develop/info3ds/toolbar.png | Bin 3541 -> 3658 bytes 7 files changed, 357 insertions(+), 86 deletions(-) diff --git a/programs/develop/info3ds/info3ds.asm b/programs/develop/info3ds/info3ds.asm index 13c3e91173..12d35ab5ed 100644 --- a/programs/develop/info3ds/info3ds.asm +++ b/programs/develop/info3ds/info3ds.asm @@ -3,6 +3,8 @@ use32 db 'MENUET01' ;идентиф. исполняемого файла всегда 8 байт dd 1, start, i_end, mem, stacktop, file_name, sys_path +version_edit equ 1 + include '../../macros.inc' include '../../proc32.inc' include '../../KOSfuncs.inc' @@ -14,8 +16,6 @@ include 'info_fun_float.inc' include 'info_menu.inc' include 'data.inc' -version_edit equ 1 - @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load ID_ICON_CHUNK_MAIN equ 0 ;иконка главного блока @@ -105,28 +105,32 @@ start: stdcall [ksubmenu_add], [main_menu_view], eax stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Fill, 7 stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_view], eax stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 8 stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Smooth, 9 + stdcall [ksubmenu_add], [main_menu_view], eax stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 9 + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 10 stdcall [ksubmenu_add], [main_menu_view], eax stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] stdcall [ksubmenu_add], [main_menu], eax stdcall [ksubmenu_new] mov [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Select, 10 + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Select, 11 stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Deselect, 11 + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Vertexes_Deselect, 12 stdcall [ksubmenu_add], [main_menu_vertexes], eax stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_x, 12 + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_x, 13 stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_y, 13 + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_y, 14 stdcall [ksubmenu_add], [main_menu_vertexes], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_z, 14 + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Average_z, 15 stdcall [ksubmenu_add], [main_menu_vertexes], eax stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_Vertexes, [main_menu_vertexes] stdcall [ksubmenu_add], [main_menu], eax @@ -177,6 +181,11 @@ start: jz @f or dword[def_dr_mode], 1 shl bit_light @@: + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_ds,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_smooth + @@: stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff mov [color_ox],eax stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000 @@ -1362,9 +1371,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ; lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; Параметры фонового освещения if lang eq ru -capt db 'info 3ds версия 18.02.16',0 ;подпись окна +capt db 'info 3ds версия 05.09.16',0 ;подпись окна else -capt db 'info 3ds version 18.02.16',0 ;window caption +capt db 'info 3ds version 05.09.16',0 ;window caption end if align 16 diff --git a/programs/develop/info3ds/info3ds.ini b/programs/develop/info3ds/info3ds.ini index 5f2afe1614..c6fba2470e 100644 --- a/programs/develop/info3ds/info3ds.ini +++ b/programs/develop/info3ds/info3ds.ini @@ -1,8 +1,10 @@ [Window 3d] draw_vertices=1 draw_faces=1 -draw_faces_fill=0 ;заливка граней (0-выкл., 1-вкл.) -draw_light=0 ;освещение (0-выкл., 1-вкл.) +draw_faces_fill=1 ;заливка граней (0-выкл., 1-вкл.) +draw_faces_material=1 ;разноцветные грани +draw_light=1 ;освещение +draw_smooth=0 ;сглаживание модели col_ox=255,0,0 col_oy=0,0,255 col_oz=0,255,0 diff --git a/programs/develop/info3ds/info3ds_u.asm b/programs/develop/info3ds/info3ds_u.asm index 4d95d5db81..77a3cd3e83 100644 --- a/programs/develop/info3ds/info3ds_u.asm +++ b/programs/develop/info3ds/info3ds_u.asm @@ -3,6 +3,8 @@ use32 db 'MENUET01' ;идентиф. исполняемого файла всегда 8 байт dd 1, start, i_end, mem, stacktop, file_name, sys_path +version_edit equ 0 + include '../../macros.inc' include '../../proc32.inc' include '../../KOSfuncs.inc' @@ -14,8 +16,6 @@ include 'info_fun_float.inc' include 'info_menu.inc' include 'data.inc' -version_edit equ 0 - 3d_wnd_l equ 205 ;отступ для tinygl буфера слева 3d_wnd_t equ 47 ;отступ для tinygl буфера сверху 3d_wnd_w equ 344 @@ -107,17 +107,23 @@ start: stdcall [ksubmenu_new] mov [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Vertexes, 10 + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Vertexes, 5 stdcall [ksubmenu_add], [main_menu_view], eax stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces, 6 stdcall [ksubmenu_add], [main_menu_view], eax stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Fill, 7 stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 9 + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Faces_Mat, 8 stdcall [ksubmenu_add], [main_menu_view], eax stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 stdcall [ksubmenu_add], [main_menu_view], eax - stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 10 + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Light, 9 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Smooth, 10 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_SEPARATOR, 0, 0 + stdcall [ksubmenu_add], [main_menu_view], eax + stdcall [kmenuitem_new], KMENUITEM_NORMAL, sz_main_menu_Veiw_Reset, 11 stdcall [ksubmenu_add], [main_menu_view], eax stdcall [kmenuitem_new], KMENUITEM_SUBMENU, sz_main_menu_View, [main_menu_view] stdcall [ksubmenu_add], [main_menu], eax @@ -161,11 +167,21 @@ start: jz @f or dword[def_dr_mode], 1 shl bit_faces_fill @@: + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dfm,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_faces_mat + @@: stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dl,1 or eax,eax jz @f or dword[def_dr_mode], 1 shl bit_light @@: + stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_ds,1 + or eax,eax + jz @f + or dword[def_dr_mode], 1 shl bit_smooth + @@: stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff mov [color_ox],eax stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000 @@ -443,7 +459,8 @@ pushad mcall ,((3d_wnd_l+50) shl 16)+20,,0x40000007 ;заливка граней вкл. mcall ,((3d_wnd_l+75) shl 16)+20,,0x40000008 ;грани по материалам вкл. mcall ,((3d_wnd_l+100) shl 16)+20,,0x40000009 ;свет вкл./выкл. - mcall ,((3d_wnd_l+125) shl 16)+20,,0x4000000a ;сброс + mcall ,((3d_wnd_l+125) shl 16)+20,,0x4000000a ;сглаживание + mcall ,((3d_wnd_l+150) shl 16)+20,,0x4000000b ;сброс mcall SF_PUT_IMAGE,[image_data_toolbar],(21 shl 16)+21,(5 shl 16)+24 ;new add ebx,IMAGE_TOOLBAR_ICON_SIZE @@ -457,9 +474,11 @@ pushad add ebx,IMAGE_TOOLBAR_ICON_SIZE mcall ,,,((3d_wnd_l+100) shl 16)+24 ;свет вкл./выкл. add ebx,IMAGE_TOOLBAR_ICON_SIZE - mcall ,,,((3d_wnd_l+125) shl 16)+24 ;сброс + mcall ,,,((3d_wnd_l+150) shl 16)+24 ;сброс add ebx,IMAGE_TOOLBAR_ICON_SIZE mcall ,,,((3d_wnd_l+75) shl 16)+24 ;грани по материалам вкл. + add ebx,IMAGE_TOOLBAR_ICON_SIZE + mcall ,,,((3d_wnd_l+125) shl 16)+24 ;сглаживание mov dword[w_scr_t1.all_redraw],1 stdcall [tl_draw], tree1 @@ -573,6 +592,11 @@ button: jmp still @@: cmp ah,10 + jne @f + call mnu_smooth_on_off + jmp still + @@: + cmp ah,11 jne @f call mnu_reset_settings jmp still @@ -1405,9 +1429,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ; lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; Параметры фонового освещения if lang eq ru -capt db 'info 3ds [user] версия 02.09.16',0 ;подпись окна +capt db 'info 3ds [user] версия 05.09.16',0 ;подпись окна else -capt db 'info 3ds [user] version 02.09.16',0 ;window caption +capt db 'info 3ds [user] version 05.09.16',0 ;window caption end if align 16 diff --git a/programs/develop/info3ds/info_menu.inc b/programs/develop/info3ds/info_menu.inc index a83bd9738e..6a2e7ca250 100644 --- a/programs/develop/info3ds/info_menu.inc +++ b/programs/develop/info3ds/info_menu.inc @@ -1 +1 @@ - if lang eq ru sz_main_menu_View db 'Вид', 0 sz_main_menu_Veiw_Vertexes db 'Вершины вкл.', 0 sz_main_menu_Veiw_Faces db 'Каркасные грани вкл.', 0 sz_main_menu_Veiw_Faces_Fill db 'Сплошные грани вкл.', 0 sz_main_menu_Veiw_Light db 'Свет вкл./выкл.', 0 sz_main_menu_Veiw_Reset db 'Сброс настроек', 0 sz_main_menu_Vertexes db 'Вершины', 0 sz_main_menu_Vertexes_Select db 'Выделить вершину', 0 sz_main_menu_Vertexes_Deselect db 'Отменить всё выделение', 0 sz_main_menu_Average_x db 'Среднее x',0 sz_main_menu_Average_y db 'Среднее y',0 sz_main_menu_Average_z db 'Среднее z',0 else sz_main_menu_View db 'View', 0 sz_main_menu_Veiw_Vertexes db 'Vertexes on', 0 sz_main_menu_Veiw_Faces db 'Edges on', 0 sz_main_menu_Veiw_Faces_Fill db 'Faces on', 0 sz_main_menu_Veiw_Light db 'Light on/off', 0 sz_main_menu_Veiw_Reset db 'Reset settings', 0 sz_main_menu_Vertexes db 'Vertexes', 0 sz_main_menu_Vertexes_Select db 'Select vertex', 0 sz_main_menu_Vertexes_Deselect db 'Deselect all', 0 sz_main_menu_Average_x db 'Average x',0 sz_main_menu_Average_y db 'Average y',0 sz_main_menu_Average_z db 'Average z',0 end if main_menu dd 0 main_menu_file dd 0 main_menu_view dd 0 main_menu_vertexes dd 0 KMENUITEM_NORMAL equ 0 KMENUITEM_SUBMENU equ 1 KMENUITEM_SEPARATOR equ 2 \ No newline at end of file + if lang eq ru sz_main_menu_View db 'Вид', 0 sz_main_menu_Veiw_Vertexes db 'Вершины вкл.', 0 sz_main_menu_Veiw_Faces db 'Каркасные грани вкл.', 0 sz_main_menu_Veiw_Faces_Fill db 'Сплошные грани вкл.', 0 sz_main_menu_Veiw_Light db 'Свет вкл./выкл.', 0 sz_main_menu_Veiw_Smooth db 'Сглаживание вкл./выкл.', 0 sz_main_menu_Veiw_Reset db 'Сброс настроек', 0 if version_edit eq 0 sz_main_menu_Veiw_Faces_Mat db 'Разноцветные грани вкл.', 0 else sz_main_menu_Vertexes db 'Вершины', 0 sz_main_menu_Vertexes_Select db 'Выделить вершину', 0 sz_main_menu_Vertexes_Deselect db 'Отменить всё выделение', 0 sz_main_menu_Average_x db 'Среднее x',0 sz_main_menu_Average_y db 'Среднее y',0 sz_main_menu_Average_z db 'Среднее z',0 end if else sz_main_menu_View db 'View', 0 sz_main_menu_Veiw_Vertexes db 'Vertexes on', 0 sz_main_menu_Veiw_Faces db 'Edges on', 0 sz_main_menu_Veiw_Faces_Fill db 'Faces on', 0 sz_main_menu_Veiw_Light db 'Light on/off', 0 sz_main_menu_Veiw_Smooth db 'Smooth on/off', 0 sz_main_menu_Veiw_Reset db 'Reset settings', 0 if version_edit eq 0 sz_main_menu_Veiw_Faces_Mat db 'Diferent color faces on', 0 else sz_main_menu_Vertexes db 'Vertexes', 0 sz_main_menu_Vertexes_Select db 'Select vertex', 0 sz_main_menu_Vertexes_Deselect db 'Deselect all', 0 sz_main_menu_Average_x db 'Average x',0 sz_main_menu_Average_y db 'Average y',0 sz_main_menu_Average_z db 'Average z',0 end if end if main_menu dd 0 main_menu_file dd 0 main_menu_view dd 0 main_menu_vertexes dd 0 KMENUITEM_NORMAL equ 0 KMENUITEM_SUBMENU equ 1 KMENUITEM_SEPARATOR equ 2 \ No newline at end of file diff --git a/programs/develop/info3ds/info_o3d.inc b/programs/develop/info3ds/info_o3d.inc index 6c3284c61a..a803569965 100644 --- a/programs/develop/info3ds/info_o3d.inc +++ b/programs/develop/info3ds/info_o3d.inc @@ -63,17 +63,20 @@ offs_mat_col_diffuse equ 8 offs_mat_col_specular equ 12 bit_vertexes equ 0 -bit_faces equ 1 -bit_faces_fill equ 2 +bit_faces equ 1 ;грани рисуются контурами +bit_faces_fill equ 2 ;грани с заливкой bit_light equ 3 -bit_faces_mat equ 4 +bit_faces_mat equ 4 ;грани с цветом материала +bit_smooth equ 5 ;грани со сглаживанием ini_name db 'info3ds.ini',0 ini_sec_w3d db 'Window 3d',0 key_dv db 'draw_vertices',0 key_df db 'draw_faces',0 key_dff db 'draw_faces_fill',0 +key_dfm db 'draw_faces_material',0 key_dl db 'draw_light',0 +key_ds db 'draw_smooth',0 key_ox db 'col_ox',0 key_oy db 'col_oy',0 key_oz db 'col_oz',0 @@ -346,6 +349,7 @@ endp ;description: ; вычисление нормалей для граней по 3-м вершинам +; а также нормалей для сглаживания к вершинам align 4 proc obj_set_normals, o_data:dword locals @@ -448,16 +452,153 @@ align 4 fmul dword[esi+24] fsubp fstp dword[eax+8] ;set normal.c - + + stdcall V3_Norm,eax + add edx,8 ;размер треугольника = (3 вершины (по 2б) + свойства (2б)) add eax,12 dec ebx jnz @b + + ;нормали к вершинам + mov ebx,[o_data] + mov ecx,[ebx+offs_obj_poi_count] + mov [ebx+offs_obj_normals_poi_count],ecx + cmp ecx,0 + je .end + imul ecx,12 + stdcall mem.Alloc,ecx + mov [ebx+offs_obj_normals_poi_data],eax + + mov edi,eax + mov eax,0.0 + shr ecx,2 + rep stosd ;очистка 0-ми float + + mov edx,[ebx+offs_obj_tri_count] + mov edi,[ebx+offs_obj_tri_data] + mov eax,[ebx+offs_obj_normals_tri_data] + mov ecx,[ebx+offs_obj_poi_data] + mov ebx,[ebx+offs_obj_normals_poi_data] +align 4 + .cycle_0: ;по граням + movzx esi,word[edi] ;1-я вершина + imul esi,12 + add esi,ecx + push esi + movzx esi,word[edi+2] ;2-я вершина + imul esi,12 + add esi,ecx + push esi + movzx esi,word[edi+4] ;3-я вершина + imul esi,12 + add esi,ecx + push esi + + movzx esi,word[edi] ;1-я вершина + imul esi,12 + add esi,ebx + push esi + movzx esi,word[edi+2] ;2-я вершина + imul esi,12 + add esi,ebx + push esi + movzx esi,word[edi+4] ;3-я вершина + imul esi,12 + add esi,ebx + push esi + + stdcall poi_normal_add,eax + + add edi,8 + add eax,12 + dec edx + jnz .cycle_0 + .cycle_0_end: .end: popad ret endp +;input: +; norm_tr - указатель на нормаль к грани +; n1, n2, n3 - указатели на нормали вершин +; c1, c2, c3 - указатели на координаты вершин +align 4 +proc poi_normal_add uses eax ebx,\ + norm_tr:dword, n1:dword, n2:dword, n3:dword, c1:dword, c2:dword, c3:dword + + mov ebx,[norm_tr] + + mov eax,[n1] + fld dword[eax] + fadd dword[ebx] + fstp dword[eax] + fld dword[eax+4] + fadd dword[ebx+4] + fstp dword[eax+4] + fld dword[eax+8] + fadd dword[ebx+8] + fstp dword[eax+8] + + mov eax,[n2] + fld dword[eax] + fadd dword[ebx] + fstp dword[eax] + fld dword[eax+4] + fadd dword[ebx+4] + fstp dword[eax+4] + fld dword[eax+8] + fadd dword[ebx+8] + fstp dword[eax+8] + + mov eax,[n3] + fld dword[eax] + fadd dword[ebx] + fstp dword[eax] + fld dword[eax+4] + fadd dword[ebx+4] + fstp dword[eax+4] + fld dword[eax+8] + fadd dword[ebx+8] + fstp dword[eax+8] + + ret +endp + +;description: +; normalize vector +align 4 +proc V3_Norm uses eax ebx, a:dword + mov ebx,[a] + fld dword[ebx] + fmul st0,st0 + fld dword[ebx+4] + fmul st0,st0 + faddp + fld dword[ebx+8] + fmul st0,st0 + faddp + fsqrt ;st0 = sqrt(a.X^2 +a.Y^2 +a.Z^2) + ftst + fstsw ax + sahf + je .r1 ;if (sqrt(...)==0) return 1 + fld dword[ebx] ;offs_X = 0 + fdiv st0,st1 + fstp dword[ebx] ;a.X/=sqrt(...) + fld dword[ebx+4] + fdiv st0,st1 + fstp dword[ebx+4] ;a.Y/=sqrt(...) + fld dword[ebx+8] + fdiv st0,st1 + fstp dword[ebx+8] ;a.Z/=sqrt(...) + .r1: + ffree st0 + fincstp + ret +endp + ;настройка структуры 3d объекта align 4 proc obj_init, o_data:dword @@ -678,14 +819,6 @@ endp align 4 proc draw_3d uses eax ebx ecx edi, o_data:dword mov edi,[o_data] -if 0 ;debug - stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT - mov eax,[edi+offs_obj_poi_data] - stdcall convert_int_to_str, txt_select_vert.count,16 - stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_select_vert,5,3,[color_select] - stdcall [kosglSwapBuffers] - jmp .end_f -end if cmp dword[edi+offs_obj_poi_count],2 jl .end_f stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины @@ -712,7 +845,7 @@ if version_edit eq 0 mov eax,[edi+offs_obj_mat1_data] .b_found: cmp eax,0 - je .end_triangles + je .end_points mov ebx,eax stdcall get_mat_color, eax stdcall draw_3d_faces_color, edi,ebx,eax @@ -721,6 +854,93 @@ if version_edit eq 0 @@: end if + ;рисование граней без цветов материалов + bt dword[draw_mode],bit_faces + jnc .end_triangles + cmp dword[edi+offs_obj_tri_count],0 + je .end_triangles + cmp dword[edi+offs_obj_poi_count],0 + je .end_triangles + bt dword[draw_mode],bit_faces_fill + jc @f + push GL_LINE + jmp .end_0 + @@: + push GL_FILL + .end_0: + stdcall [glPolygonMode], GL_FRONT_AND_BACK ;mode - уже в стеке + stdcall [glColor3ub],[color_face+2],[color_face+1],[color_face] + + bt dword[draw_mode],bit_smooth + jnc .triangles_flat + bt dword[draw_mode],bit_light + jnc .triangles_flat + ;triangles smooth + stdcall [glBegin],GL_TRIANGLES + mov eax,[edi+offs_obj_tri_data] + mov ecx,[edi+offs_obj_tri_count] + mov edx,[edi+offs_obj_normals_tri_data] +align 4 + @@: + movzx ebx,word[eax] ;1-я вершина + imul ebx,12 + add ebx,[edi+offs_obj_normals_poi_data] + stdcall [glNormal3fv], ebx + sub ebx,[edi+offs_obj_normals_poi_data] + add ebx,[edi+offs_obj_poi_data] + stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8] + movzx ebx,word[eax+2] ;2-я вершина + imul ebx,12 + add ebx,[edi+offs_obj_normals_poi_data] + stdcall [glNormal3fv], ebx + sub ebx,[edi+offs_obj_normals_poi_data] + add ebx,[edi+offs_obj_poi_data] + stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8] + movzx ebx,word[eax+4] ;3-я вершина + imul ebx,12 + add ebx,[edi+offs_obj_normals_poi_data] + stdcall [glNormal3fv], ebx + sub ebx,[edi+offs_obj_normals_poi_data] + add ebx,[edi+offs_obj_poi_data] + stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8] + add eax,8 ;размер треугольника = (3 вершины (по 2б) + свойства (2б)) + dec ecx + jnz @b + stdcall [glEnd] + jmp .end_points + + .triangles_flat: + stdcall [glBegin],GL_TRIANGLES + mov eax,[edi+offs_obj_tri_data] + mov ecx,[edi+offs_obj_tri_count] + mov edx,[edi+offs_obj_normals_tri_data] +align 4 + @@: + ; + bt dword[draw_mode],bit_light + jnc .norm1 + stdcall [glNormal3fv], edx + add edx,12 + .norm1: + movzx ebx,word[eax] ;1-я вершина + imul ebx,12 + add ebx,[edi+offs_obj_poi_data] + stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8] + movzx ebx,word[eax+2] ;2-я вершина + imul ebx,12 + add ebx,[edi+offs_obj_poi_data] + stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8] + movzx ebx,word[eax+4] ;3-я вершина + imul ebx,12 + add ebx,[edi+offs_obj_poi_data] + stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8] + add eax,8 ;размер треугольника = (3 вершины (по 2б) + свойства (2б)) + dec ecx + jnz @b + stdcall [glEnd] + jmp .end_points + .end_triangles: + ;рисование точек bt dword[draw_mode],bit_vertexes jnc .end_points @@ -728,7 +948,14 @@ end if stdcall [glBegin],GL_POINTS mov eax,[edi+offs_obj_poi_data] mov ebx,[edi+offs_obj_poi_count] + mov edx,[edi+offs_obj_normals_poi_data] +align 4 @@: + bt dword[draw_mode],bit_light + jnc .norm0 + stdcall [glNormal3fv], edx + add edx,12 + .norm0: stdcall [glVertex3f], [eax],[eax+4],[eax+8] add eax,12 dec ebx @@ -769,6 +996,7 @@ if version_edit eq 1 mov ecx,dword[obj_poi_sel_c] stdcall [glColor3ub],[color_select+2],[color_select+1],[color_select] stdcall dword[tl_node_poi_get_info], tree3,0 +align 4 @@: cmp eax,0 je .end_select @@ -789,52 +1017,6 @@ if version_edit eq 1 .end_select: end if - ;рисование граней - bt dword[draw_mode],bit_faces - jnc .end_triangles - cmp dword[edi+offs_obj_tri_count],0 - je .end_triangles - cmp dword[edi+offs_obj_poi_count],0 - je .end_triangles - bt dword[draw_mode],bit_faces_fill - jc @f - push GL_LINE - jmp .end_0 - @@: - push GL_FILL - .end_0: - stdcall [glPolygonMode], GL_FRONT_AND_BACK ;mode - уже в стеке - stdcall [glColor3ub],[color_face+2],[color_face+1],[color_face] - stdcall [glBegin],GL_TRIANGLES - mov eax,[edi+offs_obj_tri_data] - mov ecx,[edi+offs_obj_tri_count] - mov edx,[edi+offs_obj_normals_tri_data] - @@: - ; - bt dword[draw_mode],bit_light - jnc .norm - stdcall [glNormal3fv], edx - add edx,12 - .norm: - ; - movzx ebx,word[eax] ;1-я вершина - imul ebx,12 - add ebx,[edi+offs_obj_poi_data] - stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8] - movzx ebx,word[eax+2] ;2-я вершина - imul ebx,12 - add ebx,[edi+offs_obj_poi_data] - stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8] - movzx ebx,word[eax+4] ;3-я вершина - imul ebx,12 - add ebx,[edi+offs_obj_poi_data] - stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8] - add eax,8 ;размер треугольника = (3 вершины (по 2б) + свойства (2б)) - dec ecx - jnz @b - stdcall [glEnd] - .end_triangles: - stdcall [glPopMatrix] if version_edit eq 1 cmp dword[obj_poi_sel_c],0 @@ -896,6 +1078,12 @@ mnu_light_on_off: call update_obj ret +align 4 +mnu_smooth_on_off: + xor dword[draw_mode], 1 shl bit_smooth + call update_obj + ret + align 4 mnu_reset_settings: mov dword[angle_x],0.0 @@ -1013,6 +1201,49 @@ pushad jne @b movzx ecx,word[esi] ;ecx - число граней с данным материалом mov edx,[edi+offs_obj_poi_data] + + bt dword[draw_mode],bit_smooth + jnc @f + bt dword[draw_mode],bit_light + jnc @f +align 4 + .cycle_0: + add esi,2 + ;word[esi] - номер треугольника + movzx ebx,word[esi] + + shl ebx,3 + add ebx,[edi+offs_obj_tri_data] + + movzx eax,word[ebx] ;1-я вершина + imul eax,12 ;float(x,y,z) + add eax,[edi+offs_obj_normals_poi_data] + stdcall [glNormal3fv], eax + sub eax,[edi+offs_obj_normals_poi_data] + add eax,edx + stdcall [glVertex3f], [eax],[eax+4],[eax+8] + + movzx eax,word[ebx+2] ;2-я вершина + imul eax,12 ;float(x,y,z) + add eax,[edi+offs_obj_normals_poi_data] + stdcall [glNormal3fv], eax + sub eax,[edi+offs_obj_normals_poi_data] + add eax,edx + stdcall [glVertex3f], [eax],[eax+4],[eax+8] + + movzx eax,word[ebx+4] ;3-я вершина + imul eax,12 ;float(x,y,z) + add eax,[edi+offs_obj_normals_poi_data] + stdcall [glNormal3fv], eax + sub eax,[edi+offs_obj_normals_poi_data] + add eax,edx + stdcall [glVertex3f], [eax],[eax+4],[eax+8] + + dec ecx + jnz .cycle_0 + stdcall [glEnd] + jmp .end_f + align 4 @@: add esi,2 diff --git a/programs/develop/info3ds/info_wnd_coords.inc b/programs/develop/info3ds/info_wnd_coords.inc index d553efd271..34c7a5c4e0 100644 --- a/programs/develop/info3ds/info_wnd_coords.inc +++ b/programs/develop/info3ds/info_wnd_coords.inc @@ -482,30 +482,35 @@ prop_button: @@: cmp ah,9 jne @f - call mnu_reset_settings + call mnu_smooth_on_off jmp prop_still.end @@: cmp ah,10 jne @f - call mnu_vertexes_select + call mnu_reset_settings jmp prop_still.end @@: cmp ah,11 jne @f - call mnu_vertexes_deselect + call mnu_vertexes_select jmp prop_still.end @@: cmp ah,12 jne @f - call mnu_reset_average_x + call mnu_vertexes_deselect jmp prop_still.end @@: cmp ah,13 jne @f - call mnu_reset_average_y + call mnu_reset_average_x jmp prop_still.end @@: cmp ah,14 + jne @f + call mnu_reset_average_y + jmp prop_still.end + @@: + cmp ah,15 jne @f call mnu_reset_average_z jmp prop_still.end diff --git a/programs/develop/info3ds/toolbar.png b/programs/develop/info3ds/toolbar.png index 73dca94bb084ffdff666e84101ccfbbf7c7a8ee5..9fffdce3dd0ad56baabce647fad5869216e72800 100644 GIT binary patch delta 3584 zcmZXX`9GA4-)?1`}zC{=k+@0ea?BO(4&|kE24qevt!4O)U=N% zhK_fDh6;5`0h+iwn{3^sCAIA0*v1tQxwi%9>%8{r`i||?DDiS+Sg&&v0gK@VQLhx zcvH3z%@IVOe3l5kEO>9&d9y^)qA$xd-*9m|wj?SjVybW9=9Tte(B_Z33aEE3nVFfD z)~bvocX#*al4%ZOXr=8Gd?kr=>_m?%Z0kMWOj0xZ-2&A2y22&V%fhBVr#(gAvYP$O znwy)oJpu^aADq$Q%F4>S_@nC+qa28xj7*@O&D2j#O^qunQxWgQ`V&D;zjaRr#Y1#i zq;DtBYBT8rdl{0d1)JjGXt3}*ldLNAyTp1j#_&sKN4zd@=FZads7k?I50FzPiF%i6 z9OKGU1f(x4haG5O>fG3BRZ1aAyC<5fvawb5CK`c23i5M>b|)GR?0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