Rev 6737 | Rev 8174 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6143 | IgorA | 1 | use32 |
7929 | IgorA | 2 | org 0 |
6143 | IgorA | 3 | db 'MENUET01' |
6200 | IgorA | 4 | dd 1,start,i_end,mem,stacktop,0,cur_dir_path |
6143 | IgorA | 5 | |
6 | include '../../../../../proc32.inc' |
||
7 | include '../../../../../macros.inc' |
||
8 | include '../../../../../KOSfuncs.inc' |
||
6200 | IgorA | 9 | include '../../../../../load_img.inc' |
6143 | IgorA | 10 | include '../opengl_const.inc' |
11 | include '../../../../../develop/info3ds/info_fun_float.inc' |
||
12 | |||
13 | @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load |
||
14 | |||
6189 | IgorA | 15 | align 4 |
6143 | IgorA | 16 | image_data_toolbar dd 0 |
17 | IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 |
||
18 | |||
19 | offs_zbuf_pbuf equ 24 ;const. from 'zbuffer.inc' |
||
20 | |||
21 | align 4 |
||
22 | start: |
||
23 | load_libraries l_libs_start,l_libs_end |
||
24 | ;проверка на сколько удачно загузились библиотеки |
||
25 | mov ebp,lib_0 |
||
26 | .test_lib_open: |
||
27 | cmp dword [ebp+ll_struc_size-4],0 |
||
28 | jz @f |
||
29 | mcall SF_TERMINATE_PROCESS |
||
30 | @@: |
||
31 | add ebp,ll_struc_size |
||
32 | cmp ebp,l_libs_end |
||
33 | jl .test_lib_open |
||
34 | |||
6164 | leency | 35 | mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors |
6143 | IgorA | 36 | mcall SF_SET_EVENTS_MASK,0x27 |
37 | |||
38 | stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1 |
||
39 | stdcall [glEnable], GL_DEPTH_TEST |
||
40 | stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов |
||
41 | stdcall [gluNewQuadric] |
||
42 | mov [qObj],eax |
||
43 | stdcall [gluQuadricTexture], eax,GL_TRUE |
||
44 | |||
45 | stdcall [glClearColor], 0.0,0.0,0.0,0.0 |
||
46 | stdcall [glShadeModel], GL_SMOOTH |
||
47 | |||
48 | mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext |
||
49 | mov eax,[eax] ;eax -> ZBuffer |
||
50 | mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf |
||
51 | mov dword[buf_ogl],eax |
||
52 | |||
6200 | IgorA | 53 | load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h |
6143 | IgorA | 54 | stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;создаем буфер |
55 | stdcall mem.Free,[image_data_toolbar] ;освобождаем память |
||
56 | stdcall [buf2d_conv_24_to_8], buf_1,1 ;делаем буфер прозрачности 8 бит |
||
57 | stdcall [buf2d_convert_text_matrix], buf_1 |
||
58 | |||
6189 | IgorA | 59 | load_image_file 'toolb_1.png', image_data_toolbar |
60 | load_image_file 'text_2.png', texture, text_w,text_h ;открытие файла текстуры |
||
6143 | IgorA | 61 | |
62 | ;* Setup texturing * |
||
63 | stdcall [glTexEnvi], GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL |
||
64 | |||
65 | ;* generate texture object IDs * |
||
66 | stdcall [glGenTextures], 1, TexObj |
||
67 | stdcall [glBindTexture], GL_TEXTURE_2D, [TexObj] |
||
6189 | IgorA | 68 | stdcall [glTexImage2D], GL_TEXTURE_2D, 0, 3, [text_w], [text_h],\ |
69 | 0, GL_RGB, GL_UNSIGNED_BYTE, [texture] |
||
6143 | IgorA | 70 | |
71 | stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST |
||
72 | stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST |
||
73 | stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT |
||
74 | stdcall [glTexParameteri], GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT |
||
75 | stdcall [glBindTexture], GL_TEXTURE_2D, [TexObj] |
||
76 | stdcall [glEnable], GL_TEXTURE_2D |
||
77 | |||
78 | call draw_3d |
||
79 | |||
80 | align 4 |
||
81 | red_win: |
||
82 | call draw_window |
||
83 | |||
84 | align 4 |
||
85 | still: |
||
86 | mcall SF_WAIT_EVENT |
||
87 | cmp al,1 |
||
88 | jz red_win |
||
89 | cmp al,2 |
||
90 | jz key |
||
91 | cmp al,3 |
||
92 | jz button |
||
93 | jmp still |
||
94 | |||
95 | align 4 |
||
96 | draw_window: |
||
97 | pushad |
||
98 | mcall SF_REDRAW,SSF_BEGIN_DRAW |
||
99 | mcall SF_CREATE_WINDOW,(50 shl 16)+420,(30 shl 16)+410,0x33ffffff,,caption |
||
100 | |||
101 | mov esi,[sc.work_button] |
||
6145 | IgorA | 102 | mcall SF_DEFINE_BUTTON,(6 shl 16)+19,(6 shl 16)+19,3+0x40000000 ;земля с меридиан. |
103 | mcall ,(36 shl 16)+19,,4+0x40000000 ;земля |
||
6189 | IgorA | 104 | mcall ,(66 shl 16)+19,,5+0x40000000 ;масштаб + |
105 | mcall ,(96 shl 16)+19,,6+0x40000000 ;масштаб - |
||
6143 | IgorA | 106 | |
6145 | IgorA | 107 | mov ebx,[image_data_toolbar] |
108 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
109 | mcall SF_PUT_IMAGE,,(21 shl 16)+21,(5 shl 16)+5 ;земля с меридиан. |
||
110 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
111 | mcall ,,,(35 shl 16)+5 ;земля |
||
6189 | IgorA | 112 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
113 | mcall ,,,(65 shl 16)+5 ;масштаб + |
||
114 | add ebx,IMAGE_TOOLBAR_ICON_SIZE |
||
115 | mcall ,,,(95 shl 16)+5 ;масштаб - |
||
6143 | IgorA | 116 | |
7929 | IgorA | 117 | call [kosglSwapBuffers] |
6143 | IgorA | 118 | mcall SF_REDRAW,SSF_END_DRAW |
119 | popad |
||
120 | ret |
||
121 | |||
122 | align 4 |
||
123 | key: |
||
124 | mcall SF_GET_KEY |
||
125 | |||
126 | cmp ah,27 ;Esc |
||
127 | je button.exit |
||
128 | |||
129 | cmp ah,61 ;+ |
||
130 | jne @f |
||
6189 | IgorA | 131 | call but_zoom_p |
132 | jmp still |
||
6143 | IgorA | 133 | @@: |
134 | cmp ah,45 ;- |
||
135 | jne @f |
||
6189 | IgorA | 136 | call but_zoom_m |
137 | jmp still |
||
6143 | IgorA | 138 | @@: |
139 | cmp ah,176 ;Left |
||
140 | jne @f |
||
141 | finit |
||
142 | fld dword[angle_y] |
||
143 | fadd dword[delt_size] |
||
144 | fst dword[angle_y] |
||
145 | mov word[NumberSymbolsAD],2 |
||
146 | fstp qword[Data_Double] |
||
147 | call DoubleFloat_to_String |
||
148 | mov byte[txt_angle_y.v],0 |
||
149 | stdcall str_cat, txt_angle_y.v,Data_String |
||
150 | call draw_3d |
||
7929 | IgorA | 151 | call [kosglSwapBuffers] |
6143 | IgorA | 152 | @@: |
153 | cmp ah,179 ;Right |
||
154 | jne @f |
||
155 | finit |
||
156 | fld dword[angle_y] |
||
157 | fsub dword[delt_size] |
||
158 | fst dword[angle_y] |
||
159 | mov word[NumberSymbolsAD],2 |
||
160 | fstp qword[Data_Double] |
||
161 | call DoubleFloat_to_String |
||
162 | mov byte[txt_angle_y.v],0 |
||
163 | stdcall str_cat, txt_angle_y.v,Data_String |
||
164 | call draw_3d |
||
7929 | IgorA | 165 | call [kosglSwapBuffers] |
6143 | IgorA | 166 | @@: |
167 | cmp ah,178 ;Up |
||
168 | jne @f |
||
169 | finit |
||
170 | fld dword[angle_x] |
||
171 | fadd dword[delt_size] |
||
172 | fst dword[angle_x] |
||
173 | mov word[NumberSymbolsAD],2 |
||
174 | fstp qword[Data_Double] |
||
175 | call DoubleFloat_to_String |
||
176 | mov byte[txt_angle_x.v],0 |
||
177 | stdcall str_cat, txt_angle_x.v,Data_String |
||
178 | call draw_3d |
||
7929 | IgorA | 179 | call [kosglSwapBuffers] |
6143 | IgorA | 180 | @@: |
181 | cmp ah,177 ;Down |
||
182 | jne @f |
||
183 | finit |
||
184 | fld dword[angle_x] |
||
185 | fsub dword[delt_size] |
||
186 | fst dword[angle_x] |
||
187 | mov word[NumberSymbolsAD],2 |
||
188 | fstp qword[Data_Double] |
||
189 | call DoubleFloat_to_String |
||
190 | mov byte[txt_angle_x.v],0 |
||
191 | stdcall str_cat, txt_angle_x.v,Data_String |
||
192 | call draw_3d |
||
7929 | IgorA | 193 | call [kosglSwapBuffers] |
6143 | IgorA | 194 | @@: |
195 | |||
196 | jmp still |
||
197 | |||
198 | align 4 |
||
199 | button: |
||
200 | mcall SF_GET_BUTTON |
||
201 | cmp ah,3 |
||
202 | jne @f |
||
203 | call but_dr_0 |
||
204 | jmp still |
||
205 | @@: |
||
206 | cmp ah,4 |
||
207 | jne @f |
||
208 | call but_dr_1 |
||
209 | jmp still |
||
210 | @@: |
||
6189 | IgorA | 211 | cmp ah,5 |
212 | jne @f |
||
213 | call but_zoom_p |
||
214 | jmp still |
||
215 | @@: |
||
216 | cmp ah,6 |
||
217 | jne @f |
||
218 | call but_zoom_m |
||
219 | jmp still |
||
220 | @@: |
||
6143 | IgorA | 221 | cmp ah,1 |
222 | jne still |
||
223 | .exit: |
||
224 | stdcall [gluDeleteQuadric], [qObj] |
||
225 | stdcall mem.Free,[image_data_toolbar] |
||
226 | mcall SF_TERMINATE_PROCESS |
||
227 | |||
228 | align 4 |
||
229 | but_dr_0: |
||
230 | mov dword[dr_figure],0 |