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