Subversion Repositories Kolibri OS

Rev

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

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