add smooth, update ini file
git-svn-id: svn://kolibrios.org@6513 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
af09dcd4b0
commit
259e8f219c
@ -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 ; <20> à ¬¥âàë ä®®¢®£® ®á¢¥é¥¨ï
|
||||
|
||||
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
|
||||
|
@ -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
|
||||
|
@ -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 ; <20> à ¬¥âàë ä®®¢®£® ®á¢¥é¥¨ï
|
||||
|
||||
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
|
||||
|
@ -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
Reset db '‘¡à®á áâ஥ª', 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
|
||||
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_Vertexes_Deselect 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
else
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
|
@ -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
|
||||
|
@ -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
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.6 KiB |
Loading…
Reference in New Issue
Block a user