Subversion Repositories Kolibri OS

Rev

Rev 7861 | Rev 8442 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7861 Rev 8174
Line 1... Line 1...
1
use32
1
use32
2
	org 0
2
	org 0
3
	db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
3
	db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
4
	dd 1, start, i_end, mem, stacktop, openfile_path, sys_path
4
	dd 1, start, i_end, mem, stacktop, openfile_path, sys_path
Line 5... Line 5...
5
 
5
 
6
include '../../../../programs/macros.inc'
6
include '../../../macros.inc'
7
include '../../../../programs/proc32.inc'
7
include '../../../proc32.inc'
8
include '../../../../programs/KOSfuncs.inc'
8
include '../../../KOSfuncs.inc'
9
include '../../../../programs/load_img.inc'
9
include '../../../load_img.inc'
-
 
10
include '../../../develop/libraries/TinyGL/asm_fork/opengl_const.inc'
10
include '../../../../programs/develop/libraries/TinyGL/asm_fork/opengl_const.inc'
11
include '../../../develop/libraries/TinyGL/asm_fork/zbuffer.inc'
11
include 'vox_3d.inc'
12
include 'vox_3d.inc'
12
include '../trunk/str.inc'
13
include '../trunk/str.inc'
Line 13... Line 14...
13
include 'lang.inc'
14
include 'lang.inc'
14
 
15
 
15
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
16
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
16
if lang eq ru
17
if lang eq ru
17
caption db 'à®á¬®âà ¢®ªá¥«¥© 04.05.20',0 ;¯®¤¯¨áì ®ª­ 
18
caption db 'à®á¬®âà ¢®ªá¥«¥© 11.11.20',0 ;¯®¤¯¨áì ®ª­ 
18
else
19
else
Line 19... Line 20...
19
caption db 'Voxel viewer 04.05.20',0
20
caption db 'Voxel viewer 11.11.20',0
20
end if
21
end if
21
 
22
 
Line 26... Line 27...
26
 
27
 
27
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
28
IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
28
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*10
29
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*10
Line 29... Line -...
29
image_data_toolbar dd 0
-
 
30
 
-
 
31
offs_zbuf_pbuf equ 24
30
image_data_toolbar dd 0
32
 
31
 
33
align 4
32
align 4
34
start:
33
start:
35
	load_libraries l_libs_start,l_libs_end
34
	load_libraries l_libs_start,l_libs_end
Line 109... Line 108...
109
	; ¢â®¬ â¨ç¥áª®¥ ¨§¬¥­¥­¨¥ 㣫  ®¡§®à 
108
	; ¢â®¬ â¨ç¥áª®¥ ¨§¬¥­¥­¨¥ 㣫  ®¡§®à 
110
	fld dword[angle_y]
109
	fld dword[angle_y]
111
	fsub dword[delt_size]
110
	fsub dword[delt_size]
112
	fstp dword[angle_y]
111
	fstp dword[angle_y]
113
	call draw_3d
112
	call draw_3d
114
	stdcall [kosglSwapBuffers]
113
	call [kosglSwapBuffers]
Line 115... Line 114...
115
 
114
 
116
	popad
115
	popad
Line 117... Line 116...
117
	jmp still
116
	jmp still
Line 128... Line 127...
128
 
127
 
129
	; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
128
	; *** ᮧ¤ ­¨¥ ª­®¯®ª ­  ¯ ­¥«ì ***
Line 130... Line 129...
130
	mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3,[sc.work_button]
129
	mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3,[sc.work_button]
131
 
130
 
132
	mov ebx,(30 shl 16)+20
-
 
133
	mov edx,4
131
	mov ebx,(30 shl 16)+20
134
	int 0x40
132
	mcall ,,,4
135
	add ebx,25 shl 16
-
 
136
	mov edx,5
133
	add ebx,25 shl 16
137
	int 0x40
134
	mcall ,,,5
138
	add ebx,30 shl 16
-
 
139
	mov edx,6
135
	add ebx,30 shl 16
140
	int 0x40
136
	mcall ,,,6
141
	add ebx,25 shl 16
-
 
142
	mov edx,7
137
	add ebx,25 shl 16
143
	int 0x40
138
	mcall ,,,7
144
	add ebx,25 shl 16
-
 
145
	mov edx,8
139
	add ebx,25 shl 16
146
	int 0x40
140
	mcall ,,,8
147
	add ebx,25 shl 16
-
 
148
	mov edx,9
141
	add ebx,25 shl 16
149
	int 0x40
142
	mcall ,,,9
150
	add ebx,25 shl 16
-
 
151
	mov edx,10
143
	add ebx,25 shl 16
152
	int 0x40
144
	mcall ,,,10
153
	add ebx,25 shl 16
-
 
154
	mov edx,11
145
	add ebx,25 shl 16
155
	int 0x40
146
	mcall ,,,11
156
	add ebx,25 shl 16
-
 
Line 157... Line 147...
157
	mov edx,12
147
	add ebx,25 shl 16
Line 158... Line 148...
158
	int 0x40
148
	mcall ,,,12
159
 
149
 
Line 160... Line 150...
160
	call draw_toolbar_i
150
	call draw_toolbar_i
161
 
151
 
162
	stdcall [buf2d_draw], buf_0
152
	stdcall [buf2d_draw], buf_0
Line 239... Line 229...
239
	cmp ah,178 ;Up
229
	cmp ah,178 ;Up
240
	jne @f
230
	jne @f
241
		fld dword[angle_x]
231
		fld dword[angle_x]
242
		fadd dword[delt_size]
232
		fadd dword[delt_size]
243
		fstp dword[angle_x]
233
		fstp dword[angle_x]
244
		call draw_3d
234
		jmp .end0
245
		stdcall [kosglSwapBuffers]
-
 
246
	@@:
235
	@@:
247
	cmp ah,177 ;Down
236
	cmp ah,177 ;Down
248
	jne @f
237
	jne @f
249
		fld dword[angle_x]
238
		fld dword[angle_x]
250
		fsub dword[delt_size]
239
		fsub dword[delt_size]
251
		fstp dword[angle_x]
240
		fstp dword[angle_x]
252
		call draw_3d
241
		jmp .end0
253
		stdcall [kosglSwapBuffers]
-
 
254
	@@:
242
	@@:
255
	cmp ah,176 ;Left
243
	cmp ah,176 ;Left
256
	jne @f
244
	jne @f
257
		fld dword[angle_y]
245
		fld dword[angle_y]
258
		fadd dword[delt_size]
246
		fadd dword[delt_size]
259
		fstp dword[angle_y]
247
		fstp dword[angle_y]
260
		call draw_3d
248
		jmp .end0
261
		stdcall [kosglSwapBuffers]
-
 
262
	@@:
249
	@@:
263
	cmp ah,179 ;Right
250
	cmp ah,179 ;Right
264
	jne @f
251
	jne still  ;@f
265
		fld dword[angle_y]
252
		fld dword[angle_y]
266
		fsub dword[delt_size]
253
		fsub dword[delt_size]
267
		fstp dword[angle_y]
254
		fstp dword[angle_y]
-
 
255
	.end0:
268
		call draw_3d
256
		call draw_3d
269
		stdcall [kosglSwapBuffers]
257
		call [kosglSwapBuffers]
270
	@@:
258
	;@@:
271
 
-
 
272
	jmp still
259
	jmp still
Line 273... Line 260...
273
 
260
 
274
 
261
 
Line 317... Line 304...
317
		fdiv dword[angle_dym] ;¥á«¨ ªãàá®à ¤¢¨¦¥âáï ¯® ®á¨ x (¢¢¥àå ¨«¨ ¢­¨§) â® ¯®¢®à®â ¤¥« ¥¬ ¢®ªà㣠®á¨ y
304
		fdiv dword[angle_dym] ;¥á«¨ ªãàá®à ¤¢¨¦¥âáï ¯® ®á¨ x (¢¢¥àå ¨«¨ ¢­¨§) â® ¯®¢®à®â ¤¥« ¥¬ ¢®ªà㣠®á¨ y
318
		fadd dword[angle_y]
305
		fadd dword[angle_y]
319
		fstp dword[angle_y]
306
		fstp dword[angle_y]
Line 320... Line 307...
320
 
307
 
321
		call draw_3d
308
		call draw_3d
322
		stdcall [kosglSwapBuffers]
309
		call [kosglSwapBuffers]
323
		jmp .end_d
310
		jmp .end_d
324
	.end_m:
311
	.end_m:
325
	bt eax,16
312
	bt eax,16
326
	jnc @f
313
	jnc @f
Line 560... Line 547...
560
 
547
 
561
align 4
548
align 4
562
draw_cadr:
549
draw_cadr:
563
	mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
550
	mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
564
	mov eax,[eax] ;eax -> ZBuffer
551
	mov eax,[eax] ;eax -> ZBuffer
565
	mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf
552
	mov eax,[eax+ZBuffer.pbuf]
Line 566... Line 553...
566
	mov dword[buf_1],eax
553
	mov dword[buf_1],eax
567
 
554
 
568
	mov dword[buf_1.w],512
555
	mov dword[buf_1.w],512
Line 613... Line 600...
613
    cmp dword[v_zoom],11 ;max=2^11=2048
600
    cmp dword[v_zoom],11 ;max=2^11=2048
614
    jge @f
601
    jge @f
615
        inc dword[v_zoom]
602
        inc dword[v_zoom]
616
        stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom]
603
        stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom]
617
		call draw_3d
604
		call draw_3d
618
		stdcall [kosglSwapBuffers]
605
		call [kosglSwapBuffers]
619
    @@:
606
    @@:
620
    ret
607
    ret
621
endp
608
endp
Line 622... Line 609...
622
 
609
 
Line 625... Line 612...
625
    cmp dword[v_zoom],1
612
    cmp dword[v_zoom],1
626
    jle @f
613
    jle @f
627
        dec dword[v_zoom]
614
        dec dword[v_zoom]
628
        stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom]
615
        stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom]
629
		call draw_3d
616
		call draw_3d
630
		stdcall [kosglSwapBuffers]
617
		call [kosglSwapBuffers]
631
    @@:
618
    @@:
632
    ret
619
    ret
633
endp
620
endp
Line 634... Line 621...
634
 
621
 
Line 644... Line 631...
644
		stdcall [glDisable], GL_LIGHTING
631
		stdcall [glDisable], GL_LIGHTING
645
		stdcall [glDisable], GL_LIGHT0
632
		stdcall [glDisable], GL_LIGHT0
646
	.end_light:
633
	.end_light:
647
	call draw_toolbar_i
634
	call draw_toolbar_i
648
	call draw_3d
635
	call draw_3d
649
	stdcall [kosglSwapBuffers]
636
	call [kosglSwapBuffers]
650
	ret
637
	ret
651
endp
638
endp
Line 652... Line 639...
652
 
639
 
653
align 4
640
align 4
654
proc but_4 uses eax ebx ecx edx
641
proc but_4 uses eax ebx ecx edx
655
	xor word[opt_cube_box],1
642
	xor word[opt_cube_box],1
656
	call draw_toolbar_i
643
	call draw_toolbar_i
657
	call draw_3d
644
	call draw_3d
658
	stdcall [kosglSwapBuffers]
645
	call [kosglSwapBuffers]
659
	ret
646
	ret
Line 660... Line 647...
660
endp
647
endp
661
 
648
 
Line 745... Line 732...
745
	mov [angle_y],ecx
732
	mov [angle_y],ecx
746
	mov [angle_z],edx
733
	mov [angle_z],edx
747
	cmp word[opt_auto_rotate],0
734
	cmp word[opt_auto_rotate],0
748
	jne @f
735
	jne @f
749
		call draw_3d
736
		call draw_3d
750
		;stdcall [kosglSwapBuffers]
737
		;call [kosglSwapBuffers]
751
	@@:
738
	@@:
752
	ret
739
	ret
753
endp
740
endp
Line 754... Line 741...
754
 
741
 
Line 770... Line 757...
770
	stdcall [glRotatef], [angle_x],1.0,0.0,0.0
757
	stdcall [glRotatef], [angle_x],1.0,0.0,0.0
771
	stdcall [glRotatef], [angle_y],0.0,1.0,0.0
758
	stdcall [glRotatef], [angle_y],0.0,1.0,0.0
772
	stdcall [glRotatef], [angle_z],0.0,0.0,1.0
759
	stdcall [glRotatef], [angle_z],0.0,0.0,1.0
773
	stdcall draw_voxels_3d,[open_file_ogl]
760
	stdcall draw_voxels_3d,[open_file_ogl]
Line 774... Line 761...
774
 
761
 
775
	stdcall [glPopMatrix]
762
	call [glPopMatrix]
Line 776... Line 763...
776
ret
763
ret
777
 
764
 
778
align 4
765
align 4
Line 909... Line 896...
909
l_libs_end:
896
l_libs_end:
Line 910... Line 897...
910
 
897
 
911
align 4
898
align 4
912
import_libimg:
899
import_libimg:
913
	dd alib_init1
900
	dd alib_init1
914
	img_is_img  dd aimg_is_img
901
;	img_is_img  dd aimg_is_img
915
	img_info    dd aimg_info
902
;	img_info    dd aimg_info
916
	img_from_file dd aimg_from_file
903
;	img_from_file dd aimg_from_file
917
	img_to_file dd aimg_to_file
904
;	img_to_file dd aimg_to_file
918
	img_from_rgb dd aimg_from_rgb
905
;	img_from_rgb dd aimg_from_rgb
919
	img_to_rgb  dd aimg_to_rgb
906
;	img_to_rgb  dd aimg_to_rgb
920
	img_to_rgb2 dd aimg_to_rgb2
907
	img_to_rgb2 dd aimg_to_rgb2
921
	img_decode  dd aimg_decode
908
	img_decode  dd aimg_decode
922
	img_encode  dd aimg_encode
909
;	img_encode  dd aimg_encode
923
	img_create  dd aimg_create
910
;	img_create  dd aimg_create
924
	img_destroy dd aimg_destroy
911
	img_destroy dd aimg_destroy
925
	img_destroy_layer dd aimg_destroy_layer
912
;	img_destroy_layer dd aimg_destroy_layer
926
	img_count   dd aimg_count
913
;	img_count   dd aimg_count
927
	img_lock_bits dd aimg_lock_bits
914
;	img_lock_bits dd aimg_lock_bits
928
	img_unlock_bits dd aimg_unlock_bits
915
;	img_unlock_bits dd aimg_unlock_bits
929
	img_flip    dd aimg_flip
916
;	img_flip    dd aimg_flip
930
	img_flip_layer dd aimg_flip_layer
917
;	img_flip_layer dd aimg_flip_layer
931
	img_rotate  dd aimg_rotate
918
;	img_rotate  dd aimg_rotate
932
	img_rotate_layer dd aimg_rotate_layer
919
;	img_rotate_layer dd aimg_rotate_layer
-
 
920
;	img_draw    dd aimg_draw
Line 933... Line 921...
933
	img_draw    dd aimg_draw
921
;	img_convert dd aimg_convert
934
 
922
 
935
	dd 0,0
923
	dd 0,0
936
	alib_init1   db 'lib_init',0
924
	alib_init1   db 'lib_init',0
937
	aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
925
;	aimg_is_img  db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
938
	aimg_info    db 'img_info',0
926
;	aimg_info    db 'img_info',0
939
	aimg_from_file db 'img_from_file',0
927
;	aimg_from_file db 'img_from_file',0
940
	aimg_to_file db 'img_to_file',0
928
;	aimg_to_file db 'img_to_file',0
941
	aimg_from_rgb db 'img_from_rgb',0
929
;	aimg_from_rgb db 'img_from_rgb',0
942
	aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
930
;	aimg_to_rgb  db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
943
	aimg_to_rgb2 db 'img_to_rgb2',0
931
	aimg_to_rgb2 db 'img_to_rgb2',0
944
	aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
932
	aimg_decode  db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
945
	aimg_encode  db 'img_encode',0
933
;	aimg_encode  db 'img_encode',0
946
	aimg_create  db 'img_create',0
934
;	aimg_create  db 'img_create',0
947
	aimg_destroy db 'img_destroy',0
935
	aimg_destroy db 'img_destroy',0
948
	aimg_destroy_layer db 'img_destroy_layer',0
936
;	aimg_destroy_layer db 'img_destroy_layer',0
949
	aimg_count   db 'img_count',0
937
;	aimg_count   db 'img_count',0
950
	aimg_lock_bits db 'img_lock_bits',0
938
;	aimg_lock_bits db 'img_lock_bits',0
951
	aimg_unlock_bits db 'img_unlock_bits',0
939
;	aimg_unlock_bits db 'img_unlock_bits',0
952
	aimg_flip    db 'img_flip',0
940
;	aimg_flip    db 'img_flip',0
953
	aimg_flip_layer db 'img_flip_layer',0
941
;	aimg_flip_layer db 'img_flip_layer',0
954
	aimg_rotate  db 'img_rotate',0
942
;	aimg_rotate  db 'img_rotate',0
-
 
943
;	aimg_rotate_layer db 'img_rotate_layer',0
Line 955... Line 944...
955
	aimg_rotate_layer db 'img_rotate_layer',0
944
;	aimg_draw    db 'img_draw',0
956
	aimg_draw    db 'img_draw',0
945
;	aimg_convert db 'img_convert',0
957
 
946
 
958
align 4
947
align 4
Line 1021... Line 1010...
1021
 
1010
 
1022
macro E_LIB n
1011
macro E_LIB n
1023
{
1012
{
1024
	n dd sz_#n
1013
	n dd sz_#n
1025
}
1014
}
1026
include '../../../../programs/develop/libraries/TinyGL/asm_fork/export.inc'
1015
include '../../../develop/libraries/TinyGL/asm_fork/export.inc'
1027
	dd 0,0
1016
	dd 0,0
1028
macro E_LIB n
1017
macro E_LIB n
1029
{
1018
{
1030
	sz_#n db `n,0
1019
	sz_#n db `n,0
1031
}
1020
}
Line 1032... Line 1021...
1032
include '../../../../programs/develop/libraries/TinyGL/asm_fork/export.inc'
1021
include '../../../develop/libraries/TinyGL/asm_fork/export.inc'
Line 1033... Line 1022...
1033
 
1022
 
1034
last_time dd 0
1023
last_time dd 0
Line 1049... Line 1038...
1049
.w: dd 512 ;+8 w
1038
.w: dd 512 ;+8 w
1050
.h: dd 512 ;+12 h
1039
.h: dd 512 ;+12 h
1051
.color: dd 0xffffff ;+16 color
1040
.color: dd 0xffffff ;+16 color
1052
	db 24 ;+20 bit in pixel
1041
	db 24 ;+20 bit in pixel
Line 1053... Line -...
1053
 
-
 
1054
align 4
-
 
1055
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
-
 
1056
;sizeof.TinyGLContext = 28
-
 
1057
 
1042
 
1058
scale dd 1.414213562
1043
scale dd 1.414213562
1059
angle_x dd 0.0
1044
angle_x dd 0.0
1060
angle_y dd 0.0
1045
angle_y dd 0.0
1061
angle_z dd 0.0
1046
angle_z dd 0.0
1062
delt_size dd 3.0
-
 
1063
mouse_drag dd 0 ;०¨¬ ¯®¢®à®â  áæ¥­ë ®â ¯¥à¥¬¥é¥­¨¨ ªãàá®à  ¬ëè¨
-
 
1064
mouse_x dd 0
-
 
1065
mouse_y dd 0
1047
delt_size dd 3.0
1066
angle_dxm dd 2.8444 ;~ 3d_wnd_w/180 - ¯à¨¡ ¢«¥­¨¥ 㣫®¢ ¯®¢®à®â  áæ¥­ë ¯à¨ ¢à é¥­¨¨ ¬ë襩
1048
angle_dxm dd 2.8444 ;~ 3d_wnd_w/180 - ¯à¨¡ ¢«¥­¨¥ 㣫®¢ ¯®¢®à®â  áæ¥­ë ¯à¨ ¢à é¥­¨¨ ¬ë襩
Line 1067... Line 1049...
1067
angle_dym dd 2.8444 ;~ 3d_wnd_h/180
1049
angle_dym dd 2.8444 ;~ 3d_wnd_h/180
1068
 
1050
 
Line 1080... Line 1062...
1080
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ;  à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
1062
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ;  à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
Line 1081... Line 1063...
1081
 
1063
 
1082
 
1064
 
-
 
1065
align 16
-
 
1066
i_end:
-
 
1067
	ctx1 rb 28 ;sizeof.TinyGLContext = 28
-
 
1068
	mouse_drag dd 0 ;०¨¬ ¯®¢®à®â  áæ¥­ë ®â ¯¥à¥¬¥é¥­¨¨ ªãàá®à  ¬ëè¨
1083
align 16
1069
	mouse_x dd 0
1084
i_end:
1070
	mouse_y dd 0
1085
	rb 4096
1071
	rb 4096
1086
stacktop:
1072
stacktop:
1087
	sys_path rb 1024
1073
	sys_path rb 1024