Rev 7193 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2748 | IgorA | 1 | use32 |
7205 | IgorA | 2 | org 0 |
2748 | IgorA | 3 | db 'MENUET01' ;идентиф. исполняемого файла всегда 8 байт |
7193 | IgorA | 4 | dd 1, start, i_end, mem, stacktop, openfile_path, sys_path |
2748 | IgorA | 5 | |
2759 | IgorA | 6 | include '../../../../programs/macros.inc' |
7 | include '../../../../programs/proc32.inc' |
||
6247 | IgorA | 8 | include '../../../../programs/KOSfuncs.inc' |
9 | include '../../../../programs/load_img.inc' |
||
2748 | IgorA | 10 | include 'vox_draw.inc' |
3969 | IgorA | 11 | include 'vox_rotate.inc' |
5390 | IgorA | 12 | include 'str.inc' |
2748 | IgorA | 13 | |
14 | @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load |
||
7205 | IgorA | 15 | caption db 'Voxel editor 22.03.18',0 ;подпись окна |
2748 | IgorA | 16 | |
17 | IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3 |
||
18 | image_data_toolbar dd 0 |
||
2933 | IgorA | 19 | cursors_count equ 4 |
2748 | IgorA | 20 | |
2876 | IgorA | 21 | ;значения задаваемые по умолчанию, без ini файла |
22 | ini_def_window_t equ 10 |
||
23 | ini_def_window_l equ 10 |
||
24 | ini_def_window_w equ 550 |
||
25 | ini_def_window_h equ 415 |
||
26 | ini_def_buf_w equ 198 ;=192+6 |
||
27 | ini_def_buf_h equ 231 ;=224+7 |
||
28 | ini_def_s_zoom equ 5 |
||
29 | ini_def_t_size equ 10 |
||
30 | ini_def_color_b equ 0xffffff |
||
31 | ;описание параматров для ini файла |
||
32 | ini_name db 'vox_editor.ini',0 |
||
33 | ini_sec_window db 'Window',0 |
||
34 | key_window_t db 't',0 |
||
35 | key_window_l db 'l',0 |
||
36 | key_window_w db 'w',0 |
||
37 | key_window_h db 'h',0 |
||
38 | key_buf_w db 'buf_w',0 |
||
39 | key_buf_h db 'buf_h',0 |
||
40 | ini_sec_options db 'Options',0 |
||
41 | key_s_zoom db 's_zoom',0 |
||
42 | key_t_size db 'tile_size',0 |
||
43 | key_f_size db 'file_size',0 |
||
44 | key_col_b db 'c_background',0 |
||
2748 | IgorA | 45 | |
46 | OT_MAP_X equ 0 |
||
47 | OT_MAP_Y equ 0 |
||
2758 | IgorA | 48 | OT_CAPT_X_COLOR equ 5 ;отступ для подписи цвета |
49 | OT_CAPT_Y_COLOR equ 30 |
||
2933 | IgorA | 50 | PEN_MODE_NONE equ -1 |
51 | PEN_MODE_CLEAR equ 0 ;режим стирания |
||
2883 | IgorA | 52 | PEN_MODE_SELECT_COLOR equ 2 ;режим выбора цвета |
3047 | IgorA | 53 | PEN_MODE_BRUSH equ 3 ;режим работы с кистью |
2748 | IgorA | 54 | |
6247 | IgorA | 55 | run_file_70 FileInfoBlock |
56 | |||
2748 | IgorA | 57 | align 4 |
58 | start: |
||
59 | load_libraries l_libs_start,l_libs_end |
||
6247 | IgorA | 60 | ;проверка на сколько удачно загузились библиотеки |
61 | mov ebp,lib_0 |
||
62 | .test_lib_open: |
||
2748 | IgorA | 63 | cmp dword [ebp+ll_struc_size-4],0 |
64 | jz @f |
||
6247 | IgorA | 65 | mcall SF_TERMINATE_PROCESS ;exit not correct |
2748 | IgorA | 66 | @@: |
6247 | IgorA | 67 | add ebp,ll_struc_size |
68 | cmp ebp,l_libs_end |
||
69 | jl .test_lib_open |
||
70 | mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors |
||
71 | mcall SF_SET_EVENTS_MASK,0xC0000027 |
||
2748 | IgorA | 72 | stdcall [OpenDialog_Init],OpenDialog_data ;подготовка диалога |
73 | |||
2876 | IgorA | 74 | ;--- load ini file --- |
75 | copy_path ini_name,sys_path,file_name,0 |
||
76 | ;window startup pozition |
||
77 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_l,ini_def_window_l |
||
78 | mov word[wnd_s_pos+2],ax |
||
79 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_w,ini_def_window_w |
||
80 | mov word[wnd_s_pos],ax |
||
81 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_t,ini_def_window_t |
||
82 | mov word[wnd_s_pos+6],ax |
||
83 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_window_h,ini_def_window_h |
||
84 | mov word[wnd_s_pos+4],ax |
||
85 | ;image buffer size |
||
86 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_buf_w,ini_def_buf_w |
||
87 | mov [buf_0.w],eax |
||
88 | mov [buf_0z.w],eax |
||
89 | add ax,15 |
||
90 | mov [buf_pl.l],ax ;отступ для правого окна |
||
91 | stdcall dword[ini_get_int],file_name,ini_sec_window,key_buf_h,ini_def_buf_h |
||
92 | mov [buf_0.h],eax |
||
93 | mov [buf_0z.h],eax |
||
94 | ;цвет фона |
||
95 | stdcall dword[ini_get_color],file_name,ini_sec_window,key_col_b,ini_def_color_b |
||
96 | mov [buf_0.color],eax |
||
97 | mov [buf_pl.color],eax |
||
98 | |||
99 | ;мастаб, после которого будет увеличение |
||
100 | stdcall dword[ini_get_int],file_name,ini_sec_options,key_s_zoom,ini_def_s_zoom |
||
101 | mov [scaled_zoom],eax |
||
102 | ;размер квадратика на плоскости сечения |
||
103 | stdcall dword[ini_get_int],file_name,ini_sec_options,key_t_size,ini_def_t_size |
||
104 | mov [tile_size],eax |
||
105 | |||
106 | stdcall dword[ini_get_int],file_name,ini_sec_options,key_f_size,64 |
||
107 | shl eax,10 |
||
108 | mov [max_open_file_size],eax |
||
109 | |||
110 | mov ecx,[scaled_zoom] |
||
111 | xor eax,eax |
||
112 | inc eax |
||
113 | shl eax,cl |
||
114 | imul eax,[tile_size] |
||
115 | mov [buf_pl.w],eax |
||
116 | add eax,[tile_size] |
||
117 | mov [buf_pl.h],eax |
||
118 | |||
2933 | IgorA | 119 | ;*** загрузка курсоров |
7205 | IgorA | 120 | include_image_file 'cursors_gr.png',image_data_toolbar |
2933 | IgorA | 121 | stdcall [buf2d_create_f_img], buf_curs_8,[image_data_toolbar] ;создаем буфер |
122 | stdcall mem.Free,[image_data_toolbar] ;освобождаем память |
||
123 | |||
7205 | IgorA | 124 | include_image_file 'cursors.png',image_data_toolbar |
2933 | IgorA | 125 | stdcall [buf2d_create_f_img], buf_curs,[image_data_toolbar] ;создаем буфер |
126 | stdcall mem.Free,[image_data_toolbar] ;освобождаем память |
||
127 | |||
128 | stdcall [buf2d_conv_24_to_8], buf_curs_8,1 ;делаем буфер прозрачности 8бит |
||
129 | stdcall [buf2d_conv_24_to_32],buf_curs,buf_curs_8 ;делаем буфер rgba 32бит |
||
130 | |||
131 | |||
2748 | IgorA | 132 | stdcall [buf2d_create], buf_0 ;создание буфера изображения |
133 | stdcall [buf2d_create], buf_0z ;создание буфера глубины |
||
134 | stdcall [buf2d_create], buf_pl ;создание буфера для сечения |
||
135 | |||
2975 | IgorA | 136 | stdcall [buf2d_vox_brush_create], buf_vox_g3, vox_6_7_z |
137 | stdcall [buf2d_vox_brush_create], buf_vox_g2, vox_6_4_z |
||
2748 | IgorA | 138 | |
7205 | IgorA | 139 | include_image_file 'toolbar.png', image_data_toolbar |
2748 | IgorA | 140 | |
2876 | IgorA | 141 | stdcall mem.Alloc,[max_open_file_size] |
2748 | IgorA | 142 | mov dword[open_file_vox],eax |
143 | |||
144 | call but_new_file |
||
145 | |||
2933 | IgorA | 146 | ;первоначальная установка курсора |
147 | stdcall set_pen_mode,1,0,((9 shl 8)+9) shl 16 ;pen |
||
148 | |||
7193 | IgorA | 149 | ;проверка командной строки |
150 | cmp dword[openfile_path],0 |
||
151 | je @f |
||
152 | call but_open_file_cmd_lin |
||
153 | @@: |
||
154 | |||
2748 | IgorA | 155 | align 4 |
156 | red_win: |
||
157 | call draw_window |
||
158 | |||
159 | align 4 |
||
160 | still: |
||
6247 | IgorA | 161 | mcall SF_WAIT_EVENT |
2748 | IgorA | 162 | |
163 | cmp al,1 |
||
164 | jz red_win |
||
165 | cmp al,2 |
||
166 | jz key |
||
167 | cmp al,3 |
||
168 | jz button |
||
169 | cmp al,6 |
||
170 | jne @f |
||
6247 | IgorA | 171 | mcall SF_THREAD_INFO,procinfo,-1 |
2748 | IgorA | 172 | cmp ax,word[procinfo+4] |
173 | jne @f ;окно не активно |
||
174 | call mouse |
||
175 | @@: |
||
176 | jmp still |
||
177 | |||
178 | align 4 |
||
179 | mouse: |
||
180 | pushad |
||
6247 | IgorA | 181 | mcall SF_MOUSE_GET,SSF_BUTTON |
2758 | IgorA | 182 | bt eax,1 ;right button |
183 | jnc @f |
||
6247 | IgorA | 184 | mcall SF_MOUSE_GET,SSF_WINDOW_POSITION |
2758 | IgorA | 185 | mov ebx,eax |
186 | shr ebx,16 |
||
187 | and eax,0xffff |
||
188 | stdcall get_buf_color, buf_0 |
||
189 | stdcall get_buf_color, buf_pl |
||
190 | jmp .end_f |
||
191 | @@: |
||
2748 | IgorA | 192 | bt eax,0 ;left button |
193 | jnc .end_f |
||
6247 | IgorA | 194 | mcall SF_MOUSE_GET,SSF_WINDOW_POSITION |
2748 | IgorA | 195 | mov ebx,eax |
2758 | IgorA | 196 | shr ebx,16 |
2748 | IgorA | 197 | and eax,0xffff |
198 | |||
2883 | IgorA | 199 | cmp dword[v_pen_mode],PEN_MODE_SELECT_COLOR |
2748 | IgorA | 200 | jne .end_2 |
201 | stdcall get_buf_color, buf_0 |
||
202 | stdcall get_buf_color, buf_pl |
||
203 | jmp .end_f |
||
204 | .end_2: |
||
205 | |||
2758 | IgorA | 206 | |
207 | push eax ebx |
||
208 | mov edx,[v_zoom] |
||
209 | cmp edx,[scaled_zoom] |
||
210 | jle @f |
||
211 | ;режим масштабирования изображения |
||
212 | sub edx,[scaled_zoom] |
||
213 | sub ax,word[buf_0.t] |
||
214 | sub bx,word[buf_0.l] |
||
2975 | IgorA | 215 | stdcall get_mouse_ev_scale, [buf_vox], ebx, eax, [scaled_zoom],edx |
2758 | IgorA | 216 | cmp eax,0 |
217 | je @f |
||
218 | mov ebx,eax |
||
219 | and eax,0x3fffffff |
||
220 | rol ebx,2 |
||
221 | and ebx,3 |
||
222 | dec ebx |
||
223 | |||
224 | shl ebx,2 |
||
225 | add ebx,cam_x |
||
226 | mov dword[ebx],eax ;change [cam_x] or [cam_y] or [cam_z] |
||
227 | call draw_objects |
||
228 | |||
229 | pop ebx eax |
||
230 | jmp .end_f |
||
231 | @@: |
||
232 | pop ebx eax |
||
233 | |||
234 | |||
235 | ;eax - mouse coord y |
||
236 | ;ebx - mouse coord x |
||
2748 | IgorA | 237 | movzx edx,word[buf_pl.t] |
238 | add edx,OT_MAP_Y |
||
239 | cmp eax,edx |
||
240 | jl .end_f |
||
241 | sub eax,edx |
||
242 | xor edx,edx |
||
2876 | IgorA | 243 | mov ecx,[tile_size] ;H |
2748 | IgorA | 244 | div ecx |
245 | movzx edx,word[buf_pl.l] |
||
246 | add edx,OT_MAP_X |
||
247 | cmp ebx,edx |
||
248 | jl .end_f |
||
249 | call convert_y ;преобразование координаты y |
||
250 | cmp eax,0 |
||
251 | jge .end_0 ;ограничение по нижней координате y |
||
252 | cmp eax,-1 |
||
253 | jne .end_f |
||
254 | ;меняем сечение, попали на квадратик |
||
255 | sub ebx,edx |
||
256 | mov eax,ebx |
||
257 | xor edx,edx |
||
2876 | IgorA | 258 | mov ecx,[tile_size] ;W |
2748 | IgorA | 259 | div ecx |
260 | mov [n_plane],eax |
||
261 | jmp .end_1 |
||
262 | .end_0: |
||
263 | mov [v_cur_y],eax ;Y-coord |
||
264 | sub ebx,edx |
||
265 | mov eax,ebx |
||
266 | xor edx,edx |
||
2876 | IgorA | 267 | mov ecx,[tile_size] ;W |
2748 | IgorA | 268 | div ecx |
269 | mov [v_cur_x],eax ;X-coord |
||
270 | |||
2933 | IgorA | 271 | cmp dword[v_pen_mode],PEN_MODE_CLEAR |
2758 | IgorA | 272 | jl .end_1 |
2748 | IgorA | 273 | cmp dword[v_pen_mode],1 |
2758 | IgorA | 274 | jg .end_1 |
275 | mov eax,[v_cur_x] |
||
276 | mov ebx,[n_plane] |
||
277 | mov edx,[v_cur_y] |
||
2883 | IgorA | 278 | |
2758 | IgorA | 279 | mov ecx,[v_zoom] |
280 | cmp ecx,[scaled_zoom] |
||
281 | jle .no_c_coord_0 |
||
282 | ;преобразование координат, с учетом увеличения |
||
283 | ;sub ecx,[scaled_zoom] ;в ecx прирост масштаба (ecx>0) |
||
284 | mov ecx,[scaled_zoom] |
||
285 | |||
286 | mov edi,[cam_x] |
||
287 | shl edi,cl |
||
288 | add eax,edi |
||
289 | mov edi,[cam_y] |
||
290 | shl edi,cl |
||
291 | add ebx,edi |
||
292 | mov edi,[cam_z] |
||
293 | shl edi,cl |
||
294 | add edx,edi |
||
295 | .no_c_coord_0: |
||
296 | |||
297 | ;отличающийся параметр для функции создания вокселя |
||
298 | cmp dword[v_pen_mode],1 |
||
299 | jne @f |
||
300 | push dword[v_color] |
||
301 | @@: |
||
302 | |||
3047 | IgorA | 303 | mov ecx,dword[v_zoom] |
304 | mov edi,eax |
||
305 | mov esi,ebx |
||
6247 | IgorA | 306 | mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS |
3047 | IgorA | 307 | and eax,3 ;3 -> бит 0 левый Shift нажат, бит 1 правый Shift нажат |
308 | jz .shift_end |
||
309 | ;если нажат Shift, то редактируем на верхнем уровне |
||
310 | ;для этого все координаты делим на 2 а от мастаба отнимаем 1 |
||
311 | shr edx,1 |
||
312 | shr esi,1 |
||
313 | shr edi,1 |
||
314 | dec ecx |
||
315 | .shift_end: |
||
316 | |||
317 | ;вызов общих параметров для функций |
||
318 | push ecx edx esi edi |
||
2758 | IgorA | 319 | push dword[open_file_vox] |
320 | |||
321 | ;вызов функций |
||
322 | cmp dword[v_pen_mode],1 |
||
323 | jne @f |
||
324 | call buf2d_vox_obj_create_node |
||
3047 | IgorA | 325 | ;stdcall buf2d_vox_obj_create_node, [open_file_vox], edi,esi,edx, [v_zoom], [v_color] |
2758 | IgorA | 326 | jmp .end_1 |
327 | @@: |
||
328 | call buf2d_vox_obj_delete_node |
||
3047 | IgorA | 329 | ;stdcall buf2d_vox_obj_delete_node, [open_file_vox], edi,esi,edx, [v_zoom] |
2758 | IgorA | 330 | |
2748 | IgorA | 331 | .end_1: |
332 | call draw_objects |
||
333 | call draw_pok |
||
334 | .end_f: |
||
335 | popad |
||
336 | ret |
||
337 | |||
2758 | IgorA | 338 | ;input: |
339 | ; eax - coord y |
||
340 | ; ebx - coord x |
||
2748 | IgorA | 341 | align 4 |
2758 | IgorA | 342 | proc get_buf_color, buf:dword |
343 | pushad |
||
2748 | IgorA | 344 | mov edi,[buf] |
345 | cmp ax,buf2d_t |
||
346 | jl .end_f |
||
347 | sub ax,buf2d_t |
||
348 | cmp eax,buf2d_h |
||
349 | jg .end_f |
||
350 | cmp bx,buf2d_l |
||
351 | jl .end_f |
||
352 | sub bx,buf2d_l |
||
353 | cmp ebx,buf2d_w |
||
354 | jg .end_f |
||
355 | stdcall [buf2d_get_pixel], edi,ebx,eax |
||
356 | mov [v_color],eax |
||
2759 | IgorA | 357 | call on_change_color ;отображаем изменения цвета |
2748 | IgorA | 358 | .end_f: |
2758 | IgorA | 359 | popad |
2748 | IgorA | 360 | ret |
361 | endp |
||
362 | |||
363 | ;преобразовываем координату y (значение должно увеличиваться с низу вверх) |
||
364 | align 4 |
||
365 | convert_y: |
||
366 | push ecx edx |
||
367 | mov ecx,[v_zoom] |
||
2758 | IgorA | 368 | cmp ecx,[scaled_zoom] |
369 | jle @f |
||
370 | mov ecx,[scaled_zoom] |
||
371 | @@: |
||
2748 | IgorA | 372 | mov edx,1 |
373 | cmp ecx,1 |
||
2758 | IgorA | 374 | jl @f |
375 | shl edx,cl |
||
2748 | IgorA | 376 | @@: |
377 | sub edx,eax |
||
378 | dec edx |
||
379 | mov eax,edx |
||
380 | pop edx ecx |
||
381 | ret |
||
382 | |||
383 | align 4 |
||
384 | draw_window: |
||
385 | pushad |
||
6247 | IgorA | 386 | mcall SF_REDRAW,SSF_BEGIN_DRAW |
2748 | IgorA | 387 | |
388 | ; *** рисование главного окна (выполняется 1 раз при запуске) *** |
||
389 | mov edx,[sc.work] |
||
390 | or edx,(3 shl 24)+0x30000000 |
||
391 | mov edi,caption |
||
6247 | IgorA | 392 | mcall SF_CREATE_WINDOW,dword[wnd_s_pos],dword[wnd_s_pos+4] |
2748 | IgorA | 393 | |
394 | ; *** создание кнопок на панель *** |
||
6247 | IgorA | 395 | mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3,[sc.work_button] |
2748 | IgorA | 396 | |
397 | mov ebx,(30 shl 16)+20 |
||
5390 | IgorA | 398 | inc edx |
2748 | IgorA | 399 | int 0x40 |
400 | add ebx,25 shl 16 |
||
5390 | IgorA | 401 | inc edx |
2748 | IgorA | 402 | int 0x40 |
403 | add ebx,30 shl 16 |
||
5390 | IgorA | 404 | inc edx |
2748 | IgorA | 405 | int 0x40 |
406 | add ebx,25 shl 16 |
||
5390 | IgorA | 407 | inc edx |
2748 | IgorA | 408 | int 0x40 |
409 | add ebx,25 shl 16 |
||
5390 | IgorA | 410 | inc edx |
2748 | IgorA | 411 | int 0x40 |
412 | add ebx,25 shl 16 |
||
5390 | IgorA | 413 | inc edx |
2748 | IgorA | 414 | int 0x40 |
415 | add ebx,25 shl 16 |
||
5390 | IgorA | 416 | inc edx |
2748 | IgorA | 417 | int 0x40 |
418 | add ebx,25 shl 16 |
||
5390 | IgorA | 419 | inc edx |
2748 | IgorA | 420 | int 0x40 |
421 | add ebx,25 shl 16 |
||
5390 | IgorA | 422 | inc edx |
2748 | IgorA | 423 | int 0x40 |
424 | add ebx,25 shl 16 |
||
5390 | IgorA | 425 | inc edx |
2748 | IgorA | 426 | int 0x40 |
427 | add ebx,25 shl 16 |
||
5390 | IgorA | 428 | inc edx |
2748 | IgorA | 429 | int 0x40 |
430 | add ebx,25 shl 16 |
||
5390 | IgorA | 431 | inc edx |
2748 | IgorA | 432 | int 0x40 |
433 | add ebx,25 shl 16 |
||
5390 | IgorA | 434 | inc edx |
2748 | IgorA | 435 | int 0x40 |
2883 | IgorA | 436 | add ebx,25 shl 16 |
5390 | IgorA | 437 | inc edx |
2883 | IgorA | 438 | int 0x40 |
439 | add ebx,25 shl 16 |
||
5390 | IgorA | 440 | inc edx |
2883 | IgorA | 441 | int 0x40 |
442 | add ebx,25 shl 16 |
||
5390 | IgorA | 443 | inc edx |
2883 | IgorA | 444 | int 0x40 |
445 | add ebx,25 shl 16 |
||
5390 | IgorA | 446 | inc edx |
2883 | IgorA | 447 | int 0x40 |
448 | add ebx,25 shl 16 |
||
5390 | IgorA | 449 | inc edx |
2883 | IgorA | 450 | int 0x40 |
451 | add ebx,25 shl 16 |
||
5390 | IgorA | 452 | inc edx |
2883 | IgorA | 453 | int 0x40 |
454 | add ebx,25 shl 16 |
||
5390 | IgorA | 455 | inc edx |
2883 | IgorA | 456 | int 0x40 |
2974 | IgorA | 457 | add ebx,25 shl 16 |
5390 | IgorA | 458 | inc edx |
2974 | IgorA | 459 | int 0x40 |
2975 | IgorA | 460 | add ebx,25 shl 16 |
5390 | IgorA | 461 | inc edx |
2975 | IgorA | 462 | int 0x40 |
3969 | IgorA | 463 | add ebx,25 shl 16 |
5390 | IgorA | 464 | inc edx |
3969 | IgorA | 465 | int 0x40 |
5390 | IgorA | 466 | add ebx,25 shl 16 |
467 | inc edx |
||
468 | int 0x40 |
||
469 | add ebx,25 shl 16 |
||
470 | inc edx |
||
471 | int 0x40 |
||
472 | add ebx,25 shl 16 |
||
473 | inc edx |
||
474 | int 0x40 |
||
2748 | IgorA | 475 | |
476 | ; *** рисование иконок на кнопках *** |
||
6247 | IgorA | 477 | mcall SF_PUT_IMAGE,[image_data_toolbar],(16 shl 16)+16,(7 shl 16)+7 ;icon new |
2748 | IgorA | 478 | |
479 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
480 | add edx,(25 shl 16) ;icon open |
||
481 | int 0x40 |
||
482 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
483 | add edx,(25 shl 16) ;icon save |
||
484 | int 0x40 |
||
485 | |||
486 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 487 | add edx,(30 shl 16) ;увелич. масштаб |
2748 | IgorA | 488 | int 0x40 |
489 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 490 | add edx,(25 shl 16) ;уменьш. масштаб |
2748 | IgorA | 491 | int 0x40 |
492 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2975 | IgorA | 493 | add edx,(25 shl 16) ;camera 3g 2g |
494 | int 0x40 |
||
495 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
3969 | IgorA | 496 | add edx,(25 shl 16) ;поворот z |
2748 | IgorA | 497 | int 0x40 |
498 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
3969 | IgorA | 499 | add edx,(25 shl 16) ;поворот x |
2748 | IgorA | 500 | int 0x40 |
501 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
3969 | IgorA | 502 | add edx,(25 shl 16) ;поворот y |
503 | int 0x40 |
||
504 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 505 | add edx,(25 shl 16) ;сдвиг плоскости + |
2748 | IgorA | 506 | int 0x40 |
507 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 508 | add edx,(25 shl 16) ;сдвиг плоскости - |
2748 | IgorA | 509 | int 0x40 |
510 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 511 | add edx,(25 shl 16) ;инструмент карандаш |
2748 | IgorA | 512 | int 0x40 |
513 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 514 | add edx,(25 shl 16) ;инструмент кисть |
2748 | IgorA | 515 | int 0x40 |
516 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 517 | add edx,(25 shl 16) ;инструмент затирачка |
2748 | IgorA | 518 | int 0x40 |
519 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 520 | add edx,(25 shl 16) ;выбор цвета |
2748 | IgorA | 521 | int 0x40 |
522 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 523 | add edx,(25 shl 16) ;освещение |
2748 | IgorA | 524 | int 0x40 |
2883 | IgorA | 525 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
526 | add edx,(25 shl 16) ;рендер 2*2 |
||
527 | int 0x40 |
||
528 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
529 | add edx,(25 shl 16) ;создать кисть |
||
530 | int 0x40 |
||
531 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
532 | add edx,(25 shl 16) ;нарисовать кисть |
||
533 | int 0x40 |
||
534 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2974 | IgorA | 535 | add edx,(25 shl 16) ;удалить кисть |
536 | int 0x40 |
||
537 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
2883 | IgorA | 538 | add edx,(25 shl 16) ;ширина кисти -1 |
539 | int 0x40 |
||
540 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
541 | add edx,(25 shl 16) ;ширина кисти +1 |
||
542 | int 0x40 |
||
543 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
544 | add edx,(25 shl 16) ;высота кисти -1 |
||
545 | int 0x40 |
||
546 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
547 | add edx,(25 shl 16) ;высота кисти +1 |
||
548 | int 0x40 |
||
5390 | IgorA | 549 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
550 | add edx,(25 shl 16) ;отразить кисть гор. |
||
551 | int 0x40 |
||
552 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
553 | add edx,(25 shl 16) ;отразить кисть вер. |
||
554 | int 0x40 |
||
555 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
556 | add edx,(25 shl 16) ;повернуть кисть 90 гр. |
||
557 | int 0x40 |
||
2748 | IgorA | 558 | |
559 | ; *** рисование буферов *** |
||
560 | call draw_objects |
||
561 | call draw_pok |
||
562 | |||
6247 | IgorA | 563 | mcall SF_REDRAW,SSF_END_DRAW |
2748 | IgorA | 564 | popad |
565 | ret |
||
566 | |||
567 | align 4 |
||
568 | draw_pok: |
||
7193 | IgorA | 569 | mov eax,SF_DRAW_NUMBER |
2748 | IgorA | 570 | mov ecx,[v_zoom] |
2759 | IgorA | 571 | mov ebx,(3 shl 16)+(1 shl 31) |
2883 | IgorA | 572 | mov edx,((350+6*9) shl 16)+OT_CAPT_Y_COLOR+2 |
2748 | IgorA | 573 | mov esi,[sc.work_button_text] |
574 | or esi,(1 shl 30) |
||
575 | mov edi,[sc.work_button] |
||
576 | int 0x40 ;масштаб |
||
577 | mov ecx,[n_plane] |
||
2883 | IgorA | 578 | add edx,115 shl 16 ;9 |
2759 | IgorA | 579 | int 0x40 ;номер сечения |
2748 | IgorA | 580 | |
2883 | IgorA | 581 | ;обновление параметров курсора |
582 | mov dword[txt_curor.size],0 |
||
583 | mov eax,dword[v_cur_x] |
||
584 | mov edi,txt_curor.size |
||
5390 | IgorA | 585 | stdcall convert_int_to_str,10 |
2883 | IgorA | 586 | stdcall str_cat, edi,txt_mull |
587 | mov eax,dword[v_cur_y] |
||
588 | mov edi,txt_buf |
||
5390 | IgorA | 589 | stdcall convert_int_to_str,16 |
2883 | IgorA | 590 | stdcall str_cat, txt_curor.size,edi |
591 | stdcall str_cat, txt_curor.size,txt_space ;завершающий пробел |
||
592 | |||
593 | ;обновление параметров кисти |
||
594 | mov dword[txt_brush.size],0 |
||
595 | mov eax,dword[brush_w] |
||
596 | mov edi,txt_brush.size |
||
5390 | IgorA | 597 | stdcall convert_int_to_str,10 |
2883 | IgorA | 598 | stdcall str_cat, edi,txt_mull |
599 | mov eax,dword[brush_h] |
||
600 | mov edi,txt_buf |
||
5390 | IgorA | 601 | stdcall convert_int_to_str,16 |
2883 | IgorA | 602 | stdcall str_cat, txt_brush.size,edi |
603 | stdcall str_cat, txt_brush.size,txt_space ;завершающий пробел |
||
604 | |||
2758 | IgorA | 605 | mov ecx,[sc.work_text] |
606 | or ecx,0x80000000 ;or (1 shl 30) |
||
607 | mov edx,txt_color |
||
6247 | IgorA | 608 | mcall SF_DRAW_TEXT,(OT_CAPT_X_COLOR shl 16)+OT_CAPT_Y_COLOR+2 |
2758 | IgorA | 609 | |
2883 | IgorA | 610 | mov edx,txt_curor |
611 | add ebx,115 shl 16 |
||
612 | or ecx,(1 shl 30) |
||
613 | mov edi,[sc.work] |
||
614 | int 0x40 |
||
615 | |||
616 | mov edx,txt_brush |
||
617 | add ebx,115 shl 16 |
||
618 | int 0x40 |
||
619 | |||
620 | mov edx,txt_zoom |
||
621 | add ebx,115 shl 16 |
||
622 | int 0x40 |
||
623 | |||
624 | mov edx,txt_n_plane |
||
625 | add ebx,115 shl 16 |
||
626 | int 0x40 |
||
627 | |||
2759 | IgorA | 628 | call on_change_color |
629 | ret |
||
630 | |||
631 | align 4 |
||
632 | on_change_color: |
||
633 | pushad |
||
6247 | IgorA | 634 | mcall SF_DRAW_RECT,((OT_CAPT_X_COLOR+35) shl 16)+16,(OT_CAPT_Y_COLOR shl 16)+12,[v_color] |
2759 | IgorA | 635 | |
636 | mov ecx,edx |
||
637 | mov edx,((OT_CAPT_X_COLOR+55) shl 16)+OT_CAPT_Y_COLOR+2 |
||
638 | mov esi,[sc.work_text] |
||
639 | add esi,(1 shl 30) |
||
640 | mov edi,[sc.work] |
||
6247 | IgorA | 641 | mcall SF_DRAW_NUMBER,(1 shl 8)+(6 shl 16) |
2759 | IgorA | 642 | popad |
2748 | IgorA | 643 | ret |
644 | |||
645 | align 4 |
||
646 | key: |
||
6247 | IgorA | 647 | mcall SF_GET_KEY |
2748 | IgorA | 648 | jmp still |
649 | |||
650 | |||
651 | align 4 |
||
652 | button: |
||
6247 | IgorA | 653 | mcall SF_GET_BUTTON |
2748 | IgorA | 654 | cmp ah,3 |
655 | jne @f |
||
656 | call but_new_file |
||
657 | call draw_objects |
||
658 | call draw_pok |
||
659 | @@: |
||
660 | cmp ah,4 |
||
661 | jne @f |
||
662 | call but_open_file |
||
663 | @@: |
||
664 | cmp ah,5 |
||
665 | jne @f |
||
666 | call but_save_file |
||
667 | @@: |
||
668 | cmp ah,6 |
||
669 | jne @f |
||
2976 | IgorA | 670 | call but_camera_3g_2g |
2748 | IgorA | 671 | @@: |
672 | cmp ah,7 |
||
673 | jne @f |
||
2976 | IgorA | 674 | call but_zoom_p |
2748 | IgorA | 675 | @@: |
676 | cmp ah,8 |
||
677 | jne @f |
||
2976 | IgorA | 678 | call but_zoom_m |
2748 | IgorA | 679 | @@: |
680 | cmp ah,9 |
||
681 | jne @f |
||
3969 | IgorA | 682 | call but_r_z |
2748 | IgorA | 683 | @@: |
684 | cmp ah,10 |
||
685 | jne @f |
||
3969 | IgorA | 686 | call but_r_x |
2748 | IgorA | 687 | @@: |
688 | cmp ah,11 |
||
689 | jne @f |
||
3969 | IgorA | 690 | call but_r_y |
2748 | IgorA | 691 | @@: |
692 | cmp ah,12 |
||
693 | jne @f |
||
3969 | IgorA | 694 | call but_plane_inc |
2748 | IgorA | 695 | @@: |
696 | cmp ah,13 |
||
697 | jne @f |
||
3969 | IgorA | 698 | call but_plane_dec |
2748 | IgorA | 699 | @@: |
700 | cmp ah,14 |
||
701 | jne @f |
||
3969 | IgorA | 702 | call but_mode_pen |
2748 | IgorA | 703 | @@: |
704 | cmp ah,15 |
||
705 | jne @f |
||
3969 | IgorA | 706 | call but_mode_brush |
2975 | IgorA | 707 | @@: |
708 | cmp ah,16 |
||
709 | jne @f |
||
3969 | IgorA | 710 | call but_mode_clear |
711 | @@: |
||
712 | cmp ah,17 |
||
713 | jne @f |
||
2933 | IgorA | 714 | stdcall set_pen_mode,PEN_MODE_SELECT_COLOR,3,((9 shl 8)+9) shl 16 |
2883 | IgorA | 715 | call draw_palete |
2748 | IgorA | 716 | @@: |
3969 | IgorA | 717 | cmp ah,18 |
2748 | IgorA | 718 | jne @f |
2883 | IgorA | 719 | call but_light |
720 | @@: |
||
3969 | IgorA | 721 | cmp ah,19 |
2883 | IgorA | 722 | jne @f |
2748 | IgorA | 723 | call but_rend_2_2 |
724 | @@: |
||
3969 | IgorA | 725 | cmp ah,20 |
2883 | IgorA | 726 | jne @f |
727 | call but_brush_copy |
||
728 | @@: |
||
3969 | IgorA | 729 | cmp ah,21 |
2883 | IgorA | 730 | jne @f |
731 | call but_brush_draw |
||
732 | @@: |
||
3969 | IgorA | 733 | cmp ah,22 |
2883 | IgorA | 734 | jne @f |
2974 | IgorA | 735 | call but_brush_clear |
2883 | IgorA | 736 | @@: |
3969 | IgorA | 737 | cmp ah,23 |
2883 | IgorA | 738 | jne @f |
2974 | IgorA | 739 | call but_bru_w_m |
2883 | IgorA | 740 | @@: |
3969 | IgorA | 741 | cmp ah,24 |
2883 | IgorA | 742 | jne @f |
2974 | IgorA | 743 | call but_bru_w_p |
2883 | IgorA | 744 | @@: |
3969 | IgorA | 745 | cmp ah,25 |
2883 | IgorA | 746 | jne @f |
2974 | IgorA | 747 | call but_bru_h_m |
748 | @@: |
||
3969 | IgorA | 749 | cmp ah,26 |
2974 | IgorA | 750 | jne @f |
2883 | IgorA | 751 | call but_bru_h_p |
752 | @@: |
||
5390 | IgorA | 753 | cmp ah,27 |
754 | jne @f |
||
755 | call but_bru_flip_h |
||
756 | @@: |
||
757 | cmp ah,28 |
||
758 | jne @f |
||
759 | call but_bru_flip_v |
||
760 | @@: |
||
761 | cmp ah,29 |
||
762 | jne @f |
||
763 | call but_bru_rot_90 |
||
764 | @@: |
||
2748 | IgorA | 765 | cmp ah,1 |
766 | jne still |
||
767 | .exit: |
||
768 | stdcall [buf2d_delete],buf_0 |
||
769 | stdcall [buf2d_delete],buf_0z |
||
770 | cmp dword[buf_r_img],0 |
||
771 | je @f |
||
772 | stdcall [buf2d_delete],buf_r_img |
||
773 | stdcall [buf2d_delete],buf_r_z |
||
774 | @@: |
||
2975 | IgorA | 775 | stdcall [buf2d_vox_brush_delete], buf_vox_g3 |
776 | stdcall [buf2d_vox_brush_delete], buf_vox_g2 |
||
2933 | IgorA | 777 | stdcall [buf2d_delete],buf_curs |
778 | stdcall [buf2d_delete],buf_curs_8 |
||
2748 | IgorA | 779 | stdcall mem.Free,[image_data_toolbar] |
780 | stdcall mem.Free,[open_file_vox] |
||
6247 | IgorA | 781 | mcall SF_TERMINATE_PROCESS |
2748 | IgorA | 782 | |
2974 | IgorA | 783 | ;данные для инициализации воксельного объекта |
2748 | IgorA | 784 | align 4 |
785 | vox_new_data: |
||
786 | db 2,0,0,0 |
||
2974 | IgorA | 787 | db 0,1,2,3,4,5,6,7 ;default table |
2748 | IgorA | 788 | dd 0 ;null node |
789 | |||
2974 | IgorA | 790 | ;инициализация воксельного объекта |
2748 | IgorA | 791 | align 4 |
792 | proc but_new_file uses ecx edi esi |
||
793 | mov ecx,vox_offs_data+4 |
||
794 | mov esi,vox_new_data |
||
795 | mov edi,[open_file_vox] |
||
796 | cld |
||
797 | rep movsb |
||
798 | ret |
||
799 | endp |
||
800 | |||
801 | align 4 |
||
802 | open_file_vox dd 0 ;указатель на область для открытия файлов |
||
803 | |||
804 | align 4 |
||
805 | but_open_file: |
||
806 | pushad |
||
807 | copy_path open_dialog_name,communication_area_default_path,file_name,0 |
||
808 | mov [OpenDialog_data.type],0 |
||
809 | stdcall [OpenDialog_Start],OpenDialog_data |
||
810 | cmp [OpenDialog_data.status],2 |
||
811 | je .end_open_file |
||
812 | ;код при удачном открытии диалога |
||
813 | |||
7193 | IgorA | 814 | call but_open_file_cmd_lin |
815 | call draw_objects |
||
816 | .end_open_file: |
||
817 | popad |
||
818 | ret |
||
819 | |||
820 | align 4 |
||
821 | but_open_file_cmd_lin: |
||
822 | pushad |
||
6247 | IgorA | 823 | mov [run_file_70.Function], SSF_GET_INFO |
5390 | IgorA | 824 | mov [run_file_70.Position], 0 |
825 | mov [run_file_70.Flags], 0 |
||
826 | mov dword[run_file_70.Count], 0 |
||
827 | mov dword[run_file_70.Buffer], open_b |
||
828 | mov byte[run_file_70+20], 0 |
||
829 | mov dword[run_file_70.FileName], openfile_path |
||
6247 | IgorA | 830 | mcall SF_FILE,run_file_70 |
5390 | IgorA | 831 | |
832 | mov ecx,dword[open_b+32] ;+32 qword: размер файла в байтах |
||
833 | cmp ecx,[max_open_file_size] ;проверяем размер выделенной памяти |
||
834 | jle @f |
||
835 | mov [max_open_file_size],ecx |
||
836 | stdcall mem.ReAlloc,[open_file_vox],ecx |
||
837 | mov [open_file_vox],eax |
||
838 | notify_window_run txt_need_memory |
||
839 | @@: |
||
840 | |||
6247 | IgorA | 841 | mov [run_file_70.Function], SSF_READ_FILE |
2748 | IgorA | 842 | mov [run_file_70.Position], 0 |
843 | mov [run_file_70.Flags], 0 |
||
5390 | IgorA | 844 | mov dword[run_file_70.Count], ecx |
845 | m2m dword[run_file_70.Buffer], dword[open_file_vox] |
||
2748 | IgorA | 846 | mov byte[run_file_70+20], 0 |
847 | mov dword[run_file_70.FileName], openfile_path |
||
6247 | IgorA | 848 | mcall SF_FILE,run_file_70 |
2748 | IgorA | 849 | cmp ebx,0xffffffff |
850 | je .end_open_file |
||
851 | |||
6247 | IgorA | 852 | mcall SF_SET_CAPTION,1,openfile_path |
2748 | IgorA | 853 | |
854 | ;--- |
||
855 | mov eax,[open_file_vox] |
||
856 | movzx eax,byte[eax] |
||
857 | and eax,0xff ;берем масштаб по умолчанию |
||
858 | mov dword[v_zoom],eax ;берем масштаб по умолчанию |
||
2759 | IgorA | 859 | mov dword[cam_x],0 |
860 | mov dword[cam_y],0 |
||
861 | mov dword[cam_z],0 |
||
2748 | IgorA | 862 | .end_open_file: |
863 | popad |
||
864 | ret |
||
865 | |||
866 | align 4 |
||
867 | but_save_file: |
||
868 | pushad |
||
869 | copy_path open_dialog_name,communication_area_default_path,file_name,0 |
||
870 | mov [OpenDialog_data.type],1 |
||
871 | stdcall [OpenDialog_Start],OpenDialog_data |
||
872 | cmp [OpenDialog_data.status],2 |
||
873 | je .end_save_file |
||
874 | ;код при удачном открытии диалога |
||
875 | |||
876 | mov eax,dword[v_zoom] ;задаем масштаб по умолчанию |
||
877 | mov ebx,[open_file_vox] |
||
878 | mov byte[ebx],al |
||
879 | |||
880 | stdcall buf2d_vox_obj_get_size, ebx |
||
881 | mov dword[run_file_70.Count], eax ;размер файла |
||
6247 | IgorA | 882 | mov [run_file_70.Function], SSF_CREATE_FILE |
2748 | IgorA | 883 | mov [run_file_70.Position], 0 |
884 | mov [run_file_70.Flags], 0 |
||
885 | mov ebx, dword[open_file_vox] |
||
886 | mov [run_file_70.Buffer], ebx |
||
887 | mov byte[run_file_70+20], 0 |
||
888 | mov dword[run_file_70.FileName], openfile_path |
||
6247 | IgorA | 889 | mcall SF_FILE,run_file_70 ;загружаем файл изображения |
2748 | IgorA | 890 | cmp ebx,0xffffffff |
891 | je .end_save_file |
||
892 | |||
893 | .end_save_file: |
||
894 | popad |
||
895 | ret |
||
896 | |||
2975 | IgorA | 897 | ;смена вида камеры на просмотр 3 и 2 граней |
898 | align 4 |
||
899 | but_camera_3g_2g: |
||
900 | cmp dword[buf_vox],buf_vox_g3 |
||
901 | je @f |
||
902 | mov dword[buf_vox],buf_vox_g3 |
||
903 | jmp .end_0 |
||
904 | @@: |
||
905 | mov dword[buf_vox],buf_vox_g2 |
||
906 | .end_0: |
||
907 | call draw_objects |
||
908 | ret |
||
909 | |||
2758 | IgorA | 910 | ;увеличение масштаба |
2748 | IgorA | 911 | align 4 |
2759 | IgorA | 912 | but_zoom_p: |
2758 | IgorA | 913 | cmp dword[v_zoom],10 ;максимальный размер, до которого можно увеличить 2^10=1024 |
2748 | IgorA | 914 | jge @f |
915 | inc dword[v_zoom] |
||
916 | shl dword[n_plane],1 |
||
2758 | IgorA | 917 | push eax |
918 | mov eax,[v_zoom] |
||
919 | cmp eax,[scaled_zoom] |
||
920 | jl .end_0 |
||
2759 | IgorA | 921 | push ecx |
922 | mov ecx,[scaled_zoom] |
||
923 | xor eax,eax |
||
924 | inc eax |
||
925 | shl eax,cl |
||
2758 | IgorA | 926 | shl dword[cam_x],1 |
927 | shl dword[cam_y],1 |
||
928 | shl dword[cam_z],1 |
||
2759 | IgorA | 929 | cmp eax,[n_plane] |
930 | jg .end_1 |
||
931 | ;коректировка ползунка |
||
932 | sub [n_plane],eax |
||
933 | inc dword[cam_y] |
||
934 | .end_1: |
||
935 | pop ecx |
||
2758 | IgorA | 936 | .end_0: |
937 | pop eax |
||
2748 | IgorA | 938 | call draw_objects |
939 | call draw_pok |
||
940 | @@: |
||
941 | ret |
||
942 | |||
2758 | IgorA | 943 | ;уменьшение масштаба |
2748 | IgorA | 944 | align 4 |
2759 | IgorA | 945 | but_zoom_m: |
946 | cmp dword[v_zoom],1 |
||
2748 | IgorA | 947 | jl @f |
948 | dec dword[v_zoom] |
||
949 | shr dword[n_plane],1 |
||
2758 | IgorA | 950 | push eax |
951 | mov eax,[v_zoom] |
||
952 | cmp eax,[scaled_zoom] |
||
953 | jl .end_0 |
||
954 | shr dword[cam_x],1 |
||
955 | shr dword[cam_y],1 |
||
2759 | IgorA | 956 | jnc .end_1 |
957 | ;коректировка ползунка |
||
958 | push ecx |
||
959 | mov ecx,[scaled_zoom] |
||
960 | dec ecx |
||
961 | xor eax,eax |
||
962 | inc eax |
||
963 | shl eax,cl |
||
964 | add [n_plane],eax |
||
965 | pop ecx |
||
966 | .end_1: |
||
2758 | IgorA | 967 | shr dword[cam_z],1 |
968 | .end_0: |
||
969 | pop eax |
||
2748 | IgorA | 970 | call draw_objects |
971 | call draw_pok |
||
972 | @@: |
||
973 | ret |
||
974 | |||
975 | align 4 |
||
3969 | IgorA | 976 | but_r_z: |
2748 | IgorA | 977 | stdcall vox_obj_rot_z, [open_file_vox] |
978 | call draw_objects |
||
979 | ret |
||
980 | |||
981 | align 4 |
||
3969 | IgorA | 982 | but_r_x: |
2748 | IgorA | 983 | stdcall vox_obj_rot_x, [open_file_vox] |
984 | call draw_objects |
||
985 | ret |
||
986 | |||
3969 | IgorA | 987 | align 4 |
988 | but_r_y: |
||
989 | stdcall vox_obj_rot_y, [open_file_vox] |
||
990 | call draw_objects |
||
991 | ret |
||
992 | |||
2759 | IgorA | 993 | ;сдвигаем плоскость среза |
2748 | IgorA | 994 | align 4 |
2974 | IgorA | 995 | but_plane_inc: |
2759 | IgorA | 996 | push eax ecx |
2748 | IgorA | 997 | inc dword[n_plane] |
2759 | IgorA | 998 | mov eax,[v_zoom] |
999 | cmp eax,[scaled_zoom] |
||
1000 | jle .end_0 |
||
1001 | ;происходит масштабирование |
||
1002 | mov ecx,[scaled_zoom] |
||
1003 | xor eax,eax |
||
1004 | inc eax |
||
1005 | shl eax,cl |
||
1006 | cmp eax,[n_plane] |
||
1007 | jg @f |
||
1008 | mov dword[n_plane],0 |
||
1009 | inc dword[cam_y] ;переходим в соседний куб |
||
1010 | neg ecx |
||
1011 | ;inc ecx |
||
1012 | add ecx,[v_zoom] |
||
1013 | xor eax,eax |
||
1014 | inc eax |
||
1015 | shl eax,cl |
||
1016 | cmp eax,[cam_y] |
||
1017 | jg @f |
||
1018 | mov dword[cam_y],0 ;зацикливаем если вылезли за пределы последнего куба |
||
1019 | @@: |
||
1020 | jmp .end_1 |
||
1021 | .end_0: |
||
1022 | ;масштабирование не происходит |
||
1023 | mov ecx,eax |
||
1024 | xor eax,eax |
||
1025 | inc eax |
||
1026 | shl eax,cl |
||
1027 | cmp eax,[n_plane] |
||
1028 | jg .end_1 |
||
1029 | mov dword[n_plane],0 |
||
1030 | .end_1: |
||
2748 | IgorA | 1031 | call draw_objects |
1032 | call draw_pok |
||
2759 | IgorA | 1033 | pop ecx eax |
2748 | IgorA | 1034 | ret |
1035 | |||
2759 | IgorA | 1036 | ;сдвигаем плоскость среза |
2748 | IgorA | 1037 | align 4 |
2974 | IgorA | 1038 | but_plane_dec: |
2759 | IgorA | 1039 | dec dword[n_plane] |
2748 | IgorA | 1040 | cmp dword[n_plane],0 |
2759 | IgorA | 1041 | jge .end_f |
1042 | push eax ecx |
||
1043 | mov ecx,[scaled_zoom] |
||
1044 | xor eax,eax |
||
1045 | inc eax |
||
1046 | shl eax,cl |
||
1047 | dec eax |
||
1048 | mov dword[n_plane],eax |
||
1049 | |||
1050 | mov eax,[v_zoom] |
||
1051 | cmp eax,[scaled_zoom] |
||
1052 | jle .end_0 |
||
1053 | ;происходит масштабирование |
||
1054 | dec dword[cam_y] ;переходим в соседний куб |
||
1055 | cmp dword[cam_y],0 |
||
1056 | jge .end_0 |
||
1057 | |||
1058 | mov ecx,eax |
||
1059 | sub ecx,[scaled_zoom] |
||
1060 | xor eax,eax |
||
1061 | inc eax |
||
1062 | shl eax,cl |
||
1063 | dec eax |
||
1064 | mov dword[cam_y],eax ;если номер куба оказался меньше 0 исправляем на максимальное значение |
||
1065 | .end_0: |
||
1066 | pop ecx eax |
||
1067 | .end_f: |
||
1068 | call draw_objects |
||
1069 | call draw_pok |
||
2748 | IgorA | 1070 | ret |
1071 | |||
1072 | align 4 |
||
2883 | IgorA | 1073 | but_mode_pen: |
2748 | IgorA | 1074 | push eax |
1075 | mov eax,dword[v_pen_mode] |
||
2933 | IgorA | 1076 | stdcall set_pen_mode,1,0,((9 shl 8)+9) shl 16 ;pen |
2883 | IgorA | 1077 | cmp eax,PEN_MODE_SELECT_COLOR |
2748 | IgorA | 1078 | jne @f |
1079 | call draw_objects |
||
1080 | @@: |
||
1081 | pop eax |
||
1082 | ret |
||
1083 | |||
1084 | align 4 |
||
2883 | IgorA | 1085 | but_mode_brush: |
2748 | IgorA | 1086 | push eax |
1087 | mov eax,dword[v_pen_mode] |
||
2933 | IgorA | 1088 | stdcall set_pen_mode,3,1,((9 shl 8)+9) shl 16 ;brush |
2883 | IgorA | 1089 | cmp eax,PEN_MODE_SELECT_COLOR |
1090 | jne @f |
||
1091 | call draw_objects |
||
1092 | @@: |
||
1093 | pop eax |
||
1094 | ret |
||
1095 | |||
1096 | align 4 |
||
1097 | but_mode_clear: |
||
1098 | push eax |
||
1099 | mov eax,dword[v_pen_mode] |
||
2933 | IgorA | 1100 | stdcall set_pen_mode,PEN_MODE_CLEAR,2,((15 shl 8)+9) shl 16 |
2883 | IgorA | 1101 | cmp eax,PEN_MODE_SELECT_COLOR |
2748 | IgorA | 1102 | jne @f |
1103 | call draw_objects |
||
1104 | @@: |
||
1105 | pop eax |
||
1106 | ret |
||
1107 | |||
1108 | align 4 |
||
1109 | but_light: |
||
1110 | xor dword[mode_light],1 |
||
1111 | call draw_objects |
||
1112 | ret |
||
1113 | |||
1114 | align 4 |
||
1115 | but_rend_2_2: |
||
1116 | push edi |
||
1117 | cmp dword[buf_r_img],0 |
||
1118 | jne @f |
||
1119 | ;создание буфера для рендера |
||
1120 | push ecx esi |
||
1121 | mov edi,buf_r_img |
||
1122 | mov esi,buf_0 |
||
1123 | mov ecx,BUF_STRUCT_SIZE |
||
1124 | cld |
||
1125 | rep movsb ;копируем все параметры с основного буфера |
||
1126 | mov edi,buf_r_img |
||
1127 | mov buf2d_data,0 |
||
1128 | shl buf2d_w,1 ;увеличиваем размер буфера |
||
1129 | shl buf2d_h,1 |
||
1130 | stdcall [buf2d_create],buf_r_img |
||
1131 | |||
1132 | mov edi,buf_r_z |
||
1133 | mov esi,buf_0z |
||
1134 | mov ecx,BUF_STRUCT_SIZE |
||
1135 | cld |
||
1136 | rep movsb ;копируем все параметры с основного буфера |
||
1137 | mov edi,buf_r_z |
||
1138 | mov buf2d_data,0 |
||
1139 | shl buf2d_w,1 ;увеличиваем размер буфера |
||
1140 | shl buf2d_h,1 |
||
1141 | stdcall [buf2d_create],buf_r_z |
||
1142 | pop esi ecx |
||
1143 | @@: |
||
1144 | stdcall [buf2d_clear], buf_r_img, [buf_0.color] ;чистим буфер |
||
1145 | stdcall [buf2d_clear], buf_r_z, 0 ;чистим буфер |
||
1146 | |||
1147 | push eax ebx ecx |
||
1148 | mov eax,[v_zoom] |
||
2758 | IgorA | 1149 | cmp eax,[scaled_zoom] |
1150 | jle .end_scaled |
||
1151 | ;рендер увеличенной части объекта |
||
1152 | mov ebx,[scaled_zoom] |
||
1153 | sub eax,ebx |
||
1154 | inc ebx |
||
2975 | IgorA | 1155 | stdcall [buf2d_vox_obj_draw_3g_scaled], buf_r_img, buf_r_z, [buf_vox],\ |
2808 | IgorA | 1156 | [open_file_vox], 0,0, 0, ebx, [cam_x],[cam_y],[cam_z],eax, [sc.work_graph] |
2758 | IgorA | 1157 | bt dword[mode_light],0 |
1158 | jnc @f |
||
2975 | IgorA | 1159 | stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, [buf_vox], 0,0, 0, ebx, 3 |
2758 | IgorA | 1160 | @@: |
1161 | xor ebx,ebx |
||
1162 | xor ecx,ecx |
||
1163 | mov edi,buf_r_img |
||
1164 | stdcall [buf2d_img_hdiv2], edi |
||
1165 | shr buf2d_h,1 |
||
1166 | stdcall [buf2d_img_wdiv2], edi |
||
1167 | shr buf2d_w,1 |
||
1168 | jmp .show |
||
1169 | .end_scaled: |
||
1170 | |||
2748 | IgorA | 1171 | inc eax |
2975 | IgorA | 1172 | stdcall [buf2d_vox_obj_draw_3g], buf_r_img, buf_r_z, [buf_vox], [open_file_vox], 0,0, 0, eax |
2815 | IgorA | 1173 | stdcall [buf2d_vox_obj_draw_1g], buf_r_img, buf_r_z, [open_file_vox], 0,0, eax |
2748 | IgorA | 1174 | bt dword[mode_light],0 |
1175 | jnc @f |
||
2975 | IgorA | 1176 | stdcall [buf2d_vox_obj_draw_3g_shadows], buf_r_img, buf_r_z, [buf_vox], 0,0, 0, eax, 3 |
2748 | IgorA | 1177 | @@: |
1178 | |||
1179 | mov edi,buf_r_img |
||
1180 | stdcall [buf2d_img_hdiv2], edi |
||
1181 | shr buf2d_h,1 |
||
1182 | stdcall [buf2d_img_wdiv2], edi |
||
1183 | shr buf2d_w,1 |
||
1184 | |||
2975 | IgorA | 1185 | stdcall [buf2d_vox_obj_get_img_w_3g], [buf_vox],[v_zoom] |
2748 | IgorA | 1186 | mov ebx,[buf_0.w] |
1187 | sub ebx,eax |
||
1188 | shr ebx,1 ;ebx - для центровки маленьких изображений по горизонтали |
||
2975 | IgorA | 1189 | stdcall [buf2d_vox_obj_get_img_h_3g], [buf_vox],[v_zoom] |
2748 | IgorA | 1190 | cmp eax,[buf_0.h] |
1191 | jg @f |
||
1192 | mov ecx,[buf_0.h] |
||
1193 | sub ecx,eax |
||
2758 | IgorA | 1194 | shr ecx,1 ;ecx - для центровки маленьких изображений по вертикали |
1195 | @@: |
||
1196 | .show: |
||
2748 | IgorA | 1197 | stdcall [buf2d_bit_blt], buf_0, ebx,ecx, edi |
1198 | shl buf2d_h,1 |
||
1199 | shl buf2d_w,1 |
||
1200 | pop ecx ebx eax |
||
1201 | pop edi |
||
1202 | stdcall [buf2d_draw], buf_0 ;обновляем буфер на экране |
||
1203 | ret |
||
1204 | |||
2883 | IgorA | 1205 | ;уменьшаем ширину кисти |
2748 | IgorA | 1206 | align 4 |
2883 | IgorA | 1207 | but_bru_w_m: |
1208 | cmp dword[brush_w],1 |
||
1209 | jle @f |
||
1210 | dec dword[brush_w] |
||
1211 | pushad |
||
1212 | call draw_pok |
||
3047 | IgorA | 1213 | call draw_plane |
2883 | IgorA | 1214 | popad |
1215 | @@: |
||
1216 | ret |
||
1217 | ;увеличиваем ширину кисти |
||
1218 | align 4 |
||
1219 | but_bru_w_p: |
||
1220 | cmp dword[brush_w],32 |
||
1221 | jge @f |
||
1222 | inc dword[brush_w] |
||
1223 | pushad |
||
1224 | call draw_pok |
||
3047 | IgorA | 1225 | call draw_plane |
2883 | IgorA | 1226 | popad |
1227 | @@: |
||
1228 | ret |
||
1229 | ;уменьшаем высоту кисти |
||
1230 | align 4 |
||
1231 | but_bru_h_m: |
||
1232 | cmp dword[brush_h],1 |
||
1233 | jle @f |
||
1234 | dec dword[brush_h] |
||
1235 | pushad |
||
1236 | call draw_pok |
||
3047 | IgorA | 1237 | call draw_plane |
2883 | IgorA | 1238 | popad |
1239 | @@: |
||
1240 | ret |
||
1241 | ;увеличиваем высоту кисти |
||
1242 | align 4 |
||
1243 | but_bru_h_p: |
||
1244 | cmp dword[brush_h],32 |
||
1245 | jge @f |
||
1246 | inc dword[brush_h] |
||
1247 | pushad |
||
1248 | call draw_pok |
||
3047 | IgorA | 1249 | call draw_plane |
2883 | IgorA | 1250 | popad |
1251 | @@: |
||
1252 | ret |
||
1253 | |||
1254 | align 4 |
||
5390 | IgorA | 1255 | but_bru_flip_h: |
1256 | stdcall [buf2d_flip_h],buf_brush |
||
1257 | call draw_plane |
||
1258 | ret |
||
1259 | |||
1260 | align 4 |
||
1261 | but_bru_flip_v: |
||
1262 | stdcall [buf2d_flip_v],buf_brush |
||
1263 | call draw_plane |
||
1264 | ret |
||
1265 | |||
1266 | align 4 |
||
1267 | but_bru_rot_90: |
||
1268 | stdcall [buf2d_rotate],buf_brush,90 |
||
1269 | call draw_plane |
||
1270 | ret |
||
1271 | |||
1272 | align 4 |
||
2883 | IgorA | 1273 | but_brush_copy: |
3047 | IgorA | 1274 | cmp dword[v_pen_mode],PEN_MODE_BRUSH |
2883 | IgorA | 1275 | jne .end_f |
1276 | pushad |
||
1277 | mov eax,[v_cur_x] |
||
1278 | mov ebx,[n_plane] |
||
1279 | mov edx,[v_cur_y] |
||
1280 | |||
1281 | mov ecx,[v_zoom] |
||
1282 | cmp ecx,[scaled_zoom] |
||
1283 | jle @f |
||
1284 | ;преобразование координат, с учетом увеличения |
||
1285 | ;sub ecx,[scaled_zoom] ;в ecx прирост масштаба (ecx>0) |
||
1286 | mov ecx,[scaled_zoom] |
||
1287 | |||
1288 | mov edi,[cam_x] |
||
1289 | shl edi,cl |
||
1290 | add eax,edi |
||
1291 | mov edi,[cam_y] |
||
1292 | shl edi,cl |
||
1293 | add ebx,edi |
||
1294 | mov edi,[cam_z] |
||
1295 | shl edi,cl |
||
1296 | add edx,edi |
||
1297 | @@: |
||
1298 | |||
1299 | cld |
||
1300 | mov edi,brush_data |
||
1301 | mov esi,edx |
||
1302 | sub esi,[brush_h] |
||
1303 | .cycle_0: |
||
1304 | mov ecx,[brush_w] |
||
1305 | @@: |
||
1306 | push eax |
||
1307 | stdcall buf2d_vox_obj_node_get_color, [open_file_vox], eax,ebx,edx, [v_zoom] |
||
1308 | cmp eax,[v_color] |
||
1309 | jne .end_0 |
||
1310 | mov eax,1 shl 30 |
||
1311 | .end_0: |
||
1312 | mov dword[edi],eax ;color |
||
1313 | pop eax |
||
1314 | inc eax |
||
1315 | add edi,4 |
||
1316 | loop @b |
||
1317 | dec edx |
||
1318 | sub eax,[brush_w] |
||
1319 | cmp edx,esi |
||
1320 | jg .cycle_0 |
||
1321 | |||
1322 | call draw_objects |
||
1323 | popad |
||
1324 | .end_f: |
||
1325 | ret |
||
1326 | |||
1327 | align 4 |
||
1328 | but_brush_draw: |
||
3047 | IgorA | 1329 | cmp dword[v_pen_mode],PEN_MODE_BRUSH |
2883 | IgorA | 1330 | jne .end_f |
1331 | pushad |
||
1332 | mov eax,[v_cur_x] |
||
1333 | mov ebx,[n_plane] |
||
1334 | mov edx,[v_cur_y] |
||
1335 | |||
1336 | mov ecx,[v_zoom] |
||
1337 | cmp ecx,[scaled_zoom] |
||
1338 | jle @f |
||
1339 | ;преобразование координат, с учетом увеличения |
||
1340 | ;sub ecx,[scaled_zoom] ;в ecx прирост масштаба (ecx>0) |
||
1341 | mov ecx,[scaled_zoom] |
||
1342 | |||
1343 | mov edi,[cam_x] |
||
1344 | shl edi,cl |
||
1345 | add eax,edi |
||
1346 | mov edi,[cam_y] |
||
1347 | shl edi,cl |
||
1348 | add ebx,edi |
||
1349 | mov edi,[cam_z] |
||
1350 | shl edi,cl |
||
1351 | add edx,edi |
||
1352 | @@: |
||
1353 | |||
1354 | cld |
||
1355 | mov edi,brush_data |
||
1356 | mov esi,edx |
||
1357 | sub esi,[brush_h] |
||
1358 | .cycle_0: |
||
1359 | mov ecx,[brush_w] |
||
1360 | @@: |
||
1361 | bt dword[edi],31 ;бит прозрачности |
||
1362 | jc .end_2 |
||
1363 | bt dword[edi],30 ;бит текущего цвета |
||
1364 | jnc .end_0 |
||
1365 | push dword[v_color] |
||
1366 | jmp .end_1 |
||
1367 | .end_0: |
||
1368 | push dword[edi] |
||
1369 | .end_1: |
||
1370 | stdcall buf2d_vox_obj_create_node, [open_file_vox], eax,ebx,edx, [v_zoom] ;, color |
||
1371 | .end_2: |
||
1372 | inc eax |
||
1373 | add edi,4 |
||
1374 | loop @b |
||
1375 | dec edx |
||
1376 | sub eax,[brush_w] |
||
1377 | cmp edx,esi |
||
1378 | jg .cycle_0 |
||
1379 | |||
1380 | call draw_objects |
||
1381 | popad |
||
1382 | .end_f: |
||
1383 | ret |
||
1384 | |||
1385 | align 4 |
||
2974 | IgorA | 1386 | but_brush_clear: |
3047 | IgorA | 1387 | cmp dword[v_pen_mode],PEN_MODE_BRUSH |
2974 | IgorA | 1388 | jne .end_f |
1389 | pushad |
||
1390 | mov eax,[v_cur_x] |
||
1391 | mov ebx,[n_plane] |
||
1392 | mov edx,[v_cur_y] |
||
1393 | |||
1394 | mov ecx,[v_zoom] |
||
1395 | cmp ecx,[scaled_zoom] |
||
1396 | jle @f |
||
1397 | ;преобразование координат, с учетом увеличения |
||
1398 | ;sub ecx,[scaled_zoom] ;в ecx прирост масштаба (ecx>0) |
||
1399 | mov ecx,[scaled_zoom] |
||
1400 | |||
1401 | mov edi,[cam_x] |
||
1402 | shl edi,cl |
||
1403 | add eax,edi |
||
1404 | mov edi,[cam_y] |
||
1405 | shl edi,cl |
||
1406 | add ebx,edi |
||
1407 | mov edi,[cam_z] |
||
1408 | shl edi,cl |
||
1409 | add edx,edi |
||
1410 | @@: |
||
1411 | |||
1412 | cld |
||
1413 | mov edi,brush_data |
||
1414 | mov esi,edx |
||
1415 | sub esi,[brush_h] |
||
1416 | .cycle_0: |
||
1417 | mov ecx,[brush_w] |
||
1418 | @@: |
||
1419 | bt dword[edi],31 ;бит прозрачности |
||
1420 | jc .end_2 |
||
1421 | stdcall buf2d_vox_obj_delete_node, [open_file_vox], eax,ebx,edx, [v_zoom] |
||
1422 | .end_2: |
||
1423 | inc eax |
||
1424 | add edi,4 |
||
1425 | loop @b |
||
1426 | dec edx |
||
1427 | sub eax,[brush_w] |
||
1428 | cmp edx,esi |
||
1429 | jg .cycle_0 |
||
1430 | |||
1431 | call draw_objects |
||
1432 | popad |
||
1433 | .end_f: |
||
1434 | ret |
||
1435 | |||
1436 | align 4 |
||
2748 | IgorA | 1437 | draw_palete: |
1438 | stdcall [buf2d_clear], buf_0, [buf_0.color] ;чистим буфер |
||
2758 | IgorA | 1439 | stdcall buf2d_draw_palete, buf_0, 5,3, 9,6, 18, 512 |
2748 | IgorA | 1440 | stdcall [buf2d_draw], buf_0 ;обновляем буфер на экране |
1441 | ret |
||
1442 | |||
2883 | IgorA | 1443 | align 4 |
2758 | IgorA | 1444 | v_zoom dd 3 ;текущий масштаб |
2748 | IgorA | 1445 | v_cur_x dd 0 ;координата курсора x |
1446 | v_cur_y dd 0 ;координата курсора y (но ось в объекте z) |
||
1447 | n_plane dd 0 ;плоскость сечения |
||
1448 | v_color dd 0xff ;цвет карандаша |
||
2933 | IgorA | 1449 | v_pen_mode dd PEN_MODE_NONE ;режим работы курсора (см. константы PEN_MODE_...) |
2748 | IgorA | 1450 | mode_light dd 1 ;режим освещения |
2758 | IgorA | 1451 | cam_x dd 0 |
1452 | cam_y dd 0 |
||
1453 | cam_z dd 0 |
||
1454 | scaled_zoom dd 5 ;масштаб после которого начинается рисование части изображения |
||
2876 | IgorA | 1455 | tile_size dd ? ;размер квадратика на плоскости с сечением |
1456 | max_open_file_size dd ? |
||
5390 | IgorA | 1457 | |
1458 | align 4 |
||
1459 | buf_brush: ;буфер с прозрачностью для курсоров |
||
1460 | dd brush_data ;указатель на буфер изображения |
||
1461 | dw 0 ;+4 left |
||
1462 | dw 0 ;+6 top |
||
2883 | IgorA | 1463 | brush_w dd 5 ;ширина кисти |
1464 | brush_h dd 5 ;высота кисти |
||
5390 | IgorA | 1465 | dd 0 ;+16 color |
1466 | db 32 ;+20 bit in pixel |
||
1467 | |||
2883 | IgorA | 1468 | brush_data dd 1 shl 31,1 shl 30,1 shl 30,1 shl 30,1 shl 31 |
1469 | dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 |
||
1470 | dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 |
||
1471 | dd 1 shl 30,1 shl 30,1 shl 30,1 shl 30,1 shl 30 |
||
1472 | dd 1 shl 31,1 shl 30,1 shl 30,1 shl 30,1 shl 31 |
||
1473 | rd 999 ;32*32-25 |
||
2748 | IgorA | 1474 | |
1475 | txt_zoom db 'Масштаб:',0 |
||
2883 | IgorA | 1476 | txt_curor: db 'Курсор: ' |
1477 | .size: rb 10 |
||
2748 | IgorA | 1478 | txt_n_plane db 'Сечение:',0 |
2758 | IgorA | 1479 | txt_color db 'Цвет:',0 |
2883 | IgorA | 1480 | txt_brush: db 'Кисть: ' |
1481 | .size: rb 10 |
||
1482 | txt_mull db '*',0 |
||
1483 | txt_space db ' ',0 |
||
1484 | txt_buf rb 16 |
||
5390 | IgorA | 1485 | txt_need_memory db 'Мало памяти для работы с открываемым файлом.',13,10,\ |
1486 | 'При редактировании файла программа может зависнуть.',13,10,\ |
||
1487 | 'Увеличте размер переменной ',39,'file_size',39,' в файле ',39,'vox_editor.ini',39,'.',0 |
||
2748 | IgorA | 1488 | |
3047 | IgorA | 1489 | ;рисование буфера с воксельными объектами |
2748 | IgorA | 1490 | align 4 |
1491 | draw_objects: |
||
1492 | stdcall [buf2d_clear], buf_0, [buf_0.color] ;чистим буфер |
||
1493 | stdcall [buf2d_clear], buf_0z, 0 ;чистим буфер |
||
1494 | |||
2883 | IgorA | 1495 | cmp dword[v_pen_mode],PEN_MODE_SELECT_COLOR |
2748 | IgorA | 1496 | jne @f |
1497 | call draw_palete |
||
1498 | jmp .end_f |
||
1499 | @@: |
||
2758 | IgorA | 1500 | push eax ebx ecx |
2975 | IgorA | 1501 | stdcall [buf2d_vox_obj_get_img_w_3g], [buf_vox],[v_zoom] |
2758 | IgorA | 1502 | mov ebx,[buf_0.w] |
1503 | sub ebx,eax |
||
1504 | shr ebx,1 ;ebx - для центровки маленьких изображений по горизонтали |
||
2748 | IgorA | 1505 | |
2758 | IgorA | 1506 | xor ecx,ecx |
2975 | IgorA | 1507 | stdcall [buf2d_vox_obj_get_img_h_3g], [buf_vox],[v_zoom] |
2758 | IgorA | 1508 | cmp eax,[buf_0.h] |
1509 | jg @f |
||
1510 | mov ecx,[buf_0.h] |
||
1511 | sub ecx,eax |
||
2975 | IgorA | 1512 | shr ecx,1 ;ecx - для центровки маленьких изображений по вертикали |
2758 | IgorA | 1513 | @@: |
2748 | IgorA | 1514 | |
2758 | IgorA | 1515 | mov eax,[v_zoom] |
1516 | cmp eax,[scaled_zoom] |
||
1517 | jg @f |
||
1518 | ;обычный режим изображения |
||
2975 | IgorA | 1519 | stdcall [buf2d_vox_obj_draw_3g], buf_0, buf_0z, [buf_vox],\ |
2759 | IgorA | 1520 | [open_file_vox], ebx,ecx, 0, eax |
2815 | IgorA | 1521 | stdcall [buf2d_vox_obj_draw_1g], buf_0, buf_0z,\ |
1522 | [open_file_vox], 0,0, eax |
||
2748 | IgorA | 1523 | bt dword[mode_light],0 |
2758 | IgorA | 1524 | jnc .end_1 |
2975 | IgorA | 1525 | stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, [buf_vox], ebx,ecx, 0, eax, 3 |
2758 | IgorA | 1526 | .end_1: |
1527 | jmp .end_0 |
||
1528 | @@: |
||
1529 | ;режим масштабирования изображения |
||
1530 | sub eax,[scaled_zoom] |
||
2975 | IgorA | 1531 | stdcall [buf2d_vox_obj_draw_3g_scaled], buf_0, buf_0z, [buf_vox],\ |
2758 | IgorA | 1532 | [open_file_vox], 0,0, 0, [scaled_zoom], [cam_x],[cam_y],[cam_z],eax, [sc.work_graph] ;scroll -> 2^eax |
1533 | bt dword[mode_light],0 |
||
1534 | jnc .end_2 |
||
2975 | IgorA | 1535 | stdcall [buf2d_vox_obj_draw_3g_shadows], buf_0, buf_0z, [buf_vox], 0,0, 0, [scaled_zoom], 3 |
2758 | IgorA | 1536 | .end_2: |
2748 | IgorA | 1537 | .end_0: |
2758 | IgorA | 1538 | pop ecx ebx eax |
2748 | IgorA | 1539 | |
3047 | IgorA | 1540 | call draw_plane |
1541 | stdcall [buf2d_draw], buf_0 ;обновляем буфер на экране |
||
1542 | .end_f: |
||
1543 | ret |
||
1544 | |||
1545 | ;рисование плоскости с сечением объекта |
||
1546 | align 4 |
||
1547 | proc draw_plane uses eax |
||
1548 | stdcall [buf2d_clear], buf_pl, [buf_pl.color] ;чистим буфер |
||
1549 | |||
1550 | mov eax,[v_zoom] |
||
1551 | cmp eax,[scaled_zoom] |
||
1552 | jg @f |
||
1553 | ;обычный режим изображения |
||
1554 | stdcall [buf2d_vox_obj_draw_pl], buf_pl, [open_file_vox],\ |
||
1555 | OT_MAP_X,OT_MAP_Y,[tile_size], eax, [n_plane], [sc.work_graph] |
||
1556 | jmp .end_0 |
||
1557 | @@: |
||
1558 | ;режим масштабирования изображения |
||
1559 | sub eax,[scaled_zoom] |
||
1560 | stdcall [buf2d_vox_obj_draw_pl_scaled], buf_pl, [open_file_vox],\ |
||
1561 | OT_MAP_X,OT_MAP_Y,[tile_size], [scaled_zoom], [n_plane], [sc.work_graph],[cam_x],[cam_y],[cam_z],eax |
||
1562 | .end_0: |
||
1563 | |||
2808 | IgorA | 1564 | call draw_vox_cursor |
2748 | IgorA | 1565 | stdcall [buf2d_draw], buf_pl ;обновляем буфер на экране |
1566 | .end_f: |
||
1567 | ret |
||
3047 | IgorA | 1568 | endp |
2748 | IgorA | 1569 | |
2808 | IgorA | 1570 | ;рисование курсора |
1571 | align 4 |
||
1572 | draw_vox_cursor: |
||
1573 | pushad |
||
1574 | mov ecx,[v_zoom] |
||
1575 | cmp ecx,[scaled_zoom] |
||
1576 | jle @f |
||
1577 | mov ecx,[scaled_zoom] |
||
1578 | @@: |
||
1579 | xor edx,edx |
||
1580 | inc edx |
||
1581 | shl edx,cl |
||
1582 | |||
1583 | mov eax,[v_cur_x] |
||
1584 | cmp eax,edx |
||
1585 | jge .end_f ;курсор за пределами поля |
||
2876 | IgorA | 1586 | mov edi,[tile_size] |
2808 | IgorA | 1587 | imul eax,edi |
1588 | add eax,OT_MAP_X |
||
1589 | mov ebx,edx |
||
1590 | dec ebx |
||
1591 | sub ebx,[v_cur_y] |
||
1592 | imul ebx,edi |
||
1593 | add ebx,OT_MAP_Y |
||
1594 | inc eax |
||
3047 | IgorA | 1595 | cmp dword[v_pen_mode],PEN_MODE_BRUSH |
1596 | je .brush |
||
2808 | IgorA | 1597 | inc ebx |
3047 | IgorA | 1598 | sub edi,2 |
2808 | IgorA | 1599 | stdcall [buf2d_rect_by_size], buf_pl, eax,ebx, edi,edi,[sc.work_graph] |
1600 | dec ebx |
||
1601 | add edi,2 |
||
1602 | |||
1603 | ;горизонтальные линии |
||
1604 | sub eax,2 |
||
1605 | mov ecx,edi |
||
1606 | imul edi,edx |
||
1607 | shr ecx,1 |
||
1608 | add ebx,ecx ;центровка по середине клетки |
||
1609 | mov ecx,OT_MAP_X |
||
1610 | add edi,ecx |
||
1611 | stdcall [buf2d_line], buf_pl, ecx,ebx, eax,ebx,[sc.work_graph] |
||
2876 | IgorA | 1612 | add eax,[tile_size] |
2808 | IgorA | 1613 | inc eax |
1614 | cmp eax,edi |
||
1615 | jge @f ;если курсор на краю поля |
||
1616 | dec edi |
||
1617 | stdcall [buf2d_line], buf_pl, eax,ebx, edi,ebx,[sc.work_graph] |
||
1618 | @@: |
||
2883 | IgorA | 1619 | jmp .end_f |
2808 | IgorA | 1620 | |
2883 | IgorA | 1621 | ;рамка для кисти |
1622 | .brush: |
||
1623 | dec eax |
||
1624 | mov ecx,[brush_w] |
||
1625 | imul ecx,[tile_size] |
||
1626 | ;mov edi,eax |
||
1627 | mov edi,ecx |
||
1628 | mov esi,[brush_h] |
||
1629 | imul esi,[tile_size] |
||
1630 | stdcall [buf2d_rect_by_size], buf_pl, eax,ebx, edi,esi,[sc.work_graph] |
||
1631 | |||
3047 | IgorA | 1632 | ;рисование точек для кисти |
1633 | mov ecx,[brush_w] |
||
1634 | mov edx,[tile_size] |
||
1635 | sub eax,edx ;eax-=tile_size |
||
1636 | shr edx,2 |
||
1637 | add eax,edx ;eax+=tile_size/4 |
||
1638 | add ebx,edx ;ebx+=tile_size/4 |
||
1639 | mov edx,eax |
||
1640 | mov esi,[tile_size] |
||
1641 | imul esi,ecx |
||
1642 | imul ecx,[brush_h] |
||
1643 | add esi,edx |
||
1644 | ;eax = from edx to esi |
||
1645 | mov edi,brush_data |
||
1646 | cld |
||
1647 | @@: |
||
1648 | add eax,[tile_size] |
||
1649 | bt dword[edi],31 |
||
1650 | jc .no_pixel |
||
1651 | bt dword[edi],30 |
||
1652 | jc .sel_color |
||
1653 | push dword[edi] |
||
1654 | jmp .set_pixel |
||
1655 | .sel_color: |
||
1656 | push [v_color] |
||
1657 | .set_pixel: |
||
1658 | stdcall [buf2d_rect_by_size], buf_pl, eax,ebx, 3,3 ;, [edi] |
||
1659 | .no_pixel: |
||
1660 | add edi,4 |
||
1661 | cmp eax,esi |
||
1662 | jl .end_line |
||
1663 | mov eax,edx |
||
1664 | add ebx,[tile_size] |
||
1665 | .end_line: |
||
1666 | loop @b |
||
1667 | |||
2808 | IgorA | 1668 | .end_f: |
1669 | popad |
||
1670 | ret |
||
1671 | |||
2933 | IgorA | 1672 | ;hot_p - координаты горячей точки курсора, смещенные на бит 16 ((cx shl 8) + cy) shl 16 |
1673 | align 4 |
||
1674 | proc set_pen_mode uses eax ebx ecx edx, mode:dword, icon:dword, hot_p:dword |
||
1675 | mov eax,[mode] |
||
1676 | cmp [v_pen_mode],eax |
||
1677 | je @f |
||
1678 | mov [v_pen_mode],eax |
||
1679 | mov edx,[hot_p] |
||
1680 | mov dx,2 ;LOAD_INDIRECT |
||
1681 | mov ecx,[icon] |
||
1682 | shl ecx,12 ;умножаем на 4 кб |
||
1683 | add ecx,[buf_curs.data] |
||
6247 | IgorA | 1684 | mcall SF_MOUSE_GET,SSF_LOAD_CURSOR |
2933 | IgorA | 1685 | |
1686 | cmp eax,0 |
||
1687 | je @f |
||
1688 | mov [cursor_pointer],eax |
||
6247 | IgorA | 1689 | mcall SF_MOUSE_GET,SSF_SET_CURSOR,[cursor_pointer] |
2933 | IgorA | 1690 | @@: |
1691 | ret |
||
1692 | endp |
||
1693 | |||
2748 | IgorA | 1694 | ;данные для диалога открытия файлов |
1695 | align 4 |
||
1696 | OpenDialog_data: |
||
1697 | .type dd 0 ;0 - открыть, 1 - сохранить, 2 - выбрать дтректорию |
||
1698 | .procinfo dd procinfo ;+4 |
||
1699 | .com_area_name dd communication_area_name ;+8 |
||
1700 | .com_area dd 0 ;+12 |
||
1701 | .opendir_path dd plugin_path ;+16 |
||
1702 | .dir_default_path dd default_dir ;+20 |
||
1703 | .start_path dd file_name ;+24 путь к диалогу открытия файлов |
||
1704 | .draw_window dd draw_window ;+28 |
||
1705 | .status dd 0 ;+32 |
||
1706 | .openfile_path dd openfile_path ;+36 путь к открываемому файлу |
||
1707 | .filename_area dd filename_area ;+40 |
||
1708 | .filter_area dd Filter |
||
1709 | .x: |
||
1710 | .x_size dw 420 ;+48 ; Window X size |
||
1711 | .x_start dw 10 ;+50 ; Window X position |
||
1712 | .y: |
||
1713 | .y_size dw 320 ;+52 ; Window y size |
||
1714 | .y_start dw 10 ;+54 ; Window Y position |
||
1715 | |||
1716 | default_dir db '/rd/1',0 |
||
1717 | |||
1718 | communication_area_name: |
||
1719 | db 'FFFFFFFF_open_dialog',0 |
||
1720 | open_dialog_name: |
||
1721 | db 'opendial',0 |
||
1722 | communication_area_default_path: |
||
1723 | db '/rd/1/File managers/',0 |
||
1724 | |||
1725 | Filter: |
||
1726 | dd Filter.end - Filter ;.1 |
||
1727 | .1: |
||
1728 | db 'VOX',0 |
||
1729 | .end: |
||
1730 | db 0 |
||
1731 | |||
1732 | |||
1733 | |||
1734 | head_f_i: |
||
1735 | head_f_l db 'Системная ошибка',0 |
||
1736 | |||
1737 | system_dir_0 db '/sys/lib/' |
||
1738 | lib_name_0 db 'proc_lib.obj',0 |
||
1739 | err_message_found_lib_0 db 'Не найдена библиотека ',39,'proc_lib.obj',39,0 |
||
1740 | err_message_import_0 db 'Ошибка при импорте библиотеки ',39,'proc_lib.obj',39,0 |
||
1741 | |||
1742 | system_dir_1 db '/sys/lib/' |
||
1743 | lib_name_1 db 'libimg.obj',0 |
||
1744 | err_message_found_lib_1 db 'Не найдена библиотека ',39,'libimg.obj',39,0 |
||
1745 | err_message_import_1 db 'Ошибка при импорте библиотеки ',39,'libimg.obj',39,0 |
||
1746 | |||
1747 | system_dir_2 db '/sys/lib/' |
||
1748 | lib_name_2 db 'buf2d.obj',0 |
||
1749 | err_msg_found_lib_2 db 'Не найдена библиотека ',39,'buf2d.obj',39,0 |
||
1750 | err_msg_import_2 db 'Ошибка при импорте библиотеки ',39,'buf2d',39,0 |
||
1751 | |||
2876 | IgorA | 1752 | system_dir_3 db '/sys/lib/' |
1753 | lib_name_3 db 'libini.obj',0 |
||
1754 | err_msg_found_lib_3 db 'Не найдена библиотека ',39,'libini.obj',39,0 |
||
1755 | err_msg_import_3 db 'Ошибка при импорте библиотеки ',39,'libini',39,0 |
||
1756 | |||
2748 | IgorA | 1757 | l_libs_start: |
6247 | IgorA | 1758 | lib_0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\ |
2748 | IgorA | 1759 | err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i |
6247 | IgorA | 1760 | lib_1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\ |
2748 | IgorA | 1761 | err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i |
1762 | lib_2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\ |
||
1763 | err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i |
||
2876 | IgorA | 1764 | lib_3 l_libs lib_name_3, sys_path, library_path, system_dir_3,\ |
1765 | err_msg_found_lib_3,head_f_l,import_libini,err_msg_import_3,head_f_i |
||
2748 | IgorA | 1766 | l_libs_end: |
1767 | |||
1768 | align 4 |
||
1769 | import_libimg: |
||
1770 | dd alib_init1 |
||
1771 | img_is_img dd aimg_is_img |
||
1772 | img_info dd aimg_info |
||
1773 | img_from_file dd aimg_from_file |
||
1774 | img_to_file dd aimg_to_file |
||
1775 | img_from_rgb dd aimg_from_rgb |
||
1776 | img_to_rgb dd aimg_to_rgb |
||
1777 | img_to_rgb2 dd aimg_to_rgb2 |
||
1778 | img_decode dd aimg_decode |
||
1779 | img_encode dd aimg_encode |
||
1780 | img_create dd aimg_create |
||
1781 | img_destroy dd aimg_destroy |
||
1782 | img_destroy_layer dd aimg_destroy_layer |
||
1783 | img_count dd aimg_count |
||
1784 | img_lock_bits dd aimg_lock_bits |
||
1785 | img_unlock_bits dd aimg_unlock_bits |
||
1786 | img_flip dd aimg_flip |
||
1787 | img_flip_layer dd aimg_flip_layer |
||
1788 | img_rotate dd aimg_rotate |
||
1789 | img_rotate_layer dd aimg_rotate_layer |
||
1790 | img_draw dd aimg_draw |
||
1791 | |||
1792 | dd 0,0 |
||
1793 | alib_init1 db 'lib_init',0 |
||
1794 | aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение |
||
1795 | aimg_info db 'img_info',0 |
||
1796 | aimg_from_file db 'img_from_file',0 |
||
1797 | aimg_to_file db 'img_to_file',0 |
||
1798 | aimg_from_rgb db 'img_from_rgb',0 |
||
1799 | aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB |
||
1800 | aimg_to_rgb2 db 'img_to_rgb2',0 |
||
1801 | aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных |
||
1802 | aimg_encode db 'img_encode',0 |
||
1803 | aimg_create db 'img_create',0 |
||
1804 | aimg_destroy db 'img_destroy',0 |
||
1805 | aimg_destroy_layer db 'img_destroy_layer',0 |
||
1806 | aimg_count db 'img_count',0 |
||
1807 | aimg_lock_bits db 'img_lock_bits',0 |
||
1808 | aimg_unlock_bits db 'img_unlock_bits',0 |
||
1809 | aimg_flip db 'img_flip',0 |
||
1810 | aimg_flip_layer db 'img_flip_layer',0 |
||
1811 | aimg_rotate db 'img_rotate',0 |
||
1812 | aimg_rotate_layer db 'img_rotate_layer',0 |
||
1813 | aimg_draw db 'img_draw',0 |
||
1814 | |||
1815 | align 4 |
||
1816 | proclib_import: ;описание экспортируемых функций |
||
1817 | OpenDialog_Init dd aOpenDialog_Init |
||
1818 | OpenDialog_Start dd aOpenDialog_Start |
||
1819 | dd 0,0 |
||
1820 | aOpenDialog_Init db 'OpenDialog_init',0 |
||
1821 | aOpenDialog_Start db 'OpenDialog_start',0 |
||
1822 | |||
1823 | align 4 |
||
1824 | import_buf2d: |
||
1825 | init dd sz_init |
||
1826 | buf2d_create dd sz_buf2d_create |
||
1827 | buf2d_create_f_img dd sz_buf2d_create_f_img |
||
1828 | buf2d_clear dd sz_buf2d_clear |
||
1829 | buf2d_draw dd sz_buf2d_draw |
||
1830 | buf2d_delete dd sz_buf2d_delete |
||
1831 | buf2d_line dd sz_buf2d_line |
||
1832 | buf2d_rect_by_size dd sz_buf2d_rect_by_size |
||
1833 | buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size |
||
1834 | buf2d_circle dd sz_buf2d_circle |
||
1835 | buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2 |
||
1836 | buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2 |
||
1837 | buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8 |
||
1838 | buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32 |
||
1839 | buf2d_bit_blt dd sz_buf2d_bit_blt |
||
1840 | buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp |
||
1841 | buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha |
||
1842 | buf2d_curve_bezier dd sz_buf2d_curve_bezier |
||
1843 | buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix |
||
1844 | buf2d_draw_text dd sz_buf2d_draw_text |
||
1845 | buf2d_crop_color dd sz_buf2d_crop_color |
||
1846 | buf2d_offset_h dd sz_buf2d_offset_h |
||
1847 | buf2d_flood_fill dd sz_buf2d_flood_fill |
||
1848 | buf2d_set_pixel dd sz_buf2d_set_pixel |
||
1849 | buf2d_get_pixel dd sz_buf2d_get_pixel |
||
5390 | IgorA | 1850 | buf2d_flip_h dd sz_buf2d_flip_h |
1851 | buf2d_flip_v dd sz_buf2d_flip_v |
||
1852 | buf2d_rotate dd sz_buf2d_rotate |
||
2748 | IgorA | 1853 | buf2d_vox_brush_create dd sz_buf2d_vox_brush_create |
1854 | buf2d_vox_brush_delete dd sz_buf2d_vox_brush_delete |
||
2758 | IgorA | 1855 | buf2d_vox_obj_get_img_w_3g dd sz_buf2d_vox_obj_get_img_w_3g |
1856 | buf2d_vox_obj_get_img_h_3g dd sz_buf2d_vox_obj_get_img_h_3g |
||
2815 | IgorA | 1857 | buf2d_vox_obj_draw_1g dd sz_buf2d_vox_obj_draw_1g |
2758 | IgorA | 1858 | buf2d_vox_obj_draw_3g dd sz_buf2d_vox_obj_draw_3g |
1859 | buf2d_vox_obj_draw_3g_scaled dd sz_buf2d_vox_obj_draw_3g_scaled |
||
2759 | IgorA | 1860 | buf2d_vox_obj_draw_3g_shadows dd sz_buf2d_vox_obj_draw_3g_shadows |
2758 | IgorA | 1861 | buf2d_vox_obj_draw_pl dd sz_buf2d_vox_obj_draw_pl |
1862 | buf2d_vox_obj_draw_pl_scaled dd sz_buf2d_vox_obj_draw_pl_scaled |
||
2759 | IgorA | 1863 | |
2748 | IgorA | 1864 | dd 0,0 |
1865 | sz_init db 'lib_init',0 |
||
1866 | sz_buf2d_create db 'buf2d_create',0 |
||
1867 | sz_buf2d_create_f_img db 'buf2d_create_f_img',0 |
||
1868 | sz_buf2d_clear db 'buf2d_clear',0 |
||
1869 | sz_buf2d_draw db 'buf2d_draw',0 |
||
1870 | sz_buf2d_delete db 'buf2d_delete',0 |
||
1871 | sz_buf2d_line db 'buf2d_line',0 |
||
1872 | sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 |
||
1873 | sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 |
||
1874 | sz_buf2d_circle db 'buf2d_circle',0 |
||
1875 | sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 |
||
1876 | sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 |
||
1877 | sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0 |
||
1878 | sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0 |
||
1879 | sz_buf2d_bit_blt db 'buf2d_bit_blt',0 |
||
1880 | sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0 |
||
1881 | sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0 |
||
1882 | sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0 |
||
1883 | sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0 |
||
1884 | sz_buf2d_draw_text db 'buf2d_draw_text',0 |
||
1885 | sz_buf2d_crop_color db 'buf2d_crop_color',0 |
||
1886 | sz_buf2d_offset_h db 'buf2d_offset_h',0 |
||
1887 | sz_buf2d_flood_fill db 'buf2d_flood_fill',0 |
||
1888 | sz_buf2d_set_pixel db 'buf2d_set_pixel',0 |
||
1889 | sz_buf2d_get_pixel db 'buf2d_get_pixel',0 |
||
5390 | IgorA | 1890 | sz_buf2d_flip_h db 'buf2d_flip_h',0 |
1891 | sz_buf2d_flip_v db 'buf2d_flip_v',0 |
||
1892 | sz_buf2d_rotate db 'buf2d_rotate',0 |
||
2748 | IgorA | 1893 | sz_buf2d_vox_brush_create db 'buf2d_vox_brush_create',0 |
1894 | sz_buf2d_vox_brush_delete db 'buf2d_vox_brush_delete',0 |
||
2758 | IgorA | 1895 | sz_buf2d_vox_obj_get_img_w_3g db 'buf2d_vox_obj_get_img_w_3g',0 |
1896 | sz_buf2d_vox_obj_get_img_h_3g db 'buf2d_vox_obj_get_img_h_3g',0 |
||
2815 | IgorA | 1897 | sz_buf2d_vox_obj_draw_1g db 'buf2d_vox_obj_draw_1g',0 |
2758 | IgorA | 1898 | sz_buf2d_vox_obj_draw_3g db 'buf2d_vox_obj_draw_3g',0 |
1899 | sz_buf2d_vox_obj_draw_3g_scaled db 'buf2d_vox_obj_draw_3g_scaled',0 |
||
2759 | IgorA | 1900 | sz_buf2d_vox_obj_draw_3g_shadows db 'buf2d_vox_obj_draw_3g_shadows',0 |
2758 | IgorA | 1901 | sz_buf2d_vox_obj_draw_pl db 'buf2d_vox_obj_draw_pl',0 |
1902 | sz_buf2d_vox_obj_draw_pl_scaled db 'buf2d_vox_obj_draw_pl_scaled',0 |
||
2748 | IgorA | 1903 | |
2876 | IgorA | 1904 | align 4 |
1905 | import_libini: |
||
1906 | dd alib_init2 |
||
1907 | ini_get_str dd aini_get_str |
||
1908 | ini_get_int dd aini_get_int |
||
1909 | ini_get_color dd aini_get_color |
||
1910 | dd 0,0 |
||
1911 | alib_init2 db 'lib_init',0 |
||
1912 | aini_get_str db 'ini_get_str',0 |
||
1913 | aini_get_int db 'ini_get_int',0 |
||
1914 | aini_get_color db 'ini_get_color',0 |
||
1915 | |||
2748 | IgorA | 1916 | mouse_dd dd 0x0 |
1917 | sc system_colors |
||
1918 | |||
1919 | align 16 |
||
1920 | procinfo process_information |
||
1921 | |||
1922 | ;буфер основного изображения |
||
1923 | align 4 |
||
1924 | buf_0: dd 0 ;указатель на дaные изображения |
||
1925 | .l: dw 5 ;+4 left |
||
1926 | .t: dw 45 ;+6 top |
||
2758 | IgorA | 1927 | .w: dd 192+6 ;+8 w |
1928 | .h: dd 224+7 ;+12 h |
||
2748 | IgorA | 1929 | .color: dd 0xffffff ;+16 color |
1930 | db 24 ;+20 bit in pixel |
||
1931 | |||
1932 | ;буфер глубины основного изображения |
||
1933 | align 4 |
||
1934 | buf_0z: dd 0 |
||
1935 | dw 0 ;+4 left |
||
1936 | dw 0 ;+6 top |
||
2758 | IgorA | 1937 | .w: dd 192+6 ;+8 w |
1938 | .h: dd 224+7 ;+12 h |
||
2748 | IgorA | 1939 | .color: dd 0 ;+16 color |
1940 | db 32 ;+20 bit in pixel |
||
1941 | |||
1942 | ;буфер для рисования среза объекта |
||
1943 | align 4 |
||
1944 | buf_pl: dd 0 |
||
2758 | IgorA | 1945 | .l: dw 15+192+6 ;+4 left |
2748 | IgorA | 1946 | .t: dw 45 ;+6 top |
1947 | .w: dd 320 ;+8 w |
||
1948 | .h: dd 330 ;+12 h |
||
1949 | .color: dd 0xffffff ;+16 color |
||
1950 | db 24 ;+20 bit in pixel |
||
1951 | |||
1952 | ;буфер для улучшеного рендера |
||
1953 | align 4 |
||
1954 | buf_r_img: |
||
1955 | rb BUF_STRUCT_SIZE |
||
1956 | align 4 |
||
1957 | buf_r_z: |
||
1958 | rb BUF_STRUCT_SIZE |
||
1959 | |||
2933 | IgorA | 1960 | align 4 |
1961 | cursor_pointer dd 0 ;указатель на данные для курсора |
||
1962 | |||
1963 | buf_curs: ;буфер с курсорами |
||
1964 | .data: dd 0 ;указатель на буфер изображения |
||
1965 | dw 0 ;+4 left |
||
1966 | dw 0 ;+6 top |
||
1967 | dd 32 ;+8 w |
||
1968 | dd 32*cursors_count ;+12 h |
||
1969 | dd 0 ;+16 color |
||
1970 | db 24 ;+20 bit in pixel |
||
1971 | |||
1972 | align 4 |
||
1973 | buf_curs_8: ;буфер с прозрачностью для курсоров |
||
1974 | .data: dd 0 ;указатель на буфер изображения |
||
1975 | dw 0 ;+4 left |
||
1976 | dw 0 ;+6 top |
||
1977 | dd 32 ;+8 w |
||
1978 | dd 32*cursors_count ;+12 h |
||
1979 | dd 0 ;+16 color |
||
1980 | db 24 ;+20 bit in pixel |
||
1981 | |||
2748 | IgorA | 1982 | ;данные для создания минимального единичного вокселя |
1983 | align 4 |
||
2975 | IgorA | 1984 | vox_6_7_z: ;воксель где видно 3 грани |
2748 | IgorA | 1985 | dd 0,0,1,1,0,0,\ |
1986 | 0,2,2,2,2,0,\ |
||
1987 | 2,2,2,2,2,2,\ |
||
1988 | 2,3,2,2,3,2,\ |
||
1989 | 2,3,3,3,3,2,\ |
||
1990 | 0,3,3,3,3,0,\ |
||
1991 | 0,0,3,3,0,0 |
||
1992 | |||
1993 | align 4 |
||
2975 | IgorA | 1994 | vox_6_4_z: ;воксель, где видно 2 боковые грани а верхней грани не видно |
1995 | dd 1,2,3,3,2,1,\ |
||
1996 | 1,2,3,3,2,1,\ |
||
1997 | 1,2,3,3,2,1,\ |
||
1998 | 1,2,3,3,2,1 |
||
1999 | |||
2000 | align 4 |
||
2001 | buf_vox dd buf_vox_g3 |
||
2002 | |||
2003 | buf_vox_g3: |
||
2748 | IgorA | 2004 | db 6,7,4,3 ;w,h,h_osn,n |
2876 | IgorA | 2005 | rb BUF_STRUCT_SIZE*(3+1) |
2748 | IgorA | 2006 | |
2975 | IgorA | 2007 | align 4 |
2008 | buf_vox_g2: |
||
2009 | db 6,4,0,3 ;w,h,h_osn,n |
||
2010 | rb BUF_STRUCT_SIZE*(3+1) |
||
2011 | |||
5390 | IgorA | 2012 | align 16 |
2748 | IgorA | 2013 | i_end: |
2876 | IgorA | 2014 | wnd_s_pos: ;место для настроек стартовой позиции окна |
2015 | rq 0 |
||
6247 | IgorA | 2016 | rb 4096 |
2017 | align 16 |
||
2748 | IgorA | 2018 | stacktop: |
2019 | sys_path rb 1024 |
||
2020 | file_name: |
||
2021 | rb 1024 ;4096 |
||
2022 | library_path rb 1024 |
||
2876 | IgorA | 2023 | plugin_path rb 1024 ;4096 |
7193 | IgorA | 2024 | openfile_path rb 4096 |
2748 | IgorA | 2025 | filename_area rb 256 |
2026 | mem: |