Subversion Repositories Kolibri OS

Rev

Rev 5935 | Rev 5944 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;
  2. ; ¢ í⮬ ä ©«¥ ᮡ࠭ë ä㭪樨 ­ã¦­ë¥ ¤«ï ᮧ¤ ­¨ï ¨
  3. ; à ¡®âë ®ª­  á ª®®à¤¨­ â ¬¨ ¢¥à設
  4. ;
  5.  
  6. prop_wnd_width  equ 340 ;è¨à¨­  ®ª­  ᮠ᢮©á⢠¬¨ ®¡ê¥ªâ 
  7. prop_wnd_height equ 460 ;¢ëá®â  ®ª­  ᮠ᢮©á⢠¬¨ ®¡ê¥ªâ 
  8. 3d_wnd_l equ   5 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  á«¥¢ 
  9. 3d_wnd_t equ  23 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  ᢥàåã
  10. 3d_wnd_w equ 320
  11. 3d_wnd_h equ 240
  12. SIZE_ONE_FLOAT equ 14
  13. MAX_OBJECT_SIZE equ (4+SIZE_ONE_FLOAT*3+1)
  14.  
  15. bit_vertexes equ 0
  16. bit_faces equ 1
  17. bit_faces_fill equ 2
  18. bit_light equ 3
  19.  
  20. ini_name db 'info3ds.ini',0
  21. ini_sec_w3d db 'Window 3d',0
  22. key_dv  db 'draw_vertices',0
  23. key_df  db 'draw_faces',0
  24. key_dff db 'draw_faces_fill',0
  25. key_dl  db 'draw_light',0
  26. key_ox  db 'col_ox',0
  27. key_oy  db 'col_oy',0
  28. key_oz  db 'col_oz',0
  29. key_bk  db 'col_bkgnd',0
  30. key_vert db 'col_vertices',0
  31. key_face db 'col_faces',0
  32.  
  33. prop_wnd_run db 0 ;¯¥à¥¬¥­­ ï á«¥¤ïé ï §  ⥬ çâ®-¡ë ­¥ § ¯ã᪠âì ¡®«ìè¥ 1-£® ®ª­  ᮠ᢮©á⢠¬¨ ®¤­®¢à¥¬¥­­®
  34.  
  35. txt_q db '?',0
  36. txt_space:
  37.         db SIZE_ONE_FLOAT dup(' ')
  38. .end:
  39.         db 0
  40.  
  41. rad_c dd 150 ;¤«ï ¢ëç¨á«¥­¨ï à ¤¨ãá 
  42.  
  43. obj_point: ;¤®¡ ¢«ï¥¬ë© ®¡ê¥ªâ
  44.         dd 0   ;㪠§ â¥«ì
  45. .text:
  46.         rb MAX_OBJECT_SIZE
  47.  
  48.  
  49.  
  50. ;¤ ­®¥ ®ª­® (¯à®æ¥áá) ¢ë§ë¢ ¥âìáï ä㭪樥© but_wnd_coords
  51. align 4
  52. prop_start:
  53. pushad
  54.         mcall 40,0x27 ;¬ áª  ®¦¨¤ ¥¬ëå ᮡë⨩
  55.         inc byte[prop_wnd_run]
  56.         mov dword[w_scr_t3.type],1
  57.         call prop_wnd_clear_param
  58.  
  59.         stdcall [tl_node_get_data],tree1
  60.         xor edx,edx
  61.         mov dword[capt_p],txt_q
  62.         cmp eax,0
  63.         je .no_points
  64.                 mov ebx,[eax] ;¯®«ãç ¥¬ §­ ç¥­¨¥ ᤢ¨£  ¢ë¡à ­­®£® ¡«®ª 
  65.                 add ebx,[open_file_data]
  66.  
  67.                 cmp word[ebx],CHUNK_OBJBLOCK
  68.                 jne .end_oblo
  69.                         mov dword[capt_p],txt_4000
  70.                         call found_block_data
  71.                         cmp eax,0
  72.                         je .no_points
  73.                         mov esi,eax
  74.                         movzx ecx,byte[esi+2] ;cl - ã஢¥­ì ¢ë¡à ­­®£® 㧫 
  75.                         .cycle_0:
  76.                                 stdcall [tl_node_poi_get_next_info], tree1,esi
  77.                                 cmp eax,0
  78.                                 je .no_points
  79.                                 cmp byte[eax+2],cl
  80.                                 jle .no_points
  81.                                 mov esi,eax
  82.                                 stdcall [tl_node_poi_get_data], tree1,esi
  83.                                 mov ebx,[eax]
  84.                                 add ebx,[open_file_data]
  85.                                 cmp word[ebx],CHUNK_VERTLIST
  86.                                 je .ini_vlist
  87.                                 jmp .cycle_0
  88.                         jmp .no_points
  89.                 .end_oblo:
  90.                 cmp word[ebx],CHUNK_TRIMESH
  91.                 jne .end_trim
  92.                         mov dword[capt_p],txt_4100
  93.                         call found_block_data
  94.                         cmp eax,0
  95.                         je .no_points
  96.                         mov esi,eax
  97.                         movzx ecx,byte[esi+2] ;cl - ã஢¥­ì ¢ë¡à ­­®£® 㧫 
  98.                         .cycle_1:
  99.                                 stdcall [tl_node_poi_get_next_info], tree1,esi
  100.                                 cmp eax,0
  101.                                 je .no_points
  102.                                 cmp byte[eax+2],cl
  103.                                 jle .no_points
  104.                                 mov esi,eax
  105.                                 stdcall [tl_node_poi_get_data], tree1,esi
  106.                                 mov ebx,[eax]
  107.                                 add ebx,[open_file_data]
  108.                                 cmp word[ebx],CHUNK_VERTLIST
  109.                                 je .ini_vlist
  110.                                 jmp .cycle_1
  111.                         jmp .no_points
  112.                 .end_trim:
  113.                 cmp word[ebx],CHUNK_VERTLIST
  114.                 jne .end_vlist
  115.                         mov dword[capt_p],txt_4110
  116.                         .ini_vlist:
  117.                         movzx edx,word[ebx+6] ;ª®««¨ç¥á⢮ â®ç¥ª
  118.                         add ebx,8
  119.                         ;¯®¨áª ¤ ­­ëå ¤«ï âà¥ã£®«ìª®¢
  120.                         call found_block_data
  121.                         cmp eax,0
  122.                         je .set_points
  123.                         mov esi,eax
  124.                         ;¥á«¨ ­ è«¨ ¢ë¡à ­­ë© 㧥«, â® ¤ «¥¥ ¯ëâ ¥¬áï ­ ©â¨ 㧥« á âà¥ã£®«ì­¨ª ¬¨
  125.                         movzx ecx,byte[esi+2] ;cl - ã஢¥­ì ¢ë¡à ­­®£® 㧫 
  126.                         .cycle_2:
  127.                                 stdcall [tl_node_poi_get_next_info], tree1,esi
  128.                                 cmp eax,0
  129.                                 je .set_points
  130.                                 mov esi,eax
  131.                                 stdcall [tl_node_poi_get_data], tree1,esi
  132.                                 cmp byte[esi+2],cl
  133.                                 jl .set_points
  134.                                 je .found
  135.                                 jmp .cycle_2
  136.                         .found: ;¥á«¨ ­ è«¨ 㧥« ⮣®¦¥ ã஢­ï çâ® ¨ ¢ë¡à ­­ë© 㧥«
  137.                                 cmp eax,0
  138.                                 je .set_points
  139.                                 mov eax,[eax]
  140.                                 add eax,[open_file_data]
  141.                                 cmp word[eax],CHUNK_FACELIST
  142.                                 jne .cycle_2
  143.                                 movzx ecx,word[eax+6]
  144.                                 mov [obj_tri_count],ecx
  145.                                 add eax,8 ;2+4+2 (chunk+size+count)
  146.                                 mov [obj_tri_data],eax
  147.                         jmp .set_points
  148.                 .end_vlist:
  149.                 cmp word[ebx],CHUNK_TRACKPIVOT
  150.                 jne @f
  151.                         inc edx
  152.                         add ebx,6
  153.                         mov dword[capt_p],txt_b013
  154.                         jmp .set_points
  155.                 @@:
  156.                 cmp word[ebx],0xb014
  157.                 jne @f
  158.                         mov edx,2
  159.                         add ebx,6
  160.                         mov dword[capt_p],txt_b014
  161.                         ;jmp .set_points
  162.                 @@:
  163.                 .set_points:
  164.                 mov [obj_poi_data],ebx
  165.                 mov [obj_poi_count],edx
  166.         .no_points:
  167.  
  168.         ;­ áâனª  ᯨ᪠ ®¡ê¥ªâ®¢
  169.         mov dword[tree3.info_max_count],2
  170.         add dword[tree3.info_max_count],edx ;áâ ¢¨¬ ç¨á«® 㧫®¢, à ¢­®¥ ª®««¨ç¥áâ¢ã â®ç¥ª (+2 ­  ­ ç «® ¨ ª®­¥æ ᯨ᪠)
  171.         stdcall dword[tl_data_init], tree3
  172.         mov eax,dword[icon_tl_sys]
  173.         mov dword[tree3.data_img_sys],eax
  174.         mov eax,dword[icon_toolbar]
  175.         mov dword[tree3.data_img],eax
  176.  
  177.         cmp edx,0
  178.         je .no_object
  179.                 mov word[NumberSymbolsAD],5
  180.                 finit
  181.                 .new_point:
  182.                         mov dword[obj_point],ebx
  183.                         mov dword[obj_point.text],0
  184.                         cld
  185.                         mov ecx,3
  186.                         @@:
  187.                                 fld dword[ebx]
  188.                                 fstp qword[Data_Double]
  189.                                 call DoubleFloat_to_String
  190.                                 add ebx,4
  191.                                 stdcall str_len, Data_String
  192.                                 mov esi,txt_space
  193.                                 add esi,eax
  194.                                 cmp esi,txt_space.end
  195.                                 jl .normal_size
  196.                                         mov esi,txt_space.end-1 ;¬¨­¨¬ã¬ 1 ¯à®¡¥« ­ã¦­® ¤®¡ ¢¨âì, çâ®-¡ë æ¨äàë ­¥ ᫨¯ «¨áì
  197.                                 .normal_size:
  198.                                 stdcall str_cat, obj_point.text,esi
  199.                                 stdcall str_cat, obj_point.text,Data_String
  200.                                 loop @b
  201.                         stdcall dword[tl_node_add], tree3,(ID_ICON_DATA shl 16),obj_point
  202.                         stdcall dword[tl_cur_next], tree3
  203.                         dec edx
  204.                         cmp edx,0
  205.                         jg .new_point
  206.                         stdcall dword[tl_cur_beg], tree3
  207.         .no_object:
  208.         call obj_set_sizes
  209.         edit_boxes_set_sys_color edit1,editboxes_end,sc ;ãáâ ­®¢ª  á¨á⥬­ëå 梥⮢
  210.         stdcall [edit_box_set_text], edit1, txt_q
  211.         stdcall [edit_box_set_text], edit2, txt_q
  212.         stdcall [edit_box_set_text], edit3, txt_q
  213.         mov eax,0xc0c0c0
  214.         mov ebx,[color_ox]
  215.         shr ebx,2
  216.         and ebx,0x3f3f3f
  217.         add eax,ebx
  218.         mov [edit1.color],eax
  219.         mov eax,0xc0c0c0
  220.         mov ebx,[color_oy]
  221.         shr ebx,2
  222.         and ebx,0x3f3f3f
  223.         add eax,ebx
  224.         mov [edit2.color],eax
  225.         mov eax,0xc0c0c0
  226.         mov ebx,[color_oz]
  227.         shr ebx,2
  228.         and ebx,0x3f3f3f
  229.         add eax,ebx
  230.         mov [edit3.color],eax
  231. popad
  232.  
  233.         call prop_red_win
  234.  
  235. ;­¥ ®âà뢠âì íâã äã­ªæ¨î ®â ¯à¥¤ë¤ã饩
  236. align 4
  237. prop_still:
  238.         pushad
  239.  
  240.         mcall 23,10
  241.         or eax,eax
  242.         jnz @f
  243.                 call prop_timer_funct
  244.                 jmp .end
  245.         @@:
  246.  
  247.         cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
  248.         jne @f
  249.                 call prop_red_win
  250.                 jmp .end
  251.         @@:
  252.         cmp al,2
  253.         jne @f
  254.                 call prop_key
  255.                 jmp .end
  256.         @@:
  257.         cmp al,3
  258.         jz prop_button
  259.         cmp al,6
  260.         jne @f
  261.                 call prop_mouse
  262.         @@:
  263. .end:
  264.         popad
  265.         jmp prop_still
  266.  
  267. align 4
  268. prop_red_win:
  269. pushad
  270.         mcall 12,1
  271.  
  272.         xor eax,eax
  273.         mov edi,dword[capt_p] ;children window caption
  274.         mov bx,word[procinfo.box.left]
  275.         add bx,word[buf_0.l]
  276.         add bx,5 ;è¨à¨­  ¡®ª®¢®© à ¬ª¨
  277.         shl ebx,16
  278.         mov bx,prop_wnd_width
  279.         mov cx,word[procinfo.box.top]
  280.         add cx,word[buf_0.t]
  281.         shl ecx,16
  282.         mov cx,prop_wnd_height
  283.         mov edx,[sc.work]
  284.         or  edx,0x33000000
  285.         int 0x40
  286.  
  287.         mov esi,[sc.work_button]
  288.         mcall 8, (5 shl 16)+20, (266 shl 16)+20, 3
  289.         mcall , (30 shl 16)+20, (266 shl 16)+20, 4
  290.  
  291.         mov ebx,[image_data_toolbar]
  292.         add ebx,3*IMAGE_TOOLBAR_ICON_SIZE
  293.         mcall 7, , (16 shl 16)+16, (7 shl 16)+268 ;load
  294.  
  295.         sub ebx,IMAGE_TOOLBAR_ICON_SIZE
  296.         mov edx,(32 shl 16)+268 ;save
  297.         int 0x40
  298.  
  299.         mov dword[w_scr_t3.all_redraw],1
  300.         stdcall [scrollbar_ver_draw],dword w_scr_t3
  301.         stdcall [tl_draw], tree3
  302.         stdcall [edit_box_draw], edit1
  303.         stdcall [edit_box_draw], edit2
  304.         stdcall [edit_box_draw], edit3
  305.  
  306.         stdcall [kmainmenu_draw], [main_menu]
  307.         call draw_3d
  308.         mcall 12,2
  309. popad
  310.         ret
  311.  
  312. ;ãáâ ­®¢ª  ¢á¥å ®á­®¢­ëå ¯¥à¥¬¥­­ëå ¯® 㬮«ç ­¨î
  313. align 4
  314. prop_wnd_clear_param:
  315.         ;ãáâ ­®¢ª  ¯ à ¬¥â஢ ®â®¡à ¦¥­¨ï
  316.         call mnu_reset_settings
  317.  
  318.         ;®¡­ã«¥­¨¥ 㪠§ â¥«¥© ­  ¤ ­­ë¥ ®¡ê¥ªâ®¢
  319.         mov dword[obj_poi_data],0
  320.         mov dword[obj_poi_count],0
  321.         mov dword[obj_tri_data],0
  322.         mov dword[obj_tri_count],0
  323.         ret
  324.  
  325. ;¯®¨áª ¤ ­­ëå
  326. ;input:
  327. ;eax - ⥪ã騩 㧥«
  328. ;output:
  329. ;eax - áâàãªâãà  â¥ªã饣® 㧫  (¨«¨ 0 ¯à¨ ­¥ã¤ ç¥)
  330. align 4
  331. found_block_data:
  332. push ebx ecx
  333.         mov ecx,eax
  334.         stdcall [tl_node_poi_get_info], tree1,0
  335.         @@:
  336.                 mov ebx,eax
  337.                 stdcall [tl_node_poi_get_data], tree1,ebx
  338.                 cmp eax,ecx
  339.                 je @f ;¥á«¨ ¯®¯ «¨ ­  ¢ë¡à ­­ë© 㧥«
  340.                 stdcall [tl_node_poi_get_next_info], tree1,ebx
  341.                 cmp eax,0
  342.                 jne @b
  343.                 jmp .end
  344.         @@:
  345.                 mov eax,ebx
  346.         .end:
  347. pop ecx ebx
  348.         ret
  349.  
  350. ;ãáâ ­®¢ª  à §¬¥à®¢ ®¡ê¥ªâ 
  351. align 4
  352. proc obj_set_sizes uses eax ebx esi
  353.         cmp dword[obj_poi_count],0
  354.         je .end
  355.                 finit
  356.                 mov eax,[obj_poi_data]
  357.                 mov ebx,dword[eax]
  358.                 mov [obj_x_min],ebx
  359.                 mov [obj_x_max],ebx
  360.                 mov ebx,dword[eax+4]
  361.                 mov [obj_y_min],ebx
  362.                 mov [obj_y_max],ebx
  363.                 mov ebx,dword[eax+8]
  364.                 mov [obj_z_min],ebx
  365.                 mov [obj_z_max],ebx
  366.  
  367.         mov ebx,[obj_poi_data]
  368.         mov esi,[obj_poi_count]
  369. align 4
  370.         .cycle_0: ;à ¡®â  á ª®®à¤¨­ â®© x
  371.                 fld dword[ebx]
  372.                 fld dword[obj_x_min]
  373.                 fcomp
  374.                 fstsw ax
  375.                 sahf
  376.                 jb @f
  377.                         mov eax,[ebx]
  378.                         mov [obj_x_min],eax
  379.                         ffree st0
  380.                         fincstp
  381.                         jmp .next_x
  382.                 @@:
  383.                 fld dword[obj_x_max]
  384.                 fcompp
  385.                 fstsw ax
  386.                 sahf
  387.                 ja .next_x
  388.                         mov eax,[ebx]
  389.                         mov [obj_x_max],eax
  390.                 .next_x:
  391.  
  392.                 add ebx,12
  393.                 dec esi
  394.                 jnz .cycle_0
  395.  
  396.                 fld1
  397.                 fld dword[obj_x_max]
  398.                 fsub dword[obj_x_min]
  399.                 fst dword[obj_x_centr]
  400.                 fdivp ;1/size.x
  401.                 fstp dword[obj_x_scale]
  402.  
  403.                 fld dword[obj_x_centr]
  404.                 fld1
  405.                 fld1
  406.                 faddp
  407.                 fdivp ;centr.x = size.x/2
  408.                 fadd dword[obj_x_min]
  409.                 fchs
  410.                 fstp dword[obj_x_centr]
  411.  
  412.         mov ebx,[obj_poi_data]
  413.         mov esi,[obj_poi_count]
  414. align 4
  415.         .cycle_1: ;à ¡®â  á ª®®à¤¨­ â®© y
  416.                 fld dword[ebx+4]
  417.                 fld dword[obj_y_min]
  418.                 fcomp
  419.                 fstsw ax
  420.                 sahf
  421.                 jb @f
  422.                         mov eax,[ebx+4]
  423.                         mov [obj_y_min],eax
  424.                         ffree st0
  425.                         fincstp
  426.                         jmp .next_y
  427.                 @@:
  428.                 fld dword[obj_y_max]
  429.                 fcompp
  430.                 fstsw ax
  431.                 sahf
  432.                 ja .next_y
  433.                         mov eax,[ebx+4]
  434.                         mov [obj_y_max],eax
  435.                 .next_y:
  436.  
  437.                 add ebx,12
  438.                 dec esi
  439.                 jnz .cycle_1
  440.  
  441.                 fld1
  442.                 fld dword[obj_y_max]
  443.                 fsub dword[obj_y_min]
  444.                 fst dword[obj_y_centr]
  445.                 fdivp ;1/size.y
  446.                 fstp dword[obj_y_scale]
  447.  
  448.                 fld dword[obj_y_centr]
  449.                 fld1
  450.                 fld1
  451.                 faddp
  452.                 fdivp ;centr.y = size.y/2
  453.                 fadd dword[obj_y_min]
  454.                 fchs
  455.                 fstp dword[obj_y_centr]
  456.  
  457.         mov ebx,[obj_poi_data]
  458.         mov esi,[obj_poi_count]
  459. align 4
  460.         .cycle_2: ;à ¡®â  á ª®®à¤¨­ â®© z
  461.                 fld dword[ebx+8]
  462.                 fld dword[obj_z_min]
  463.                 fcomp
  464.                 fstsw ax
  465.                 sahf
  466.                 jb @f
  467.                         mov eax,[ebx+8]
  468.                         mov [obj_z_min],eax
  469.                         ffree st0
  470.                         fincstp
  471.                         jmp .next_z
  472.                 @@:
  473.                 fld dword[obj_z_max]
  474.                 fcompp
  475.                 fstsw ax
  476.                 sahf
  477.                 ja .next_z
  478.                         mov eax,[ebx+8]
  479.                         mov [obj_z_max],eax
  480.                 .next_z:
  481.  
  482.                 add ebx,12
  483.                 dec esi
  484.                 jnz .cycle_2
  485.  
  486.                 fld1
  487.                 fld dword[obj_z_max]
  488.                 fsub dword[obj_z_min]
  489.                 fst dword[obj_z_centr]
  490.                 fdivp ;1/size.z
  491.                 fstp dword[obj_z_scale]
  492.  
  493.                 fld dword[obj_z_centr]
  494.                 fld1
  495.                 fld1
  496.                 faddp
  497.                 fdivp ;centr.z = size.z/2
  498.                 fadd dword[obj_z_min]
  499.                 fchs
  500.                 fstp dword[obj_z_centr]
  501.  
  502.                 ;­ å®¤¨¬ à ¤¨ãá ¤«ï áä¥àë
  503.                 fld dword[obj_x_max]
  504.                 fsub dword[obj_x_min]
  505.                 fld dword[obj_y_max]
  506.                 fsub dword[obj_y_min]
  507.                 faddp
  508.                 fild dword[rad_c]
  509.                 fdivp ;radius=(size.x+size.y)/rad_c
  510.                 fstp dword[sph_radius]
  511.         .end:
  512.         ret
  513. endp
  514.  
  515. ;à¨á®¢ ­¨¥ â®ç¥ª ¢ 3d
  516. align 4
  517. draw_3d:
  518.         cmp dword[obj_poi_count],2
  519.         jl .end_f
  520.         stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;®ç¨á⨬ ¡ãä¥à æ¢¥â  ¨ £«ã¡¨­ë
  521.         stdcall [glPushMatrix]
  522.         bt dword[draw_mode],bit_light
  523.         jnc @f
  524.                 call SetLight
  525.                 jmp .end_l
  526.         @@:
  527.                 stdcall [glDisable],GL_LIGHTING
  528.         .end_l:
  529.         stdcall [glTranslatef], 0.0,0.0,0.5 ;correct for z
  530.         stdcall [glScalef], [obj_x_scale],[obj_y_scale],[obj_z_scale]
  531.         stdcall [glScalef], 1.0,1.0,0.7 ;correct for z
  532.         stdcall [glRotatef], [angle_z],0.0,0.0,1.0
  533.         stdcall [glRotatef], [angle_y],0.0,1.0,0.0
  534.         stdcall [glRotatef], [angle_x],1.0,0.0,0.0
  535.         stdcall [glTranslatef], [obj_x_centr],[obj_y_centr],[obj_z_centr]
  536.  
  537.         ;à¨á®¢ ­¨¥ â®ç¥ª
  538.         bt dword[draw_mode],bit_vertexes
  539.         jnc .end_points
  540.                 stdcall [glColor3ub],[color_vert+2],[color_vert+1],[color_vert]
  541.                 stdcall [glBegin],GL_POINTS
  542.                 mov eax,[obj_poi_data]
  543.                 mov ebx,[obj_poi_count]
  544.                 @@:
  545.                         stdcall [glVertex3f], [eax],[eax+4],[eax+8]
  546.                         add eax,12
  547.                         dec ebx
  548.                         jnz @b
  549.                 stdcall [glEnd]
  550.         .end_points:
  551.  
  552.         ;à¨á®¢ ­¨¥ ¢ë¤¥«¥­­®© â®çª¨
  553.         stdcall [tl_node_get_data],tree3
  554.         cmp eax,0
  555.         je @f
  556.                 ;¢ë¤¥«¥­¨¥  ªâ¨¢­®© â®çª¨
  557.                 mov eax,[eax]
  558.  
  559.                 stdcall [glBegin],GL_LINES
  560.                 stdcall [glColor3ub],[color_ox+2],[color_ox+1],[color_ox]
  561.                 stdcall [glVertex3f], [obj_x_min],[eax+4],[eax+8]
  562.                 stdcall [glVertex3f], [obj_x_max],[eax+4],[eax+8]
  563.                 stdcall [glColor3ub],[color_oy+2],[color_oy+1],[color_oy]
  564.                 stdcall [glVertex3f], [eax],[obj_y_min],[eax+8]
  565.                 stdcall [glVertex3f], [eax],[obj_y_max],[eax+8]
  566.                 stdcall [glColor3ub],[color_oz+2],[color_oz+1],[color_oz]
  567.                 stdcall [glVertex3f], [eax],[eax+4],[obj_z_min]
  568.                 stdcall [glVertex3f], [eax],[eax+4],[obj_z_max]
  569.                 stdcall [glEnd]
  570.  
  571.                 stdcall [glColor3f], 1.0, 1.0, 0.0
  572.                 stdcall [glPushMatrix]
  573.                         stdcall [glTranslatef], [eax],[eax+4],[eax+8]
  574.                         stdcall [gluSphere], [qObj], [sph_radius], 8,8
  575.                 stdcall [glPopMatrix]
  576.         @@:
  577.  
  578.         ;à¨á®¢ ­¨¥ £à ­¥©
  579.         bt dword[draw_mode],bit_faces
  580.         jnc .end_triangles
  581.         cmp dword[obj_tri_count],0
  582.         je .end_triangles
  583.         cmp dword[obj_poi_count],0
  584.         je .end_triangles
  585.                 bt dword[draw_mode],bit_faces_fill
  586.                 jc @f
  587.                         push GL_LINE
  588.                         jmp .end_0
  589.                 @@:
  590.                         push GL_FILL
  591.                 .end_0:
  592.                 stdcall [glPolygonMode], GL_FRONT_AND_BACK ;mode - 㦥 ¢ á⥪¥
  593.                 stdcall [glColor3ub],[color_face+2],[color_face+1],[color_face]
  594.                 stdcall [glBegin],GL_TRIANGLES
  595.                 mov eax,[obj_tri_data]
  596.                 mov ecx,[obj_tri_count]
  597.                 @@:
  598.                         movzx ebx,word[eax] ;1-ï ¢¥à設 
  599.                         imul ebx,12
  600.                         add ebx,[obj_poi_data]
  601.                         stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8]
  602.                         movzx ebx,word[eax+2] ;2-ï ¢¥à設 
  603.                         imul ebx,12
  604.                         add ebx,[obj_poi_data]
  605.                         stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8]
  606.                         movzx ebx,word[eax+4] ;3-ï ¢¥à設 
  607.                         imul ebx,12
  608.                         add ebx,[obj_poi_data]
  609.                         stdcall [glVertex3f], [ebx],[ebx+4],[ebx+8]
  610.                         add eax,8 ;à §¬¥à âà¥ã£®«ì­¨ª  = (3 ¢¥à設ë (¯® 2¡) + ᢮©á⢠ (2¡))
  611.                         dec ecx
  612.                         jnz @b
  613.                 stdcall [glEnd]
  614.         .end_triangles:
  615.  
  616.         stdcall [glPopMatrix]
  617.         stdcall [kosglSwapBuffers]
  618.         .end_f:
  619.         ret
  620.  
  621. align 4
  622. SetLight:
  623.         stdcall [glLightfv], GL_LIGHT0, GL_POSITION, light_position
  624.         stdcall [glLightfv], GL_LIGHT0, GL_SPOT_DIRECTION, light_dir
  625.  
  626.         stdcall [glLightfv], GL_LIGHT0, GL_DIFFUSE, white_light
  627.         stdcall [glLightfv], GL_LIGHT0, GL_SPECULAR, white_light
  628.  
  629.         stdcall [glEnable], GL_COLOR_MATERIAL
  630.         stdcall [glColorMaterial], GL_FRONT, GL_AMBIENT_AND_DIFFUSE
  631.         stdcall [glMaterialfv], GL_FRONT, GL_SPECULAR, mat_specular
  632.         stdcall [glMaterialf], GL_FRONT, GL_SHININESS, mat_shininess
  633.         stdcall [glLightModelfv], GL_LIGHT_MODEL_AMBIENT, lmodel_ambient
  634.  
  635.         stdcall [glEnable],GL_LIGHTING
  636.         stdcall [glEnable],GL_LIGHT0
  637.         ret
  638.  
  639. align 4
  640. proc prop_key uses eax ebx
  641.         mcall 2
  642.  
  643.         test word [edit1.flags],10b ;ed_focus
  644.         je @f
  645.                 stdcall [edit_box_key], edit1
  646.                 jmp .end
  647.         @@:
  648.         test word [edit2.flags],10b
  649.         je @f
  650.                 stdcall [edit_box_key], edit2
  651.                 jmp .end
  652.         @@:
  653.         test word [edit3.flags],10b
  654.         je @f
  655.                 stdcall [edit_box_key], edit3
  656.                 jmp .end
  657.         @@:
  658.         cmp dword[el_focus], tree3
  659.         jne @f
  660.                 stdcall [tl_key], tree3
  661.                 jmp .end
  662.         @@:
  663.  
  664.         cmp ah,178 ;Up
  665.         jne @f
  666.                 fld dword[angle_x]
  667.                 fadd dword[delt_size]
  668.                 fstp dword[angle_x]
  669.                 call draw_3d
  670.                 jmp .end
  671.         @@:
  672.         cmp ah,177 ;Down
  673.         jne @f
  674.                 fld dword[angle_x]
  675.                 fsub dword[delt_size]
  676.                 fstp dword[angle_x]
  677.                 call draw_3d
  678.                 jmp .end
  679.         @@:
  680.         cmp ah,176 ;Left
  681.         jne @f
  682.                 fld dword[angle_y]
  683.                 fadd dword[delt_size]
  684.                 fstp dword[angle_y]
  685.                 call draw_3d
  686.                 jmp .end
  687.         @@:
  688.         cmp ah,179 ;Right
  689.         jne @f
  690.                 fld dword[angle_y]
  691.                 fsub dword[delt_size]
  692.                 fstp dword[angle_y]
  693.                 call draw_3d
  694.                 ;jmp .end
  695.         @@:
  696.         .end:
  697.         ret
  698. endp
  699.  
  700. align 4
  701. prop_mouse:
  702.         push eax ebx
  703.         mcall 37,3
  704.         bt eax,0
  705.         jnc .end_m
  706.                 ;mouse l. but. move
  707.                 cmp dword[mouse_drag],1
  708.                 jne .end_m
  709.                 mcall 37,1 ;get mouse coords
  710.                 mov ebx,eax
  711.                 shr ebx,16 ;mouse.x
  712.                 cmp ebx,3d_wnd_l
  713.                 jg @f
  714.                         mov ebx,3d_wnd_l
  715.                 @@:
  716.                 sub ebx,3d_wnd_l
  717.                 cmp ebx,3d_wnd_w
  718.                 jle @f
  719.                         mov ebx,3d_wnd_w
  720.                 @@:
  721.                 and eax,0xffff ;mouse.y
  722.                 cmp eax,3d_wnd_t
  723.                 jg @f
  724.                         mov eax,3d_wnd_t
  725.                 @@:
  726.                 sub eax,3d_wnd_t
  727.                 cmp eax,3d_wnd_h
  728.                 jle @f
  729.                         mov eax,3d_wnd_h
  730.                 @@:
  731.                 finit
  732.                 fild dword[mouse_y]
  733.                 mov [mouse_y],eax
  734.                 fisub dword[mouse_y]
  735.                 fdiv dword[angle_dxm] ;¥á«¨ ªãàá®à ¤¢¨¦¥âáï ¯® ®á¨ y (¢¢¥àå ¨«¨ ¢­¨§) â® ¯®¢®à®â ¤¥« ¥¬ ¢®ªà㣠®á¨ x
  736.                 fadd dword[angle_x]
  737.                 fstp dword[angle_x]
  738.  
  739.                 fild dword[mouse_x]
  740.                 mov [mouse_x],ebx
  741.                 fisub dword[mouse_x]
  742.                 fdiv dword[angle_dym] ;¥á«¨ ªãàá®à ¤¢¨¦¥âáï ¯® ®á¨ x (¢¢¥àå ¨«¨ ¢­¨§) â® ¯®¢®à®â ¤¥« ¥¬ ¢®ªà㣠®á¨ y
  743.                 fadd dword[angle_y]
  744.                 fstp dword[angle_y]
  745.  
  746.                 call draw_3d
  747.                 jmp .end_d
  748.         .end_m:
  749.         bt eax,16
  750.         jnc @f
  751.                 ;mouse l. but. up
  752.                 mov dword[mouse_drag],0
  753.                 jmp .end_d
  754.         @@:
  755.         bt eax,8
  756.         jnc .end_d
  757.                 ;mouse l. but. press
  758.                 mcall 37,1 ;get mouse coords
  759.                 mov ebx,eax
  760.                 shr ebx,16 ;mouse.x
  761.                 cmp ebx,3d_wnd_l
  762.                 jl .end_d
  763.                 sub ebx,3d_wnd_l
  764.                 cmp ebx,3d_wnd_w
  765.                 jg .end_d
  766.                 and eax,0xffff ;mouse.y
  767.                 cmp eax,3d_wnd_t
  768.                 jl .end_d
  769.                 sub eax,3d_wnd_t
  770.                 cmp eax,3d_wnd_h
  771.                 jg .end_d
  772.                 mov dword[mouse_drag],1
  773.                 mov dword[mouse_x],ebx
  774.                 mov dword[mouse_y],eax
  775.         .end_d:
  776.  
  777.         stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
  778.         stdcall [tl_mouse], tree3
  779.         stdcall [edit_box_mouse], edit1
  780.         stdcall [edit_box_mouse], edit2
  781.         stdcall [edit_box_mouse], edit3
  782.         pop ebx eax
  783.         ret
  784.  
  785. align 4
  786. prop_button:
  787.         mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨
  788.  
  789.         cmp ah,3
  790.         jne @f
  791.                 call get_point_coords
  792.                 call draw_3d
  793.                 jmp prop_still.end
  794.         @@:
  795.         cmp ah,4
  796.         jne @f
  797.                 push eax ebx ecx edi esi
  798.                 stdcall [tl_node_get_data],tree3
  799.                 cmp eax,0
  800.                 je .no_select_1
  801.                         mov ebx,[eax]
  802.                         finit
  803.  
  804.                         mov esi,string1
  805.                         mov edi,Data_String
  806.                         cld
  807.                         mov ecx,8
  808.                         rep movsd
  809.                         call String_to_DoubleFloat
  810.                         fld  qword[Data_Double] ;áç¨â뢠¥¬ ª ª double
  811.                         fstp dword[ebx] ;á®å࠭塞 ª ª float
  812.  
  813.                         mov esi,string2
  814.                         mov edi,Data_String
  815.                         cld
  816.                         mov ecx,8
  817.                         rep movsd
  818.                         call String_to_DoubleFloat
  819.                         fld  qword[Data_Double] ;áç¨â뢠¥¬ ª ª double
  820.                         fstp dword[ebx+4] ;á®å࠭塞 ª ª float
  821.  
  822.                         mov esi,string3
  823.                         mov edi,Data_String
  824.                         cld
  825.                         mov ecx,8
  826.                         rep movsd
  827.                         call String_to_DoubleFloat
  828.                         fld  qword[Data_Double] ;áç¨â뢠¥¬ ª ª double
  829.                         fstp dword[ebx+8] ;á®å࠭塞 ª ª float
  830.  
  831.                         ;®¡­®¢«¥­¨¥ ¨§¬¥­¥­­®£® 㧫  ¢ ᯨ᪥ tree3 ¨ £« ¢­®£® ®ª­  (¯® â ©¬¥àã)
  832.                         mov word[NumberSymbolsAD],5
  833.                         mov dword[obj_point],ebx
  834.                         mov dword[obj_point.text],0
  835.                         cld
  836.                         mov ecx,3
  837.                         .coord:
  838.                                 fld dword[ebx]
  839.                                 fstp qword[Data_Double]
  840.                                 call DoubleFloat_to_String
  841.                                 add ebx,4
  842.                                 stdcall str_len, Data_String
  843.                                 mov esi,txt_space
  844.                                 add esi,eax
  845.                                 cmp esi,txt_space.end
  846.                                 jl .normal_size
  847.                                         mov esi,txt_space.end-1 ;¬¨­¨¬ã¬ 1 ¯à®¡¥« ­ã¦­® ¤®¡ ¢¨âì, çâ®-¡ë æ¨äàë ­¥ ᫨¯ «¨áì
  848.                                 .normal_size:
  849.                                 stdcall str_cat, obj_point.text,esi
  850.                                 stdcall str_cat, obj_point.text,Data_String
  851.                                 loop .coord
  852.                         stdcall dword[tl_node_set_data], tree3,obj_point
  853.                         stdcall dword[tl_draw], tree3
  854.                         mov byte[can_save],1 ;¤«ï ¯®ª §  ª­®¯ª¨ '‘®åà ­¨âì'
  855.                         mov dword[offs_last_timer],0 ;¤«ï ®¡­®¢«¥­¨ï ¡«®ª  ¢ â ©¬¥à¥
  856.                         call draw_3d
  857.                 .no_select_1:
  858.                 pop esi edi ecx ebx eax
  859.                 jmp prop_still.end
  860.         @@:
  861.         cmp ah,5
  862.         jne @f
  863.                 call mnu_vertexes_on_off
  864.                 jmp prop_still.end
  865.         @@:
  866.         cmp ah,6
  867.         jne @f
  868.                 call mnu_faces_on_off
  869.                 jmp prop_still.end
  870.         @@:
  871.         cmp ah,7
  872.         jne @f
  873.                 call mnu_faces_fill_on_off
  874.                 jmp prop_still.end
  875.         @@:
  876.         cmp ah,8
  877.         jne @f
  878.                 call mnu_light_on_off
  879.                 jmp prop_still.end
  880.         @@:
  881.         cmp ah,9
  882.         jne @f
  883.                 call mnu_reset_settings
  884.                 jmp prop_still.end
  885.         @@:
  886.  
  887.         cmp ah,1
  888.         jne prop_still.end
  889. .exit:
  890.         mov dword[tree3.data_img],0 ;ç¨á⨬ 㪠§ â¥«¨ ­  ¨ª®­ª¨ çâ®-¡ë ¨å ­¥ 㤠«¨« ¤¥áâàãªâ®à
  891.         mov dword[tree3.data_img_sys],0 ;â. ª. ®­¨ ¥é¥ ¨á¯®«ì§ãîâìáï ¢ ¤à㣨å í«¥¬¥­â å
  892.         stdcall dword[tl_data_clear], tree3
  893.         mov byte[prop_wnd_run],0 ;®¡­ã«ï¥¬ áç¥â稪 ®ª®­
  894.         mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
  895.  
  896. align 4
  897. get_point_coords:
  898.         ;§ £à㧪  ª®®à¤¨­ â ¢ editbox-ë
  899.         push eax ebx
  900.         stdcall [tl_node_get_data],tree3
  901.         cmp eax,0
  902.         je @f
  903.                 mov ebx,[eax]
  904.                 mov word[NumberSymbolsAD],8
  905.                 finit
  906.                 fld dword[ebx]
  907.                 fstp qword[Data_Double]
  908.                 call DoubleFloat_to_String
  909.                 stdcall [edit_box_set_text], edit1, Data_String
  910.                 fld dword[ebx+4]
  911.                 fstp qword[Data_Double]
  912.                 call DoubleFloat_to_String
  913.                 stdcall [edit_box_set_text], edit2, Data_String
  914.                 fld dword[ebx+8]
  915.                 fstp qword[Data_Double]
  916.                 call DoubleFloat_to_String
  917.                 stdcall [edit_box_set_text], edit3, Data_String
  918.                 stdcall [edit_box_draw], edit1
  919.                 stdcall [edit_box_draw], edit2
  920.                 stdcall [edit_box_draw], edit3
  921.         @@:
  922.         pop ebx eax
  923.         ret
  924.  
  925. align 4
  926. proc prop_timer_funct uses eax
  927.         ;¯à®á¬ âਢ ¥¬ ¢ë¤¥«¥­­ãî ª®®à¤¨­ âã
  928.         stdcall [tl_node_get_data],tree3
  929.         cmp [cursor_last_draw],eax
  930.         je @f
  931.                 mov [cursor_last_draw],eax
  932.                 call draw_3d
  933.         @@:
  934.         ret
  935. endp
  936.  
  937. ;¨§¬¥­ï¥¬ ०¨¬ à¨á®¢ ­¨ï ¢¥à設
  938. align 4
  939. mnu_vertexes_on_off:
  940.         xor dword[draw_mode], 1 shl bit_vertexes
  941.         ret
  942.  
  943. ;¨§¬¥­ï¥¬ ०¨¬ à¨á®¢ ­¨ï £à ­¥©
  944. align 4
  945. mnu_faces_on_off:
  946.         xor dword[draw_mode], 1 shl bit_faces
  947.         ret
  948.  
  949. ;¨§¬¥­ï¥¬ ª àª á­ë¥ ¨«¨ ᯫ®è­ë¥ £à ­¨
  950. align 4
  951. mnu_faces_fill_on_off:
  952.         xor dword[draw_mode], 1 shl bit_faces_fill
  953.         or  dword[draw_mode], 1 shl bit_faces ;¢ª«îç ¥¬ ०¨¬ à¨á®¢ ­¨ï £à ­¥© (¥á«¨ ¢¤à㣠¡ë« ®âª«î祭)
  954.         ret
  955.  
  956. ;¢ª«îç ¥¬ ¨«¨ ®âª«îç ¥¬ ®á¢¥é¥­¨¥
  957. align 4
  958. mnu_light_on_off:
  959.         xor dword[draw_mode], 1 shl bit_light
  960.         ret
  961.  
  962. align 4
  963. mnu_reset_settings:
  964.         mov dword[angle_x],0.0
  965.         mov dword[angle_y],0.0
  966.         mov dword[angle_z],0.0
  967.         m2m dword[draw_mode],dword[def_dr_mode]
  968.         ret
  969.  
  970. align 4
  971. def_dr_mode dd 0 ;०¨¬ à¨á®¢ ­¨ï ¯® 㬮«ç ­¨î
  972. delt_size dd 3.0 ;¨§¬¥­¥­¨¥ 㣫®¢ ¯à¨ ¯®¢®à®â å á ª«¨¢¨ âãàë
  973. mouse_drag dd 0 ;०¨¬ ¯®¢®à®â  áæ¥­ë ®â ¯¥à¥¬¥é¥­¨¨ ªãàá®à  ¬ëè¨
  974. mouse_x dd 0
  975. mouse_y dd 0
  976. angle_dxm dd 1.7775 ;~ 3d_wnd_w/180 - ¯à¨¡ ¢«¥­¨¥ 㣫®¢ ¯®¢®à®â  áæ¥­ë ¯à¨ ¢à é¥­¨¨ ¬ë襩
  977. angle_dym dd 1.3335 ;~ 3d_wnd_h/180
  978. ;angle_dzm dd ?
  979. draw_mode dd 0 ;०¨¬ à¨á®¢ ­¨ï ®¡ê¥ªâ 
  980. obj_poi_data dd 0 ;㪠§ â¥«ì ­  ª®®à¤¨­ âë ¢¥à設
  981. obj_poi_count dd 0 ;ª®««¨ç¥á⢮ ¢¥à設
  982. obj_tri_data dd 0 ;㪠§ â¥«ì ­  ¤ ­­ë¥ âà¥ã£®«ì­¨ª®¢
  983. obj_tri_count dd 0 ;ª®««¨ç¥á⢮ âà¥ã£®«ì­¨ª®¢
  984. cursor_last_draw dd 0 ;¯®«®¦¥­¨¥ ªãàá®à  ¯à¨ ¯®á«¥¤­¥© ¯à®à¨á®¢ª¥ 3d ®ª­ 
  985. sph_radius dd 0 ;à ¤¨ãá áä¥àë ¤«ï ¢ë¤¥«¥­¨ï  ªâ¨¢­®© â®çª¨
  986. obj_x_max dd 0
  987. obj_x_min dd 0
  988. obj_x_centr dd 0
  989. obj_x_scale dd 1.0
  990. obj_y_max dd 0
  991. obj_y_min dd 0
  992. obj_y_centr dd 0
  993. obj_y_scale dd 1.0
  994. obj_z_max dd 0
  995. obj_z_min dd 0
  996. obj_z_centr dd 0
  997. obj_z_scale dd 1.0
  998.  
  999. capt_p dd 0
  1000.  
  1001. ;¤¥à¥¢® á ®¡ê¥ªâ ¬¨ ¢ ¯®«ì§®¢ â¥«ì᪮¬ ä ©«¥
  1002. tree3 tree_list MAX_OBJECT_SIZE,3, tl_key_no_edit+tl_list_box_mode,\
  1003.         16,16, 0xffffff,0xb0d0ff,0x400040, 5,290,303,140, 16, 4,0, el_focus,\
  1004.         w_scr_t3,get_point_coords
  1005.  
  1006. edit1 edit_box 80,  76, 269, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 34, string1, mouse_dd, 0
  1007. edit2 edit_box 80, 160, 269, 0xd0d0ff, 0xff, 0x80ff, 0, 0x8000, 34, string2, mouse_dd, 0
  1008. edit3 edit_box 80, 244, 269, 0xd0ffd0, 0xff, 0x80ff, 0, 0x8000, 34, string3, mouse_dd, 0
  1009. editboxes_end:
  1010.  
  1011. string1 rb 34
  1012. string2 rb 34
  1013. string3 rb 34
  1014.  
  1015. align 4
  1016. w_scr_t3 scrollbar 16, 0,0,0, 15, 100,0,0, 0,0,0, 1
  1017.