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