diff --git a/programs/develop/info3ds/build_en.bat b/programs/develop/info3ds/build_en.bat index 2599d4430d..72a9ef5c4a 100644 --- a/programs/develop/info3ds/build_en.bat +++ b/programs/develop/info3ds/build_en.bat @@ -5,6 +5,8 @@ if not exist bin mkdir bin if not exist bin\tl_sys_16.png @copy tl_sys_16.png bin\tl_sys_16.png if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp +@fasm.exe -m 16384 ..\libraries\TinyGL\asm_fork\tinygl.asm bin\tinygl.obj +@kpack bin\tinygl.obj @fasm.exe -m 16384 info3ds.asm bin\info3ds.kex @kpack bin\info3ds.kex pause \ No newline at end of file diff --git a/programs/develop/info3ds/build_ru.bat b/programs/develop/info3ds/build_ru.bat index 917c78102e..8bbbb4a194 100644 --- a/programs/develop/info3ds/build_ru.bat +++ b/programs/develop/info3ds/build_ru.bat @@ -5,6 +5,8 @@ if not exist bin mkdir bin if not exist bin\tl_sys_16.png @copy tl_sys_16.png bin\tl_sys_16.png if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp +@fasm.exe -m 16384 ..\libraries\TinyGL\asm_fork\tinygl.asm bin\tinygl.obj +@kpack bin\tinygl.obj @fasm.exe -m 16384 info3ds.asm bin\info3ds.kex @kpack bin\info3ds.kex pause \ No newline at end of file diff --git a/programs/develop/info3ds/info3ds.asm b/programs/develop/info3ds/info3ds.asm index a6c041cd5e..e7c017794e 100644 --- a/programs/develop/info3ds/info3ds.asm +++ b/programs/develop/info3ds/info3ds.asm @@ -1,18 +1,13 @@ use32 org 0x0 db 'MENUET01' ;идентиф. исполняемого файла всегда 8 байт - dd 0x1 - dd start - dd i_end ;размер приложения - dd mem - dd stacktop - dd 0 - dd sys_path + dd 1, start, i_end, mem, stacktop, 0, sys_path include '../../macros.inc' include '../../proc32.inc' include '../../develop/libraries/box_lib/load_lib.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac' +include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc' include '../../dll.inc' include 'lang.inc' include 'info_fun_float.inc' @@ -37,6 +32,7 @@ open_file_lif dd 0 ;ука open_file_size dd 0 ;размер открытого файла ; +main_wnd_height equ 460 ;высота главного окна программы fn_toolbar db 'toolbar.png',0 IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*7 @@ -70,7 +66,7 @@ macro load_image_file path,buf,size { ; mov [run_file_70.Position], 0 mov [run_file_70.Flags], 0 mov [run_file_70.Count], dword size - m2m [run_file_70.Buffer], eax + mov [run_file_70.Buffer], eax mov byte[run_file_70+20], 0 mov [run_file_70.FileName], file_name mcall 70,run_file_70 ;загружаем файл изображения @@ -120,18 +116,15 @@ align 4 start: load_libraries l_libs_start,l_libs_end ;проверка на сколько удачно загузились библиотеки - cmp dword [lib_0+ll_struc_size-4],0 - jnz @f - cmp dword [lib_1+ll_struc_size-4],0 - jnz @f - cmp dword [lib_2+ll_struc_size-4],0 - jnz @f - cmp dword [lib_3+ll_struc_size-4],0 - jnz @f - jmp .lib - @@: + mov ebp,lib_0 + .test_lib_open: + cmp dword [ebp+ll_struc_size-4],0 + jz @f mcall -1 ;exit not correct - .lib: + @@: + add ebp,ll_struc_size + cmp ebp,l_libs_end + jl .test_lib_open mcall 48,3,sc,sizeof.system_colors mcall 40,0x27 stdcall [OpenDialog_Init],OpenDialog_data ;подготовка диалога @@ -165,8 +158,14 @@ start: mcall 26,9 mov [last_time],eax -align 4 -red_win: + stdcall [kosglMakeCurrent], 5,3,320,240,ctx1 + stdcall [glEnable], GL_DEPTH_TEST + stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов + stdcall [glClearColor], 0.0,0.0,0.0,0.0 + stdcall [glShadeModel], GL_SMOOTH + stdcall [gluNewQuadric] + mov [qObj],eax + call draw_window align 4 @@ -179,16 +178,15 @@ still: mov ebx,eax @@: sub ebx,eax - ;cmp ebx,10 ;задержка - ;ja timer_funct - ;test ebx,ebx - ;jz timer_funct mcall 23 cmp eax,0 je timer_funct cmp al,1 - jz red_win + jne @f + call draw_window + jmp still + @@: cmp al,2 jz key cmp al,3 @@ -297,17 +295,15 @@ proc buf_draw_hex_table, offs:dword, size_line:dword endp align 4 -proc draw_block_end_line, coord_y:dword - push eax ebx ecx - add ebx,20 ;20 = width 2.5 symbols - mov eax,[coord_y] - sub eax,2 - mov ecx,eax - add ecx,10 - stdcall [buf2d_line], buf_0, 0,ecx,ebx,ecx ,0xff - stdcall [buf2d_line], buf_0, ebx,ecx,ebx,eax ,0xff - stdcall [buf2d_line], buf_0, ebx,eax,5+10*24-4,eax ,0xff - pop ecx ebx eax +proc draw_block_end_line uses eax ebx ecx, coord_y:dword + add ebx,20 ;20 = width 2.5 symbols + mov eax,[coord_y] + sub eax,2 + mov ecx,eax + add ecx,10 + stdcall [buf2d_line], buf_0, 0,ecx,ebx,ecx ,0xff + stdcall [buf2d_line], buf_0, ebx,ecx,ebx,eax ,0xff + stdcall [buf2d_line], buf_0, ebx,eax,5+10*24-4,eax ,0xff ret endp @@ -316,12 +312,10 @@ draw_window: pushad mcall 12,1 xor eax,eax - mov ebx,(20 shl 16)+560 - mov ecx,(20 shl 16)+315 mov edx,[sc.work] - or edx,(3 shl 24)+0x10000000+0x20000000 + or edx,0x33000000 mov edi,capt - int 0x40 + mcall , (20 shl 16)+560, (20 shl 16)+main_wnd_height mcall 9,procinfo,-1 mov eax,dword[procinfo.box.height] @@ -445,6 +439,7 @@ button: stdcall [buf2d_delete],buf_1 ;удаляем буфер stdcall mem.Free,[image_data_toolbar] stdcall mem.Free,[open_file_lif] + stdcall [gluDeleteQuadric], [qObj] mcall -1 @@ -467,7 +462,6 @@ but_open_file: je .end_open_file ;код при удачном открытии диалога - mov eax,70 ;70-я функция работа с файлами mov [run_file_70.Function], 0 mov [run_file_70.Position], 0 mov [run_file_70.Flags], 0 @@ -475,8 +469,7 @@ but_open_file: m2m [run_file_70.Buffer], dword[open_file_lif] mov byte[run_file_70+20], 0 mov dword[run_file_70.FileName], openfile_path - mov ebx,run_file_70 - int 0x40 ;загружаем файл изображения + mcall 70,run_file_70 ;загружаем файл изображения cmp ebx,0xffffffff je .end_open_file @@ -486,6 +479,14 @@ but_open_file: mov byte[can_save],0 call init_tree stdcall [buf2d_draw], buf_0 ;обновляем буфер на экране + mov dword[angle_x],0.0 + mov dword[angle_y],0.0 + mov dword[angle_z],0.0 + cmp byte[prop_wnd_run],0 + je @f + ;чистим окно с координатами + stdcall [tl_info_clear], tree3 + @@: .end_open_file: popad @@ -1014,17 +1015,17 @@ endp align 4 OpenDialog_data: .type dd 0 ;0 - открыть, 1 - сохранить, 2 - выбрать дтректорию -.procinfo dd procinfo ;+4 -.com_area_name dd communication_area_name ;+8 -.com_area dd 0 ;+12 -.opendir_path dd plugin_path ;+16 +.procinfo dd procinfo ;+4 +.com_area_name dd communication_area_name ;+8 +.com_area dd 0 ;+12 +.opendir_path dd plugin_path ;+16 .dir_default_path dd default_dir ;+20 .start_path dd file_name ;+24 путь к диалогу открытия файлов -.draw_window dd draw_window ;+28 -.status dd 0 ;+32 -.openfile_path dd openfile_path ;+36 путь к открываемому файлу -.filename_area dd filename_area ;+40 -.filter_area dd Filter +.draw_window dd draw_window ;+28 +.status dd 0 ;+32 +.openfile_path dd openfile_path ;+36 путь к открываемому файлу +.filename_area dd filename_area ;+40 +.filter_area dd Filter .x: .x_size dw 420 ;+48 ; Window X size .x_start dw 10 ;+50 ; Window X position @@ -1050,39 +1051,66 @@ db 'TXT',0 db 0 - -head_f_i: -head_f_l db 'Системная ошибка',0 - +align 4 system_dir_0 db '/sys/lib/' lib_name_0 db 'proc_lib.obj',0 -err_message_found_lib_0 db 'Не найдена библиотека ',39,'proc_lib.obj',39,0 -err_message_import_0 db 'Ошибка при импорте библиотеки ',39,'proc_lib.obj',39,0 - system_dir_1 db '/sys/lib/' lib_name_1 db 'libimg.obj',0 -err_message_found_lib_1 db 'Не найдена библиотека ',39,'libimg.obj',39,0 -err_message_import_1 db 'Ошибка при импорте библиотеки ',39,'libimg.obj',39,0 - system_dir_2 db '/sys/lib/' lib_name_2 db 'box_lib.obj',0 -err_msg_found_lib_2 db 'Не найдена библиотека ',39,'box_lib.obj',39,0 -err_msg_import_2 db 'Ошибка при импорте библиотеки ',39,'box_lib',39,0 - system_dir_3 db '/sys/lib/' lib_name_3 db 'buf2d.obj',0 -err_msg_found_lib_3 db 'Не найдена библиотека ',39,'buf2d.obj',39,0 -err_msg_import_3 db 'Ошибка при импорте библиотеки ',39,'buf2d',39,0 +system_dir_4 db '/sys/lib/' +lib_name_4 db 'kmenu.obj',0 +system_dir_5 db '/sys/lib/' +lib_name_5 db 'tinygl.obj',0 +if lang eq ru + head_f_i: + head_f_l db 'Системная ошибка',0 + err_msg_found_lib_0 db 'Не найдена библиотека ',39,'proc_lib.obj',39,0 + err_msg_import_0 db 'Ошибка при импорте библиотеки ',39,'proc_lib.obj',39,0 + err_msg_found_lib_1 db 'Не найдена библиотека ',39,'libimg.obj',39,0 + err_msg_import_1 db 'Ошибка при импорте библиотеки ',39,'libimg.obj',39,0 + err_msg_found_lib_2 db 'Не найдена библиотека ',39,'box_lib.obj',39,0 + err_msg_import_2 db 'Ошибка при импорте библиотеки ',39,'box_lib',39,0 + err_msg_found_lib_3 db 'Не найдена библиотека ',39,'buf2d.obj',39,0 + err_msg_import_3 db 'Ошибка при импорте библиотеки ',39,'buf2d',39,0 + err_msg_found_lib_4 db 'Не найдена библиотека ',39,'kmenu.obj',39,0 + err_msg_import_4 db 'Ошибка при импорте библиотеки ',39,'kmenu',39,0 + err_msg_found_lib_5 db 'Не найдена библиотека ',39,'tinygl.obj',39,0 + err_msg_import_5 db 'Ошибка при импорте библиотеки ',39,'tinygl',39,0 +else + head_f_i: + head_f_l db 'System error',0 + err_msg_found_lib_0 db 'Sorry I cannot found library ',39,'proc_lib.obj',39,0 + err_msg_import_0 db 'Error on load import library ',39,'proc_lib.obj',39,0 + err_msg_found_lib_1 db 'Sorry I cannot found library ',39,'libimg.obj',39,0 + err_msg_import_1 db 'Error on load import library ',39,'libimg.obj',39,0 + err_msg_found_lib_2 db 'Sorry I cannot found library ',39,'box_lib.obj',39,0 + err_msg_import_2 db 'Error on load import library ',39,'box_lib.obj',39,0 + err_msg_found_lib_3 db 'Sorry I cannot found library ',39,'buf2d.obj',39,0 + err_msg_import_3 db 'Error on load import library ',39,'buf2d.obj',39,0 + err_msg_found_lib_4 db 'Sorry I cannot found library ',39,'kmenu.obj',39,0 + err_msg_import_4 db 'Error on load import library ',39,'kmenu.obj',39,0 + err_msg_found_lib_5 db 'Sorry I cannot found library ',39,'tinygl.obj',39,0 + err_msg_import_5 db 'Error on load import library ',39,'tinygl',39,0 +end if + +align 4 l_libs_start: lib_0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\ - err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i + err_msg_found_lib_0, head_f_l, proclib_import,err_msg_import_0, head_f_i lib_1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\ - err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i - lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\ - err_msg_found_lib_2,head_f_l,import_box_lib,err_msg_import_2,head_f_i - lib_3 l_libs lib_name_3, sys_path, library_path, system_dir_3,\ - err_msg_found_lib_3,head_f_l,import_buf2d,err_msg_import_3,head_f_i + err_msg_found_lib_1, head_f_l, import_libimg, err_msg_import_1, head_f_i + lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\ + err_msg_found_lib_2, head_f_l, import_box_lib,err_msg_import_2,head_f_i + lib_3 l_libs lib_name_3, sys_path, library_path, system_dir_3,\ + err_msg_found_lib_3, head_f_l, import_buf2d, err_msg_import_3,head_f_i + lib_4 l_libs lib_name_4, sys_path, library_path, system_dir_4,\ + err_msg_found_lib_4, head_f_l, import_libkmenu,err_msg_import_4,head_f_i + lib_5 l_libs lib_name_5, sys_path, library_path, system_dir_5,\ + err_msg_found_lib_5, head_f_l, import_lib_tinygl,err_msg_import_5,head_f_i l_libs_end: align 4 @@ -1265,6 +1293,43 @@ import_box_lib: sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0 sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0 +align 4 +import_libkmenu: + kmenu_init dd akmenu_init + kmainmenu_draw dd akmainmenu_draw + kmainmenu_dispatch_cursorevent dd akmainmenu_dispatch_cursorevent + ksubmenu_new dd aksubmenu_new + ksubmenu_delete dd aksubmenu_delete + ksubmenu_draw dd aksubmenu_draw + ksubmenu_add dd aksubmenu_add + kmenuitem_new dd akmenuitem_new + kmenuitem_delete dd akmenuitem_delete + kmenuitem_draw dd akmenuitem_draw +dd 0,0 + akmenu_init db 'kmenu_init',0 + akmainmenu_draw db 'kmainmenu_draw',0 + akmainmenu_dispatch_cursorevent db 'kmainmenu_dispatch_cursorevent',0 + aksubmenu_new db 'ksubmenu_new',0 + aksubmenu_delete db 'ksubmenu_delete',0 + aksubmenu_draw db 'ksubmenu_draw',0 + aksubmenu_add db 'ksubmenu_add',0 + akmenuitem_new db 'kmenuitem_new',0 + akmenuitem_delete db 'kmenuitem_delete',0 + akmenuitem_draw db 'kmenuitem_draw',0 + +align 4 +import_lib_tinygl: +macro E_LIB n +{ + n dd sz_#n +} +include '../../develop/libraries/TinyGL/asm_fork/export.inc' + dd 0,0 +macro E_LIB n +{ + sz_#n db `n,0 +} +include '../../develop/libraries/TinyGL/asm_fork/export.inc' align 4 mouse_dd dd 0x0 @@ -1276,40 +1341,56 @@ buf_0: dd 0 ;ука .l: dw 205 ;+4 left .t: dw 35 ;+6 top .w: dd 340 ;+8 w -.h: dd 250 ;+12 h +.h: dd main_wnd_height-65 ;+12 h .color: dd 0xffffd0 ;+16 color db 24 ;+20 bit in pixel align 4 buf_1: dd 0 ;указатель на буфер изображения - dw 25 ;+4 left - dw 25 ;+6 top - dd 128 ;+8 w - dd 144 ;+12 h - dd 0 ;+16 color - db 24 ;+20 bit in pixel + dw 25,25 ;+4 left,top + dd 128,144 ;+8 w,h + dd 0,24 ;+16 color,bit in pixel align 4 el_focus dd tree1 tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\ - 16,16, 0xffffff,0xb0d0ff,0xd000ff, 5,35,195-16,250, 16,list_offs_text,0, el_focus,\ + 16,16, 0xffffff,0xb0d0ff,0x400040, 5,35,195-16,250, 16,list_offs_text,0, el_focus,\ w_scr_t1,0 align 4 -w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0xeeeeee, 0xbbddff, 0, 1 +w_scr_t1 scrollbar 16,0, 3,0, 15, 100, 0,0, 0,0,0, 1 + +align 4 +ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext +;sizeof.TinyGLContext = 28 + +qObj dd 0 +angle_x dd 0.0 +angle_y dd 0.0 +angle_z dd 0.0 +delt_size dd 3.0 + +light_position dd 0.0, 0.0, 2.0, 1.0 ; Расположение источника [0][1][2] + ;[3] = (0.0 - бесконечно удаленный источник, 1.0 - источник света на определенном расстоянии) +light_dir dd 0.0,0.0,0.0 ;направление лампы + +mat_specular dd 0.3, 0.3, 0.3, 1.0 ; Цвет блика +mat_shininess dd 3.0 ; Размер блика (обратная пропорция) +white_light dd 0.8, 0.8, 0.8, 1.0 ; Цвет и интенсивность освещения, генерируемого источником +lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; Параметры фонового освещения align 16 i_end: procinfo process_information - rb 1024 + rb 2048 +align 16 thread_coords: - rb 1024 + rb 2048 stacktop: - sys_path rb 1024 - file_name: - rb 4096 - library_path rb 1024 + sys_path rb 2048 + file_name rb 4096 + library_path rb 2048 plugin_path rb 4096 openfile_path rb 4096 filename_area rb 256 diff --git a/programs/develop/info3ds/info_wnd_coords.inc b/programs/develop/info3ds/info_wnd_coords.inc index 61c64c5e17..0598183ac0 100644 --- a/programs/develop/info3ds/info_wnd_coords.inc +++ b/programs/develop/info3ds/info_wnd_coords.inc @@ -3,7 +3,8 @@ ; работы окна с координатами ; -prop_wnd_width equ 350 ;ширина окна со свойствами объекта +prop_wnd_width equ 340 ;ширина окна со свойствами объекта +prop_wnd_height equ 460 SIZE_ONE_FLOAT equ 14 MAX_OBJECT_SIZE equ (4+SIZE_ONE_FLOAT*3+1) @@ -15,6 +16,8 @@ txt_space: .end: db 0 +rad_c dd 150 ;для вычисления радиуса + obj_point: ;добавляемый объект dd 0 ;указатель .text: @@ -28,6 +31,7 @@ prop_start: pushad mcall 40,0x27 ;маска ожидаемых событий inc byte[prop_wnd_run] + mov dword[w_scr_t3.type],1 stdcall [tl_node_get_data],tree1 xor edx,edx @@ -100,12 +104,41 @@ pushad jg .new_point stdcall dword[tl_cur_beg], tree3 .no_object: + call obj_set_sizes edit_boxes_set_sys_color edit1,editboxes_end,sc ;установка системных цветов stdcall [edit_box_set_text], edit1, txt_q stdcall [edit_box_set_text], edit2, txt_q stdcall [edit_box_set_text], edit3, txt_q popad + call prop_red_win + +;не отрывать эту функцию от предыдущей +align 4 +prop_still: + pushad + mcall 10 + + cmp al,1 ;изм. положение окна + jne @f + call prop_red_win + jmp .end + @@: + cmp al,2 + jne @f + call prop_key + jmp .end + @@: + cmp al,3 + jz prop_button + cmp al,6 + jne @f + call prop_mouse + @@: +.end: + popad + jmp prop_still + align 4 prop_red_win: pushad @@ -115,37 +148,26 @@ pushad mov edi,dword[capt_p] ;children window caption mov bx,word[procinfo.box.left] add bx,word[buf_0.l] + add bx,5 ;ширина боковой рамки shl ebx,16 mov bx,prop_wnd_width mov cx,word[procinfo.box.top] add cx,word[buf_0.t] shl ecx,16 - mov cx,250 - mov edx,0xffffd0 - or edx,0x33000000 + mov cx,prop_wnd_height + mov edx,0xffffd0+0x33000000 int 0x40 - mov eax,8 - mov ebx,(5 shl 16)+20 - mov ecx,(195 shl 16)+20 - mov edx,3 mov esi,[sc.work_button] - int 0x40 + mcall 8, (5 shl 16)+20, (246 shl 16)+20, 3 + mcall , (30 shl 16)+20, (246 shl 16)+20, 4 - mov ebx,(30 shl 16)+20 - mov ecx,(195 shl 16)+20 - mov edx,4 - int 0x40 - - mov eax,7 mov ebx,[image_data_toolbar] add ebx,4*IMAGE_TOOLBAR_ICON_SIZE - mov ecx,(16 shl 16)+16 - mov edx,(7 shl 16)+197 ;load - int 0x40 + mcall 7, , (16 shl 16)+16, (7 shl 16)+247 ;load sub ebx,IMAGE_TOOLBAR_ICON_SIZE - mov edx,(32 shl 16)+197 ;save + mov edx,(32 shl 16)+247 ;save int 0x40 mov dword[w_scr_t3.all_redraw],1 @@ -154,38 +176,298 @@ pushad stdcall [edit_box_draw], edit1 stdcall [edit_box_draw], edit2 stdcall [edit_box_draw], edit3 + + call draw_3d mcall 12,2 popad + ret -;не отрывать эту функцию от предыдущей align 4 -prop_still: - pushad - mcall 10 +proc obj_set_sizes uses eax ebx esi + stdcall dword[tl_node_poi_get_info], tree3,0 + cmp eax,0 + je .end + stdcall [tl_node_poi_get_data], tree3,eax + finit + mov eax,[eax] + mov ebx,dword[eax] + mov [obj_x_min],ebx + mov [obj_x_max],ebx + mov ebx,dword[eax+4] + mov [obj_y_min],ebx + mov [obj_y_max],ebx + mov ebx,dword[eax+8] + mov [obj_z_min],ebx + mov [obj_z_max],ebx - cmp al,1 ;изм. положение окна - jz prop_red_win - cmp al,2 - jne @f - call prop_key + stdcall dword[tl_node_poi_get_info], tree3,0 +align 4 + .cycle_0: ;работа с координатой x + mov esi,eax + stdcall [tl_node_poi_get_data], tree3,esi + mov ebx,[eax] + + fld dword[ebx] + fld dword[obj_x_min] + fcomp + fstsw ax + sahf + jb @f + mov eax,[ebx] + mov [obj_x_min],eax + ffree st0 + fincstp + jmp .next_x + @@: + fld dword[obj_x_max] + fcompp + fstsw ax + sahf + ja .next_x + mov eax,[ebx] + mov [obj_x_max],eax + .next_x: + + stdcall dword[tl_node_poi_get_next_info], tree3,esi + cmp eax,0 + jne .cycle_0 + + fld1 + fld dword[obj_x_max] + fsub dword[obj_x_min] + fst dword[obj_x_centr] + fdivp ;1/size.x + fstp dword[obj_x_scale] + + fld dword[obj_x_centr] + fld1 + fld1 + faddp + fdivp ;centr.x = size.x/2 + fadd dword[obj_x_min] + fchs + fstp dword[obj_x_centr] + + stdcall dword[tl_node_poi_get_info], tree3,0 +align 4 + .cycle_1: ;работа с координатой y + mov esi,eax + stdcall [tl_node_poi_get_data], tree3,esi + mov ebx,[eax] + + fld dword[ebx+4] + fld dword[obj_y_min] + fcomp + fstsw ax + sahf + jb @f + mov eax,[ebx+4] + mov [obj_y_min],eax + ffree st0 + fincstp + jmp .next_y + @@: + fld dword[obj_y_max] + fcompp + fstsw ax + sahf + ja .next_y + mov eax,[ebx+4] + mov [obj_y_max],eax + .next_y: + + stdcall dword[tl_node_poi_get_next_info], tree3,esi + cmp eax,0 + jne .cycle_1 + + fld1 + fld dword[obj_y_max] + fsub dword[obj_y_min] + fst dword[obj_y_centr] + fdivp ;1/size.y + fstp dword[obj_y_scale] + + fld dword[obj_y_centr] + fld1 + fld1 + faddp + fdivp ;centr.y = size.y/2 + fadd dword[obj_y_min] + fchs + fstp dword[obj_y_centr] + + stdcall dword[tl_node_poi_get_info], tree3,0 +align 4 + .cycle_2: ;работа с координатой z + mov esi,eax + stdcall [tl_node_poi_get_data], tree3,esi + mov ebx,[eax] + + fld dword[ebx+8] + fld dword[obj_z_min] + fcomp + fstsw ax + sahf + jb @f + mov eax,[ebx+8] + mov [obj_z_min],eax + ffree st0 + fincstp + jmp .next_z + @@: + fld dword[obj_z_max] + fcompp + fstsw ax + sahf + ja .next_z + mov eax,[ebx+8] + mov [obj_z_max],eax + .next_z: + + stdcall dword[tl_node_poi_get_next_info], tree3,esi + cmp eax,0 + jne .cycle_2 + + fld1 + fld dword[obj_z_max] + fsub dword[obj_z_min] + fst dword[obj_z_centr] + fdivp ;1/size.z + fstp dword[obj_z_scale] + + fld dword[obj_z_centr] + fld1 + fld1 + faddp + fdivp ;centr.z = size.z/2 + fadd dword[obj_z_min] + fchs + fstp dword[obj_z_centr] + + ;находим радиус для сферы + fld dword[obj_x_max] + fsub dword[obj_x_min] + fld dword[obj_y_max] + fsub dword[obj_y_min] + faddp + fild dword[rad_c] + fdivp ;radius=(size.x+size.y)/rad_c + fstp dword[sph_radius] + .end: + ret +endp + +;рисование точек в 3d +align 4 +draw_3d: + stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины + stdcall [glPushMatrix] + stdcall [glTranslatef], 0.0,0.0,0.5 ;correct for z + stdcall [glScalef], [obj_x_scale],[obj_y_scale],[obj_z_scale] + stdcall [glScalef], 1.0,1.0,0.7 ;correct for z + stdcall [glRotatef], [angle_z],0.0,0.0,1.0 + stdcall [glRotatef], [angle_y],0.0,1.0,0.0 + stdcall [glRotatef], [angle_x],1.0,0.0,0.0 + stdcall [glTranslatef], [obj_x_centr],[obj_y_centr],[obj_z_centr] + + stdcall [glColor3f], 1.0,1.0,1.0 + stdcall [glBegin],GL_POINTS + + stdcall dword[tl_node_poi_get_info], tree3,0 @@: - cmp al,3 - jz prop_button - cmp al,6 - jne @f - call prop_mouse + cmp eax,0 + je @f + mov esi,eax + stdcall [tl_node_poi_get_data], tree3,esi + mov eax,[eax] + stdcall [glVertex3f], [eax],[eax+4],[eax+8] + stdcall dword[tl_node_poi_get_next_info], tree3,esi + jmp @b @@: - popad - jmp prop_still + stdcall [glEnd] + + stdcall [tl_node_get_data],tree3 + cmp eax,0 + je @f + ;выделение активной точки + mov eax,[eax] + + stdcall [glBegin],GL_LINES + stdcall [glColor3f], 1.0, 0.0, 0.0 + stdcall [glVertex3f], [obj_x_min],[eax+4],[eax+8] + stdcall [glVertex3f], [obj_x_max],[eax+4],[eax+8] + stdcall [glColor3f], 0.0, 0.0, 1.0 + stdcall [glVertex3f], [eax],[obj_y_min],[eax+8] + stdcall [glVertex3f], [eax],[obj_y_max],[eax+8] + stdcall [glColor3f], 0.0, 1.0, 0.0 + stdcall [glVertex3f], [eax],[eax+4],[obj_z_min] + stdcall [glVertex3f], [eax],[eax+4],[obj_z_max] + stdcall [glEnd] + + stdcall [glColor3f], 1.0, 1.0, 0.0 + stdcall [glTranslatef], [eax],[eax+4],[eax+8] + stdcall [gluSphere], [qObj], [sph_radius], 8,8 + @@: + + stdcall [glPopMatrix] + stdcall [kosglSwapBuffers] + ret align 4 prop_key: push eax mcall 2 - stdcall [edit_box_key], edit1 - stdcall [edit_box_key], edit2 - stdcall [edit_box_key], edit3 + + test word [edit1.flags],10b ;ed_focus + je @f + stdcall [edit_box_key], edit1 + jmp .end + @@: + test word [edit2.flags],10b + je @f + stdcall [edit_box_key], edit2 + jmp .end + @@: + test word [edit3.flags],10b + je @f + stdcall [edit_box_key], edit3 + jmp .end + @@: stdcall [tl_key], tree3 + + cmp ah,178 ;Up + jne @f + fld dword[angle_x] + fadd dword[delt_size] + fstp dword[angle_x] + call draw_3d + jmp .end + @@: + cmp ah,177 ;Down + jne @f + fld dword[angle_x] + fsub dword[delt_size] + fstp dword[angle_x] + call draw_3d + jmp .end + @@: + cmp ah,176 ;Left + jne @f + fld dword[angle_y] + fadd dword[delt_size] + fstp dword[angle_y] + call draw_3d + jmp .end + @@: + cmp ah,179 ;Right + jne @f + fld dword[angle_y] + fsub dword[delt_size] + fstp dword[angle_y] + call draw_3d + ;jmp .end + @@: + .end: pop eax ret @@ -205,32 +487,9 @@ prop_button: cmp ah,3 jne @f - ;загрузка координат в editbox-ы - push eax ebx - stdcall [tl_node_get_data],tree3 - cmp eax,0 - je .no_select_0 - mov ebx,[eax] - mov word[NumberSymbolsAD],8 - finit - fld dword[ebx] - fstp qword[Data_Double] - call DoubleFloat_to_String - stdcall [edit_box_set_text], edit1, Data_String - fld dword[ebx+4] - fstp qword[Data_Double] - call DoubleFloat_to_String - stdcall [edit_box_set_text], edit2, Data_String - fld dword[ebx+8] - fstp qword[Data_Double] - call DoubleFloat_to_String - stdcall [edit_box_set_text], edit3, Data_String - stdcall [edit_box_draw], edit1 - stdcall [edit_box_draw], edit2 - stdcall [edit_box_draw], edit3 - .no_select_0: - pop ebx eax - jmp prop_still + call get_point_coords + call draw_3d + jmp prop_still.end @@: cmp ah,4 jne @f @@ -244,8 +503,8 @@ prop_button: mov esi,string1 mov edi,Data_String cld - mov ecx,32 - rep movsb + mov ecx,8 + rep movsd call String_to_DoubleFloat fld qword[Data_Double] ;считываем как double fstp dword[ebx] ;сохраняем как float @@ -253,8 +512,8 @@ prop_button: mov esi,string2 mov edi,Data_String cld - mov ecx,32 - rep movsb + mov ecx,8 + rep movsd call String_to_DoubleFloat fld qword[Data_Double] ;считываем как double fstp dword[ebx+4] ;сохраняем как float @@ -262,8 +521,8 @@ prop_button: mov esi,string3 mov edi,Data_String cld - mov ecx,32 - rep movsb + mov ecx,8 + rep movsd call String_to_DoubleFloat fld qword[Data_Double] ;считываем как double fstp dword[ebx+8] ;сохраняем как float @@ -293,13 +552,14 @@ prop_button: stdcall dword[tl_draw], tree3 mov byte[can_save],1 ;для показа кнопки 'Сохранить' mov dword[offs_last_timer],0 ;для обновления блока в таймере + call draw_3d .no_select_1: pop esi edi ecx ebx eax - jmp prop_still + jmp prop_still.end @@: cmp ah,1 - jne prop_still + jne prop_still.end .exit: mov dword[tree3.data_img],0 ;чистим указатели на иконки что-бы их не удалил деструктор mov dword[tree3.data_img_sys],0 ;т. к. они еще используються в других элементах @@ -307,17 +567,60 @@ prop_button: mov byte[prop_wnd_run],0 ;обнуляем счетчик окон mcall -1 ;выход из программы +align 4 +get_point_coords: + ;загрузка координат в editbox-ы + push eax ebx + stdcall [tl_node_get_data],tree3 + cmp eax,0 + je @f + mov ebx,[eax] + mov word[NumberSymbolsAD],8 + finit + fld dword[ebx] + fstp qword[Data_Double] + call DoubleFloat_to_String + stdcall [edit_box_set_text], edit1, Data_String + fld dword[ebx+4] + fstp qword[Data_Double] + call DoubleFloat_to_String + stdcall [edit_box_set_text], edit2, Data_String + fld dword[ebx+8] + fstp qword[Data_Double] + call DoubleFloat_to_String + stdcall [edit_box_set_text], edit3, Data_String + stdcall [edit_box_draw], edit1 + stdcall [edit_box_draw], edit2 + stdcall [edit_box_draw], edit3 + @@: + pop ebx eax + ret + +align 4 +sph_radius dd 0 ;радиус сферы для выделения активной точки +obj_x_max dd 0 +obj_x_min dd 0 +obj_x_centr dd 0 +obj_x_scale dd 1.0 +obj_y_max dd 0 +obj_y_min dd 0 +obj_y_centr dd 0 +obj_y_scale dd 1.0 +obj_z_max dd 0 +obj_z_min dd 0 +obj_z_centr dd 0 +obj_z_scale dd 1.0 + capt_p dd 0 ;дерево с объектами в пользовательском файле -tree3 tree_list MAX_OBJECT_SIZE,3,\ - tl_key_no_edit+tl_list_box_mode,\ - 16,16, 0xffffff,0xb0d0ff,0xd000ff, 5,30,300,160, 16, 4,0, el_focus,\ - w_scr_t3,0 +tree3 tree_list MAX_OBJECT_SIZE,3, tl_key_no_edit+tl_list_box_mode,\ + 16,16, 0xffffff,0xb0d0ff,0x400040, 5,270,303,160, 16, 4,0, el_focus,\ + w_scr_t3,get_point_coords -edit1 edit_box 80, 70, 200, 0xffffff, 0xff, 0x80ff, 0, 0x8000, 34, string1, mouse_dd, 0 -edit2 edit_box 80, 154, 200, 0xffffff, 0xff, 0x80ff, 0, 0x8000, 34, string2, mouse_dd, 0 -edit3 edit_box 80, 238, 200, 0xffffff, 0xff, 0x80ff, 0, 0x8000, 34, string3, mouse_dd, 0 +edit1 edit_box 80, 76, 249, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string1, mouse_dd, 0 +edit2 edit_box 80, 160, 249, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string2, mouse_dd, 0 +edit3 edit_box 80, 244, 249, 0xd0ffd0, 0xff, 0x80ff, 0, 0x8000, 34, string3, mouse_dd, 0 editboxes_end: string1 rb 34 @@ -325,19 +628,4 @@ string2 rb 34 string3 rb 34 align 4 -w_scr_t3: -.size_x dw 16 ;+0 -rb 2+2+2 -.btn_high dd 15 ;+8 -.type dd 1 ;+12 -.max_area dd 100 ;+16 -rb 4+4 -.bckg_col dd 0xeeeeee ;+28 -.frnt_col dd 0xbbddff ;+32 -.line_col dd 0 ;+36 -rb 4+2+2 -.run_x: -rb 2+2+2+2+4+4+4+4+4+4 -.all_redraw dd 0 ;+80 -.ar_offset dd 1 ;+84 - +w_scr_t3 scrollbar 16, 0,0,0, 15, 100,0,0, 0,0,0, 1