Subversion Repositories Kolibri OS

Rev

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

  1. use32
  2.         org 0x0
  3.         db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
  4.         dd 1, start, i_end, mem, stacktop, 0, sys_path
  5.  
  6. include '../../../../programs/macros.inc'
  7. include '../../../../programs/proc32.inc'
  8. include '../../../../programs/develop/libraries/box_lib/load_lib.mac'
  9. include '../../../../programs/dll.inc'
  10. include '../../../../programs/develop/libraries/TinyGL/asm_fork/opengl_const.inc'
  11. include 'vox_3d.inc'
  12. include '../trunk/str.inc'
  13.  
  14. @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
  15. caption db 'Voxel viewer 07.12.15',0 ;¯®¤¯¨áì ®ª­ 
  16.  
  17. struct FileInfoBlock
  18.         Function dd ?
  19.         Position dd ?
  20.         Flags    dd ?
  21.         Count    dd ?
  22.         Buffer   dd ?
  23.                 db ?
  24.         FileName dd ?
  25. ends
  26.  
  27. 3d_wnd_l equ   5 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  á«¥¢ 
  28. 3d_wnd_t equ  30 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  ᢥàåã
  29. 3d_wnd_w equ 512
  30. 3d_wnd_h equ 512
  31.  
  32. image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
  33.  
  34. IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
  35. IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*10
  36. image_data_toolbar dd 0
  37.  
  38. offs_zbuf_pbuf equ 24
  39.  
  40. macro load_image_file path,buf,size { ;¬ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨©
  41.         ;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
  42.         if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
  43.                 jmp @f
  44.                         local .path_str
  45.                         .path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
  46.                         db 0
  47.                 @@:
  48.                 ;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
  49.                 copy_path .path_str,[32],file_name,0
  50.         else
  51.                 copy_path path,[32],file_name,0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
  52.         end if
  53.  
  54.         stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
  55.         mov [buf],eax
  56.  
  57.         mov [run_file_70.Function], 0
  58.         mov [run_file_70.Position], 0
  59.         mov [run_file_70.Flags], 0
  60.         mov [run_file_70.Count], dword size
  61.         mov [run_file_70.Buffer], eax
  62.         mov byte[run_file_70+20], 0
  63.         mov [run_file_70.FileName], file_name
  64.         mcall 70,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  65.         cmp ebx,0xffffffff
  66.         je @f
  67.                 ;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
  68.                 stdcall dword[img_decode], dword[buf],ebx,0
  69.                 mov dword[image_data],eax
  70.                 ;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
  71.                 stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
  72.                 ;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
  73.                 stdcall dword[img_destroy], dword[image_data]
  74.         @@:
  75. }
  76.  
  77.  
  78.  
  79. align 4
  80. start:
  81.         load_libraries l_libs_start,l_libs_end
  82.         ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
  83.         mov     ebp,lib_0
  84.         cmp     dword [ebp+ll_struc_size-4],0
  85.         jz      @f
  86.                 mcall -1 ;exit not correct
  87.         @@:
  88.         mcall 48,3,sc,sizeof.system_colors
  89.         mcall 40,0x27
  90.         stdcall [OpenDialog_Init],OpenDialog_data ;¯®¤£®â®¢ª  ¤¨ «®£ 
  91.  
  92.         stdcall [buf2d_create], buf_0 ;ᮧ¤ ­¨¥ ¡ãä¥à 
  93.  
  94.         load_image_file 'toolbar_t.png', image_data_toolbar,IMAGE_TOOLBAR_SIZE*2 ;*2 for gray icons
  95.         mov eax,[image_data_toolbar]
  96.         add eax,IMAGE_TOOLBAR_SIZE
  97.         stdcall img_to_gray, [image_data_toolbar],eax,(IMAGE_TOOLBAR_SIZE)/3
  98.  
  99.         mcall 26,9
  100.         mov [last_time],eax
  101.  
  102.         stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1
  103.         stdcall [glEnable], GL_DEPTH_TEST
  104.         stdcall [glEnable], GL_NORMALIZE ;¤¥« ¬ ­®à¬ «¨ ®¤¨­ ª®¢®© ¢¥«¨ç¨­ë ¢® ¨§¡¥¦ ­¨¥  àâ¥ä ªâ®¢
  105.         stdcall [glClearColor], 0.0,0.0,0.0,0.0
  106.         stdcall [glShadeModel], GL_SMOOTH
  107.  
  108.         call but_new_file
  109.  
  110.  
  111. align 4
  112. red_win:
  113.         call draw_window
  114.  
  115. align 4
  116. still:
  117.         mcall 26,9
  118.         mov ebx,[last_time]
  119.         add ebx,50 ;§ ¤¥à¦ª 
  120.         cmp ebx,eax
  121.         jge @f
  122.                 mov ebx,eax
  123.         @@:
  124.         sub ebx,eax
  125.         mcall 23
  126.         bt word[opt_auto_rotate],0
  127.         jnc @f
  128.                 or eax,eax
  129.                 jz timer_funct
  130.         @@:
  131.  
  132.         cmp al,1
  133.         jz red_win
  134.         cmp al,2
  135.         jz key
  136.         cmp al,3
  137.         jz button
  138.         cmp al,6
  139.         jne @f
  140.                 call mouse
  141.         @@:
  142.  
  143.         jmp still
  144.  
  145. align 4
  146. timer_funct:
  147.         pushad
  148.         mcall 26,9
  149.         mov [last_time],eax
  150.  
  151.         ; ¢â®¬ â¨ç¥áª®¥ ¨§¬¥­¥­¨¥ 㣫  ®¡§®à 
  152.         fld dword[angle_y]
  153.         fsub dword[delt_size]
  154.         fstp dword[angle_y]
  155.         call draw_3d
  156.         stdcall [kosglSwapBuffers]
  157.  
  158.         popad
  159.         jmp still
  160.  
  161. align 4
  162. draw_window:
  163. pushad
  164.         mcall 12,1
  165.  
  166.         ; *** à¨á®¢ ­¨¥ £« ¢­®£® ®ª­  (¢ë¯®«­ï¥âáï 1 à § ¯à¨ § ¯ã᪥) ***
  167.         xor eax,eax
  168.         mov edx,[sc.work]
  169.         or  edx,(3 shl 24)+0x30000000
  170.         mcall ,(20 shl 16)+800,(20 shl 16)+570,,,caption
  171.  
  172.         ; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
  173.         mov esi,[sc.work_button]
  174.         mcall 8,(5 shl 16)+20,(5 shl 16)+20,3
  175.  
  176.         mov ebx,(30 shl 16)+20
  177.         mov edx,4
  178.         int 0x40
  179.         add ebx,25 shl 16
  180.         mov edx,5
  181.         int 0x40
  182.         add ebx,30 shl 16
  183.         mov edx,6
  184.         int 0x40
  185.         add ebx,25 shl 16
  186.         mov edx,7
  187.         int 0x40
  188.         add ebx,25 shl 16
  189.         mov edx,8
  190.         int 0x40
  191.         add ebx,25 shl 16
  192.         mov edx,9
  193.         int 0x40
  194.         add ebx,25 shl 16
  195.         mov edx,10
  196.         int 0x40
  197.         add ebx,25 shl 16
  198.         mov edx,11
  199.         int 0x40
  200.         add ebx,25 shl 16
  201.         mov edx,12
  202.         int 0x40
  203.  
  204.         call draw_toolbar_i
  205.  
  206.         stdcall [buf2d_draw], buf_0
  207.         stdcall [kosglSwapBuffers]
  208.  
  209.         mcall 12,2
  210. popad
  211.         ret
  212.  
  213.  
  214. align 4
  215. draw_toolbar_i:
  216.         ; *** à¨á®¢ ­¨¥ ¨ª®­®ª ­  ª­®¯ª å ***
  217.         mov edx,(7 shl 16)+7 ;icon new
  218.         mcall 7,[image_data_toolbar],(16 shl 16)+16
  219.  
  220.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  221.         add edx,(25 shl 16) ;icon open
  222.         int 0x40
  223.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  224.         add edx,(25 shl 16) ;icon save
  225.         int 0x40
  226.  
  227.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  228.         add edx,(30 shl 16) ;zoom +
  229.         int 0x40
  230.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  231.         add edx,(25 shl 16) ;zoom -
  232.         int 0x40
  233.  
  234.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  235.         cmp word[opt_light],0
  236.         jne @f
  237.                 add ebx,IMAGE_TOOLBAR_SIZE ;make gray icon
  238.         @@:
  239.         add edx,(25 shl 16) ;light on/off
  240.         int 0x40
  241.         cmp word[opt_light],0
  242.         jne @f
  243.                 sub ebx,IMAGE_TOOLBAR_SIZE
  244.         @@:
  245.  
  246.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  247.         cmp word[opt_cube_box],0
  248.         jne @f
  249.                 add ebx,IMAGE_TOOLBAR_SIZE ;make gray icon
  250.         @@:
  251.         add edx,(25 shl 16) ;box on/off
  252.         int 0x40
  253.         cmp word[opt_cube_box],0
  254.         jne @f
  255.                 sub ebx,IMAGE_TOOLBAR_SIZE
  256.         @@:
  257.  
  258.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  259.         cmp word[opt_auto_rotate],0
  260.         jne @f
  261.                 add ebx,IMAGE_TOOLBAR_SIZE ;make gray icon
  262.         @@:
  263.         add edx,(25 shl 16) ;auto rotate on/off
  264.         int 0x40
  265.         cmp word[opt_auto_rotate],0
  266.         jne @f
  267.                 sub ebx,IMAGE_TOOLBAR_SIZE
  268.         @@:
  269.  
  270.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  271.         add edx,(25 shl 16) ;info voxels
  272.         int 0x40
  273.         add ebx,IMAGE_TOOLBAR_ICON_SIZE
  274.         add edx,(25 shl 16) ;refresh
  275.         int 0x40
  276.         ret
  277.  
  278.  
  279. align 4
  280. key:
  281.         mcall 2
  282.  
  283.         cmp ah,178 ;Up
  284.         jne @f
  285.                 fld dword[angle_x]
  286.                 fadd dword[delt_size]
  287.                 fstp dword[angle_x]
  288.                 call draw_3d
  289.                 stdcall [kosglSwapBuffers]
  290.         @@:
  291.         cmp ah,177 ;Down
  292.         jne @f
  293.                 fld dword[angle_x]
  294.                 fsub dword[delt_size]
  295.                 fstp dword[angle_x]
  296.                 call draw_3d
  297.                 stdcall [kosglSwapBuffers]
  298.         @@:
  299.         cmp ah,176 ;Left
  300.         jne @f
  301.                 fld dword[angle_y]
  302.                 fadd dword[delt_size]
  303.                 fstp dword[angle_y]
  304.                 call draw_3d
  305.                 stdcall [kosglSwapBuffers]
  306.         @@:
  307.         cmp ah,179 ;Right
  308.         jne @f
  309.                 fld dword[angle_y]
  310.                 fsub dword[delt_size]
  311.                 fstp dword[angle_y]
  312.                 call draw_3d
  313.                 stdcall [kosglSwapBuffers]
  314.         @@:
  315.  
  316.         jmp still
  317.  
  318.  
  319. align 4
  320. mouse:
  321.         push eax ebx
  322.         mcall 37,3
  323.         bt eax,0
  324.         jnc .end_m
  325.                 ;mouse l. but. move
  326.                 cmp dword[mouse_drag],1
  327.                 jne .end_m
  328.                 mcall 37,1 ;get mouse coords
  329.                 mov ebx,eax
  330.                 shr ebx,16 ;mouse.x
  331.                 cmp ebx,3d_wnd_l
  332.                 jg @f
  333.                         mov ebx,3d_wnd_l
  334.                 @@:
  335.                 sub ebx,3d_wnd_l
  336.                 cmp ebx,3d_wnd_w
  337.                 jle @f
  338.                         mov ebx,3d_wnd_w
  339.                 @@:
  340.                 and eax,0xffff ;mouse.y
  341.                 cmp eax,3d_wnd_t
  342.                 jg @f
  343.                         mov eax,3d_wnd_t
  344.                 @@:
  345.                 sub eax,3d_wnd_t
  346.                 cmp eax,3d_wnd_h
  347.                 jle @f
  348.                         mov eax,3d_wnd_h
  349.                 @@:
  350.                 finit
  351.                 fild dword[mouse_y]
  352.                 mov [mouse_y],eax
  353.                 fisub dword[mouse_y]
  354.                 fdiv dword[angle_dxm] ;¥á«¨ ªãàá®à ¤¢¨¦¥âáï ¯® ®á¨ y (¢¢¥àå ¨«¨ ¢­¨§) â® ¯®¢®à®â ¤¥« ¥¬ ¢®ªà㣠®á¨ x
  355.                 fadd dword[angle_x]
  356.                 fstp dword[angle_x]
  357.  
  358.                 fild dword[mouse_x]
  359.                 mov [mouse_x],ebx
  360.                 fisub dword[mouse_x]
  361.                 fdiv dword[angle_dym] ;¥á«¨ ªãàá®à ¤¢¨¦¥âáï ¯® ®á¨ x (¢¢¥àå ¨«¨ ¢­¨§) â® ¯®¢®à®â ¤¥« ¥¬ ¢®ªà㣠®á¨ y
  362.                 fadd dword[angle_y]
  363.                 fstp dword[angle_y]
  364.  
  365.                 call draw_3d
  366.                 stdcall [kosglSwapBuffers]
  367.                 jmp .end_d
  368.         .end_m:
  369.         bt eax,16
  370.         jnc @f
  371.                 ;mouse l. but. up
  372.                 mov dword[mouse_drag],0
  373.                 jmp .end_d
  374.         @@:
  375.         bt eax,8
  376.         jnc .end_d
  377.                 ;mouse l. but. press
  378.                 mcall 37,1 ;get mouse coords
  379.                 mov ebx,eax
  380.                 shr ebx,16 ;mouse.x
  381.                 cmp ebx,3d_wnd_l
  382.                 jl .end_d
  383.                 sub ebx,3d_wnd_l
  384.                 cmp ebx,3d_wnd_w
  385.                 jg .end_d
  386.                 and eax,0xffff ;mouse.y
  387.                 cmp eax,3d_wnd_t
  388.                 jl .end_d
  389.                 sub eax,3d_wnd_t
  390.                 cmp eax,3d_wnd_h
  391.                 jg .end_d
  392.                 mov dword[mouse_drag],1
  393.                 mov dword[mouse_x],ebx
  394.                 mov dword[mouse_y],eax
  395.         .end_d:
  396.  
  397.         ;stdcall [kmainmenu_dispatch_cursorevent], [main_menu]
  398.         pop ebx eax
  399.         ret
  400.  
  401. align 4
  402. button:
  403.         mcall 17
  404.         cmp ah,3
  405.         jne @f
  406.                 call but_new_file
  407.         @@:
  408.         cmp ah,4
  409.         jne @f
  410.                 call but_open_file
  411.         @@:
  412.         cmp ah,5
  413.         jne @f
  414.                 call but_save_file
  415.         @@:
  416.         cmp ah,6
  417.         jne @f
  418.                 call but_zoom_p
  419.         @@:
  420.         cmp ah,7
  421.         jne @f
  422.                 call but_zoom_m
  423.         @@:
  424.         cmp ah,8
  425.         jne @f
  426.                 call but_3
  427.         @@:
  428.         cmp ah,9
  429.         jne @f
  430.                 call but_4
  431.         @@:
  432.         cmp ah,10
  433.         jne @f
  434.                 call but_5
  435.         @@:
  436.         cmp ah,11
  437.         jne @f
  438.                 call but_6
  439.         @@:
  440.         cmp ah,12
  441.         jne @f
  442.                 call but_draw_cadr
  443.         @@:
  444.         cmp ah,1
  445.         jne still
  446. .exit:
  447.         stdcall [buf2d_delete],buf_0
  448.         stdcall mem.Free,[image_data_toolbar]
  449.         stdcall mem.Free,[open_file_data]
  450.         stdcall mem.Free,[open_file_ogl]
  451.         mcall -1
  452.  
  453.  
  454. align 4
  455. but_new_file:
  456.         mov dword[angle_x], -30.0
  457.         mov dword[angle_y], 180.0
  458.         mov dword[angle_z], 180.0
  459.         ret
  460.  
  461. align 4
  462. open_file_data dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï ®âªàëâ¨ï ä ©«®¢
  463. open_file_size dd 0 ;à §¬¥à ®âªàë⮣® ä ©« 
  464. open_b rb 560
  465. open_file_ogl dd 0 ;¤«ï § ¯¨á¨ ª®®à¤¨­ â èà ­¥© ¢®ªá¥«¥© ¢ ¯®ª §¥ opengl
  466. v_zoom dd 0
  467.  
  468. align 4
  469. but_open_file:
  470. pushad
  471.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  472.         mov [OpenDialog_data.type],0
  473.         stdcall [OpenDialog_Start],OpenDialog_data
  474.         cmp [OpenDialog_data.status],2
  475.         je .end_open_file
  476.         ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  477.  
  478.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  479.         mov [run_file_70.Function], 5
  480.         mov [run_file_70.Position], 0
  481.         mov [run_file_70.Flags], 0
  482.         mov dword[run_file_70.Count], 0
  483.         mov dword[run_file_70.Buffer], open_b
  484.         mov byte[run_file_70+20], 0
  485.         mov dword[run_file_70.FileName], openfile_path
  486.         mov ebx,run_file_70
  487.         int 0x40
  488.  
  489.         ;mov eax,dword[open_b+32]
  490.         ;mov edi,txt_buf
  491.         ;call conv_int_to_str
  492.         ;notify_window_run txt_buf
  493.  
  494.         mov ecx,dword[open_b+32] ;+32 qword: à §¬¥à ä ©«  ¢ ¡ ©â å
  495.         stdcall mem.ReAlloc,[open_file_data],ecx
  496.         mov [open_file_data],eax
  497.        
  498.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  499.         mov [run_file_70.Function], 0
  500.         mov [run_file_70.Position], 0
  501.         mov [run_file_70.Flags], 0
  502.         mov dword[run_file_70.Count], ecx
  503.         m2m dword[run_file_70.Buffer], dword[open_file_data]
  504.         mov byte[run_file_70+20], 0
  505.         mov dword[run_file_70.FileName], openfile_path
  506.         mov ebx,run_file_70
  507.         int 0x40 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
  508.         cmp ebx,0xffffffff
  509.         je .end_open_file
  510.  
  511.         mov [open_file_size],ebx
  512.         mcall 71,1,openfile_path
  513.  
  514.         mov eax,[open_file_data]
  515.         movzx eax,byte[eax]
  516.         mov dword[v_zoom],eax ;¡¥à¥¬ ¬ áèâ ¡ ¯® 㬮«ç ­¨î
  517.         mov ecx,[open_file_size]
  518.         sub ecx,vox_offs_data
  519.         shr ecx,2
  520.         imul ecx,vox_ogl_size
  521.         add ecx,4 ;ecx = à §¬¥à ¯ ¬ï⨠­¥®¡å®¤¨¬®© ¤«ï à á¯ ª®¢ª¨ ª®®à¤¨­ â
  522.         stdcall mem.ReAlloc,[open_file_ogl],ecx
  523.         or eax,eax
  524.         jz .end_open_file
  525.                 mov [open_file_ogl],eax
  526.                 stdcall buf_vox_obj_create_3d,[open_file_data],eax,0,0,[v_zoom]
  527.                 call draw_cadr_8
  528.         .end_open_file:
  529. popad
  530.         ret
  531.  
  532. ;description:
  533. ; à¨á®¢ ­¨¥ 8-¬¨ ª ¤à®¢ ¯®¤ à §­ë¬¨ 㣫 ¬¨ ¯®¢®à®â 
  534. align 4
  535. draw_cadr_8:
  536.         call but_new_file ;ãáâ ­®¢ª  㣫®¢ ¯®¢®à®â  ¯® 㬮«ç ­¨î
  537.         stdcall [buf2d_clear], buf_0, [buf_0.color] ;ç¨á⨬ ¡ãä¥à
  538.  
  539.         ;à¨á®¢ ­¨¥ 8-¬¨ ª ¤à®¢
  540.         fild dword[rot_angles+4]
  541.         fstp dword[angle_y]
  542.         call draw_3d
  543.         call draw_cadr
  544.         stdcall [buf2d_bit_blt], buf_0, 128, 0, buf_1
  545.  
  546.         fild dword[rot_angles+8]
  547.         fstp dword[angle_y]
  548.         call draw_3d
  549.         call draw_cadr
  550.         stdcall [buf2d_bit_blt], buf_0, 0, 128, buf_1
  551.        
  552.         fild dword[rot_angles+12]
  553.         fstp dword[angle_y]
  554.         call draw_3d
  555.         call draw_cadr
  556.         stdcall [buf2d_bit_blt], buf_0, 128, 128, buf_1
  557.  
  558.         fild dword[rot_angles+16]
  559.         fstp dword[angle_y]
  560.         call draw_3d
  561.         call draw_cadr
  562.         stdcall [buf2d_bit_blt], buf_0, 0, 256, buf_1
  563.        
  564.         fild dword[rot_angles+20]
  565.         fstp dword[angle_y]
  566.         call draw_3d
  567.         call draw_cadr
  568.         stdcall [buf2d_bit_blt], buf_0, 128, 256, buf_1
  569.  
  570.         fild dword[rot_angles+24]
  571.         fstp dword[angle_y]
  572.         call draw_3d
  573.         call draw_cadr
  574.         stdcall [buf2d_bit_blt], buf_0, 0, 384, buf_1
  575.        
  576.         fild dword[rot_angles+28]
  577.         fstp dword[angle_y]
  578.         call draw_3d
  579.         call draw_cadr
  580.         stdcall [buf2d_bit_blt], buf_0, 128, 384, buf_1
  581.  
  582.         ; *** ¯®á«¥¤­¨© ª ¤à ***
  583.         fild dword[rot_angles]
  584.         fstp dword[angle_y]
  585.         call draw_3d
  586.         call draw_cadr
  587.         stdcall [buf2d_bit_blt], buf_0, 0, 0, buf_1
  588.        
  589.         call draw_3d
  590.         ; ***
  591.  
  592.         stdcall [buf2d_draw], buf_0 ;®¡­®¢«ï¥¬ ¡ãä¥à ­  íªà ­¥
  593.         ret
  594.  
  595. align 4
  596. rot_angles dd 180,225,270,315,0,45,90,135
  597.  
  598. align 4
  599. draw_cadr:
  600.         mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
  601.         mov eax,[eax] ;eax -> ZBuffer
  602.         mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf
  603.         mov dword[buf_1],eax
  604.  
  605.         mov dword[buf_1.w],512
  606.         mov dword[buf_1.h],512
  607.         stdcall [buf2d_img_hdiv2],buf_1
  608.         mov dword[buf_1.h],256
  609.         stdcall [buf2d_img_hdiv2],buf_1
  610.         mov dword[buf_1.h],128
  611.         stdcall [buf2d_img_wdiv2],buf_1
  612.         mov dword[buf_1.w],256
  613.         stdcall [buf2d_img_wdiv2],buf_1
  614.         mov dword[buf_1.w],128
  615.         ret
  616.  
  617. align 4
  618. but_save_file:
  619.         pushad
  620.         copy_path open_dialog_name,communication_area_default_path,file_name,0
  621.         mov [OpenDialog_data.type],1
  622.         stdcall [OpenDialog_Start],OpenDialog_data
  623.         cmp [OpenDialog_data.status],2
  624.         je .end_save_file
  625.         ;ª®¤ ¯à¨ 㤠筮¬ ®âªàë⨨ ¤¨ «®£ 
  626.  
  627.         mov eax,70 ;70-ï äã­ªæ¨ï à ¡®â  á ä ©« ¬¨
  628.         mov [run_file_70.Function], 2
  629.         mov [run_file_70.Position], 0
  630.         mov [run_file_70.Flags], 0
  631.         mov ebx, dword[open_file_data]
  632.         ;¯¨è¥¬ ¢ ä ©« ­®¢ë© ¬ áèâ ¡
  633.         mov edx,dword[v_zoom]
  634.         mov byte[ebx],dl
  635.         ;
  636.         mov [run_file_70.Buffer], ebx
  637.         mov ebx,[open_file_size]
  638.         mov dword[run_file_70.Count], ebx ;à §¬¥à ä ©« 
  639.         mov byte[run_file_70+20], 0
  640.         mov dword[run_file_70.FileName], openfile_path
  641.         mov ebx,run_file_70
  642.         int 0x40 ;á®å࠭塞 ä ©«
  643.         ;cmp ebx,0xffffffff
  644.         ;je .end_save_file
  645.         ; ... á®®¡é¥­¨¥ ® ­¥ã¤ ç­®¬ á®åà ­¥­¨¨ ...
  646.  
  647.         .end_save_file:
  648.         popad
  649.         ret
  650.  
  651. align 4
  652. proc but_zoom_p uses eax
  653.     cmp dword[v_zoom],11 ;max=2^11=2048
  654.     jge @f
  655.         inc dword[v_zoom]
  656.         stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom]
  657.                 call draw_3d
  658.                 stdcall [kosglSwapBuffers]
  659.     @@:
  660.     ret
  661. endp
  662.  
  663. align 4
  664. proc but_zoom_m uses eax
  665.     cmp dword[v_zoom],1
  666.     jle @f
  667.         dec dword[v_zoom]
  668.         stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom]
  669.                 call draw_3d
  670.                 stdcall [kosglSwapBuffers]
  671.     @@:
  672.     ret
  673. endp
  674.  
  675. align 4
  676. proc but_3 uses eax ebx ecx edx
  677.         xor word[opt_light],1
  678.         cmp word[opt_light],0
  679.         je @f
  680.                 stdcall [glEnable], GL_LIGHTING
  681.                 stdcall [glEnable], GL_LIGHT0
  682.                 jmp .end_light
  683.         @@:
  684.                 stdcall [glDisable], GL_LIGHTING
  685.                 stdcall [glDisable], GL_LIGHT0
  686.         .end_light:
  687.         call draw_toolbar_i
  688.         call draw_3d
  689.         stdcall [kosglSwapBuffers]
  690.         ret
  691. endp
  692.  
  693. align 4
  694. proc but_4 uses eax ebx ecx edx
  695.         xor word[opt_cube_box],1
  696.         call draw_toolbar_i
  697.         call draw_3d
  698.         stdcall [kosglSwapBuffers]
  699.         ret
  700. endp
  701.  
  702. align 4
  703. proc but_5 uses eax ebx ecx edx
  704.         xor word[opt_auto_rotate],1
  705.         call draw_toolbar_i
  706.         ret
  707. endp
  708.  
  709. align 4
  710. proc but_6 uses eax ebx ecx edx edi
  711.         ;¢ëç¨á«¥­¨¥ áâ â¨á⨪¨ ¯® ¢®ªá¥«ï¬
  712.         mov eax,[open_file_ogl]
  713.         or eax,eax
  714.         jz .end_stat
  715.                 mov ebx,[eax]
  716.                 mov ecx,ebx
  717.                 mov edx,ebx
  718.                 imul ebx,6
  719.                 add eax,4
  720. align 4
  721.                 .cycle_0:
  722.                         bt word[eax+vox_ogl_planes],vox_ogl_gran_z0
  723.                         jc @f
  724.                         dec ebx
  725.                         @@:
  726.                         bt word[eax+vox_ogl_planes],vox_ogl_gran_z1
  727.                         jc @f
  728.                         dec ebx
  729.                         @@:
  730.                         bt word[eax+vox_ogl_planes],vox_ogl_gran_y0
  731.                         jc @f
  732.                         dec ebx
  733.                         @@:
  734.                         bt word[eax+vox_ogl_planes],vox_ogl_gran_y1
  735.                         jc @f
  736.                         dec ebx
  737.                         @@:
  738.                         bt word[eax+vox_ogl_planes],vox_ogl_gran_x0
  739.                         jc @f
  740.                         dec ebx
  741.                         @@:
  742.                         bt word[eax+vox_ogl_planes],vox_ogl_gran_x1
  743.                         jc @f
  744.                         dec ebx
  745.                         @@:
  746.                         add eax,vox_ogl_size
  747.                 loop .cycle_0
  748.  
  749.                 mov eax,edx
  750.                 mov edi,txt_stat_m1.v
  751.                 stdcall convert_int_to_str,20
  752.  
  753.                 mov eax,ebx
  754.                 mov edi,txt_stat_m2.v
  755.                 stdcall convert_int_to_str,20
  756.  
  757.                 stdcall str_n_cat,txt_stat_m1.v,txt_stat_m2,50
  758.                 notify_window_run txt_stat_m1
  759.         .end_stat:
  760.         ret
  761. endp
  762.  
  763. align 4
  764. txt_stat_m1:
  765.         db '‘â â¨á⨪ ',13,10,'‚®ªá¥«¥©: '
  766. .v: rb 70
  767. txt_stat_m2:
  768.         db 13,10,'Žâ®¡à ¦ ¥¬ëå £à ­¥©: '
  769. .v: rb 20
  770.  
  771. align 4
  772. proc but_draw_cadr uses eax ebx ecx edx
  773.         mov ebx,[angle_x]
  774.         mov ecx,[angle_y]
  775.         mov edx,[angle_z]
  776.         call draw_cadr_8
  777.         mov [angle_x],ebx
  778.         mov [angle_y],ecx
  779.         mov [angle_z],edx
  780.         cmp word[opt_auto_rotate],0
  781.         jne @f
  782.                 call draw_3d
  783.                 ;stdcall [kosglSwapBuffers]
  784.         @@:
  785.         ret
  786. endp
  787.  
  788. align 4
  789. draw_3d:
  790.         stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;®ç¨á⨬ ¡ãä¥à æ¢¥â  ¨ £«ã¡¨­ë
  791.         stdcall [glPushMatrix]
  792.  
  793.         cmp word[opt_light],0
  794.         je @f
  795.                 call SetLight
  796.         @@:
  797.         stdcall [glTranslatef], 0.0,0.0,0.5 ;ª®®à¤¨­ âë ¯® ®á¨ z ¤®«¦­ë ¡ëâì ¢ ¯à¥¤¥« å ®â 0.0 ¤® 1.0, ¨­ ç¥ ¨§®¡à ¦¥­¨¥ ¡ã¤¥â ®âᥪ âìáï
  798.                 ;¢®ªá¥«ì­ë© ®¡ê¥ªâ ¨¬¥¥â ª®®à¤¨­ âë ¯® ®áï¬ ®â -0.5 ¤® 0.5, ¯®â®¬ã ¥£® ¤¢¨£ ¥¬ ­  +0.5
  799.                 ;­® ¢á¥ ¦¥ ¯à¨ ¯®¢®à®â å ¡ã¤ãâ ®âᥪ âáï ªà ï, ª®â®àë¥ ¢ë«¥§ãâ §  ¯à¥¤¥«ë ¯«®áª®á⥩ ®âá¥ç¥­¨ï
  800.                 ;¢ ¢¥àᨨ opengl ¯®¤ Win ª®®à¤¨­ âë ¨¤ãâ ®â -1.0 ¤® 1.0 ¯®â®¬ã â ¬ í⮣® ¤¥« âì ­¥ ­ã¦­®
  801.         stdcall [glScalef], [scale], [scale], [scale] ;㢥«¨ç¨¢ ¥¬ ¢®ªá¥«ì­ë© ®¡ê¥ªâ, çâ®-¡ë ­¥ ¡ë« ®ç¥­ì ¬ «¥­ìª¨¬
  802.         stdcall [glScalef], 1.0, 1.0, 0.5 ;çâ®-¡ë ªà ï ®¡ê¥ªâ  ­¥ ¢ë« §¨«¨ §  £à ­¨ ®âá¥ç¥­¨ï
  803.         stdcall [glRotatef], [angle_x],1.0,0.0,0.0
  804.         stdcall [glRotatef], [angle_y],0.0,1.0,0.0
  805.         stdcall [glRotatef], [angle_z],0.0,0.0,1.0
  806.         stdcall draw_voxels_3d,[open_file_ogl]
  807.  
  808.         stdcall [glPopMatrix]
  809. ret
  810.  
  811. align 4
  812. proc SetLight
  813.     stdcall [glLightfv], GL_LIGHT0, GL_POSITION, light_position
  814.     stdcall [glLightfv], GL_LIGHT0, GL_SPOT_DIRECTION, light_dir
  815.  
  816.     stdcall [glLightfv], GL_LIGHT0, GL_DIFFUSE, white_light
  817.     stdcall [glLightfv], GL_LIGHT0, GL_SPECULAR, white_light
  818.  
  819.     stdcall [glEnable], GL_COLOR_MATERIAL
  820.     stdcall [glColorMaterial], GL_FRONT, GL_AMBIENT_AND_DIFFUSE
  821.     stdcall [glMaterialfv], GL_FRONT, GL_SPECULAR, mat_specular
  822.     stdcall [glMaterialf], GL_FRONT, GL_SHININESS, mat_shininess
  823.     stdcall [glLightModelfv], GL_LIGHT_MODEL_AMBIENT, lmodel_ambient
  824.  
  825.     stdcall [glEnable], GL_LIGHTING
  826.     stdcall [glEnable], GL_LIGHT0
  827.    
  828.     ;;;stdcall [glLightModeli], GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE
  829.     ret
  830. endp
  831.  
  832. align 4
  833. proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword
  834. pushad
  835.         mov esi,[buf_rgb]
  836.         mov edi,[buf_g24]
  837.         mov ecx,[pixels]
  838.         mov ebx,3
  839. align 4
  840.         @@:
  841.                 movzx eax,byte[esi]
  842.                 movzx edx,byte[esi+1]
  843.                 add eax,edx
  844.                 movzx edx,byte[esi+2]
  845.                 add eax,edx
  846.                 xor edx,edx
  847.                 div ebx ;shr eax,2
  848.                 mov ah,al
  849.                 mov word[edi],ax
  850.                 mov byte[edi+2],al
  851.                 add esi,3
  852.                 add edi,3
  853.                 loop @b
  854. popad
  855.         ret
  856. endp
  857.  
  858.  
  859. ;¤ ­­ë¥ ¤«ï ¤¨ «®£  ®âªàëâ¨ï ä ©«®¢
  860. align 4
  861. OpenDialog_data:
  862. .type                   dd 0 ;0 - ®âªàëâì, 1 - á®åà ­¨âì, 2 - ¢ë¡à âì ¤â४â®à¨î
  863. .procinfo               dd procinfo     ;+4
  864. .com_area_name          dd communication_area_name      ;+8
  865. .com_area               dd 0    ;+12
  866. .opendir_path           dd plugin_path  ;+16
  867. .dir_default_path       dd default_dir ;+20
  868. .start_path             dd file_name ;+24 ¯ãâì ª ¤¨ «®£ã ®âªàëâ¨ï ä ©«®¢
  869. .draw_window            dd draw_window  ;+28
  870. .status                 dd 0    ;+32
  871. .openfile_path          dd openfile_path        ;+36 ¯ãâì ª ®âªà뢠¥¬®¬ã ä ©«ã
  872. .filename_area          dd filename_area        ;+40
  873. .filter_area            dd Filter
  874. .x:
  875. .x_size                 dw 420 ;+48 ; Window X size
  876. .x_start                dw 10 ;+50 ; Window X position
  877. .y:
  878. .y_size                 dw 320 ;+52 ; Window y size
  879. .y_start                dw 10 ;+54 ; Window Y position
  880.  
  881. default_dir db '/rd/1',0
  882.  
  883. communication_area_name:
  884.         db 'FFFFFFFF_open_dialog',0
  885. open_dialog_name:
  886.         db 'opendial',0
  887. communication_area_default_path:
  888.         db '/rd/1/File managers/',0
  889.  
  890. Filter:
  891. dd Filter.end - Filter ;.1
  892. .1:
  893. db 'VOX',0
  894. db 'TXT',0
  895. .end:
  896. db 0
  897.  
  898.  
  899.  
  900. head_f_i:
  901. head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
  902.  
  903. system_dir_0 db '/sys/lib/'
  904. lib_name_0 db 'proc_lib.obj',0
  905. err_message_found_lib_0 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,0
  906. err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,0
  907.  
  908. system_dir_1 db '/sys/lib/'
  909. lib_name_1 db 'libimg.obj',0
  910. err_message_found_lib_1 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,0
  911. err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0
  912.  
  913. system_dir_2 db '/sys/lib/'
  914. lib_name_2 db 'buf2d.obj',0
  915. err_msg_found_lib_2 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0
  916. err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0
  917.  
  918. l_libs_start:
  919.         lib_0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
  920.                 err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
  921.         lib_1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
  922.                 err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
  923.         lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\
  924.                 err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i
  925.         lib_3 l_libs lib_name_3, sys_path, library_path, system_dir_3,\
  926.                 err_msg_found_lib_3,head_f_l,import_lib_tinygl,err_msg_import_3,head_f_i
  927. l_libs_end:
  928.  
  929. align 4
  930. import_libimg:
  931.         dd alib_init1
  932.         img_is_img  dd aimg_is_img
  933.         img_info    dd aimg_info
  934.         img_from_file dd aimg_from_file
  935.         img_to_file dd aimg_to_file
  936.         img_from_rgb dd aimg_from_rgb
  937.         img_to_rgb  dd aimg_to_rgb
  938.         img_to_rgb2 dd aimg_to_rgb2
  939.         img_decode  dd aimg_decode
  940.         img_encode  dd aimg_encode
  941.         img_create  dd aimg_create
  942.         img_destroy dd aimg_destroy
  943.         img_destroy_layer dd aimg_destroy_layer
  944.         img_count   dd aimg_count
  945.         img_lock_bits dd aimg_lock_bits
  946.         img_unlock_bits dd aimg_unlock_bits
  947.         img_flip    dd aimg_flip
  948.         img_flip_layer dd aimg_flip_layer
  949.         img_rotate  dd aimg_rotate
  950.         img_rotate_layer dd aimg_rotate_layer
  951.         img_draw    dd aimg_draw
  952.  
  953.         dd 0,0
  954.         alib_init1   db 'lib_init',0
  955.         aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
  956.         aimg_info    db 'img_info',0
  957.         aimg_from_file db 'img_from_file',0
  958.         aimg_to_file db 'img_to_file',0
  959.         aimg_from_rgb db 'img_from_rgb',0
  960.         aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
  961.         aimg_to_rgb2 db 'img_to_rgb2',0
  962.         aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
  963.         aimg_encode  db 'img_encode',0
  964.         aimg_create  db 'img_create',0
  965.         aimg_destroy db 'img_destroy',0
  966.         aimg_destroy_layer db 'img_destroy_layer',0
  967.         aimg_count   db 'img_count',0
  968.         aimg_lock_bits db 'img_lock_bits',0
  969.         aimg_unlock_bits db 'img_unlock_bits',0
  970.         aimg_flip    db 'img_flip',0
  971.         aimg_flip_layer db 'img_flip_layer',0
  972.         aimg_rotate  db 'img_rotate',0
  973.         aimg_rotate_layer db 'img_rotate_layer',0
  974.         aimg_draw    db 'img_draw',0
  975.  
  976. align 4
  977. proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
  978.         OpenDialog_Init dd aOpenDialog_Init
  979.         OpenDialog_Start dd aOpenDialog_Start
  980. dd 0,0
  981.         aOpenDialog_Init db 'OpenDialog_init',0
  982.         aOpenDialog_Start db 'OpenDialog_start',0
  983.  
  984. align 4
  985. import_buf2d:
  986.         init dd sz_init
  987.         buf2d_create dd sz_buf2d_create
  988.         buf2d_create_f_img dd sz_buf2d_create_f_img
  989.         buf2d_clear dd sz_buf2d_clear
  990.         buf2d_draw dd sz_buf2d_draw
  991.         buf2d_delete dd sz_buf2d_delete
  992.         buf2d_line dd sz_buf2d_line
  993.         buf2d_rect_by_size dd sz_buf2d_rect_by_size
  994.         buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
  995.         buf2d_circle dd sz_buf2d_circle
  996.         buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
  997.         buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
  998.         buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
  999.         buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
  1000.         buf2d_bit_blt dd sz_buf2d_bit_blt
  1001.         buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
  1002.         buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
  1003.         buf2d_curve_bezier dd sz_buf2d_curve_bezier
  1004.         buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
  1005.         buf2d_draw_text dd sz_buf2d_draw_text
  1006.         buf2d_crop_color dd sz_buf2d_crop_color
  1007.         buf2d_offset_h dd sz_buf2d_offset_h
  1008.         buf2d_flood_fill dd sz_buf2d_flood_fill
  1009.         buf2d_set_pixel dd sz_buf2d_set_pixel
  1010.         dd 0,0
  1011.         sz_init db 'lib_init',0
  1012.         sz_buf2d_create db 'buf2d_create',0
  1013.         sz_buf2d_create_f_img db 'buf2d_create_f_img',0
  1014.         sz_buf2d_clear db 'buf2d_clear',0
  1015.         sz_buf2d_draw db 'buf2d_draw',0
  1016.         sz_buf2d_delete db 'buf2d_delete',0
  1017.         sz_buf2d_line db 'buf2d_line',0
  1018.         sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
  1019.         sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
  1020.         sz_buf2d_circle db 'buf2d_circle',0
  1021.         sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
  1022.         sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
  1023.         sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
  1024.         sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
  1025.         sz_buf2d_bit_blt db 'buf2d_bit_blt',0
  1026.         sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
  1027.         sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
  1028.         sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
  1029.         sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
  1030.         sz_buf2d_draw_text db 'buf2d_draw_text',0
  1031.         sz_buf2d_crop_color db 'buf2d_crop_color',0
  1032.         sz_buf2d_offset_h db 'buf2d_offset_h',0
  1033.         sz_buf2d_flood_fill db 'buf2d_flood_fill',0
  1034.         sz_buf2d_set_pixel db 'buf2d_set_pixel',0
  1035.  
  1036. ;--------------------------------------------------
  1037. align 4
  1038. import_lib_tinygl:
  1039.  
  1040. macro E_LIB n
  1041. {
  1042.         n dd sz_#n
  1043. }
  1044. include '../../../../programs/develop/libraries/TinyGL/asm_fork/export.inc'
  1045.         dd 0,0
  1046. macro E_LIB n
  1047. {
  1048.         sz_#n db `n,0
  1049. }
  1050. include '../../../../programs/develop/libraries/TinyGL/asm_fork/export.inc'
  1051.  
  1052. ;--------------------------------------------------
  1053. system_dir_3 db '/sys/lib/'
  1054. lib_name_3 db 'tinygl.obj',0
  1055. err_msg_found_lib_3 db '¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'tinygl.obj',39,0
  1056. err_msg_import_3 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'tinygl',39,0
  1057. ;--------------------------------------------------
  1058.  
  1059. last_time dd 0
  1060.  
  1061. align 4
  1062. buf_0: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  1063.         dw 530 ;+4 left
  1064.         dw 30 ;+6 top
  1065. .w: dd 256 ;+8 w
  1066. .h: dd 512 ;+12 h
  1067. .color: dd 0xffffd0 ;+16 color
  1068.         db 24 ;+20 bit in pixel
  1069.  
  1070. align 4
  1071. buf_1: dd 0 ;㪠§ â¥«ì ­  ¡ãä¥à ¨§®¡à ¦¥­¨ï
  1072.         dw 0 ;+4 left
  1073.         dw 0 ;+6 top
  1074. .w: dd 512 ;+8 w
  1075. .h: dd 512 ;+12 h
  1076. .color: dd 0xffffff ;+16 color
  1077.         db 24 ;+20 bit in pixel
  1078.  
  1079. align 4
  1080. ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
  1081. ;sizeof.TinyGLContext = 28
  1082.  
  1083. scale dd 1.414213562
  1084. angle_x dd 0.0
  1085. angle_y dd 0.0
  1086. angle_z dd 0.0
  1087. delt_size dd 3.0
  1088. mouse_drag dd 0 ;०¨¬ ¯®¢®à®â  áæ¥­ë ®â ¯¥à¥¬¥é¥­¨¨ ªãàá®à  ¬ëè¨
  1089. mouse_x dd 0
  1090. mouse_y dd 0
  1091. angle_dxm dd 2.8444 ;~ 3d_wnd_w/180 - ¯à¨¡ ¢«¥­¨¥ 㣫®¢ ¯®¢®à®â  áæ¥­ë ¯à¨ ¢à é¥­¨¨ ¬ë襩
  1092. angle_dym dd 2.8444 ;~ 3d_wnd_h/180
  1093.  
  1094. opt_light dw 0 ;®¯æ¨ï ¤«ï ¢ª«î祭¨ï/¢ëª«î祭¨ï ᢥâ 
  1095. opt_cube_box dw 1 ;®¯æ¨ï ¤«ï à¨á®¢ ­¨ï à ¬ª¨ ¢®ªà㣠®¡ê¥ªâ 
  1096. opt_auto_rotate dw 0 ;®¯æ¨ï ¤«ï  ¢â®¬ â¨ç¥áª®£® ¯®¢®à®â  ®¡ê¥ªâ 
  1097.  
  1098. light_position dd 0.0, 0.0, 2.0, 1.0 ;  á¯®«®¦¥­¨¥ ¨áâ®ç­¨ª  [0][1][2]
  1099.         ;[3] = (0.0 - ¡¥áª®­¥ç­® 㤠«¥­­ë© ¨áâ®ç­¨ª, 1.0 - ¨áâ®ç­¨ª á¢¥â  ­  ®¯à¥¤¥«¥­­®¬ à ááâ®ï­¨¨)
  1100. light_dir dd 0.0,0.0,0.0 ;­ ¯à ¢«¥­¨¥ « ¬¯ë
  1101.  
  1102. mat_specular dd 0.3, 0.3, 0.3, 1.0 ; –¢¥â ¡«¨ª 
  1103. mat_shininess dd 3.0 ;  §¬¥à ¡«¨ª  (®¡à â­ ï ¯à®¯®àæ¨ï)
  1104. white_light dd 0.8, 0.8, 0.8, 1.0 ; –¢¥â ¨ ¨­â¥­á¨¢­®áâì ®á¢¥é¥­¨ï, £¥­¥à¨à㥬®£® ¨áâ®ç­¨ª®¬
  1105. lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ;  à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
  1106.  
  1107.  
  1108. align 16
  1109. i_end:
  1110.         rb 4096
  1111. stacktop:
  1112.         sys_path rb 1024
  1113.         file_name rb 2048
  1114.         library_path rb 1024
  1115.         plugin_path rb 4096
  1116.         openfile_path rb 4096
  1117.         filename_area rb 256
  1118.         sc system_colors
  1119.         procinfo process_information
  1120.         run_file_70 FileInfoBlock
  1121. mem:
  1122.