tinygl: fix struct ZBuffer, clean code

git-svn-id: svn://kolibrios.org@8174 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2020-11-11 20:32:44 +00:00
parent 5a440ca960
commit f5228c717f
7 changed files with 382 additions and 365 deletions

View File

@ -1,5 +1,5 @@
use32 use32
org 0x0 org 0
db 'MENUET01' db 'MENUET01'
dd 1,start,i_end,mem,stacktop,0,cur_dir_path dd 1,start,i_end,mem,stacktop,0,cur_dir_path
@ -8,6 +8,7 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc' include '../../../../../KOSfuncs.inc'
include '../../../../../load_img.inc' include '../../../../../load_img.inc'
include '../opengl_const.inc' include '../opengl_const.inc'
include '../zbuffer.inc'
include '../../../../../develop/info3ds/info_fun_float.inc' include '../../../../../develop/info3ds/info_fun_float.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
@ -16,7 +17,11 @@ align 4
image_data_toolbar dd 0 image_data_toolbar dd 0
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
offs_zbuf_pbuf equ 24 ;const. from 'zbuffer.inc' ;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
align 4 align 4
start: start:
@ -38,7 +43,7 @@ load_libraries l_libs_start,l_libs_end
stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1 stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1
stdcall [glEnable], GL_DEPTH_TEST stdcall [glEnable], GL_DEPTH_TEST
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
stdcall [gluNewQuadric] call [gluNewQuadric]
mov [qObj],eax mov [qObj],eax
stdcall [glClearColor], 0.25,0.25,0.25,0.0 stdcall [glClearColor], 0.25,0.25,0.25,0.0
@ -46,7 +51,7 @@ load_libraries l_libs_start,l_libs_end
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax mov dword[buf_ogl],eax
load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h
@ -96,7 +101,7 @@ draw_window:
add ebx,IMAGE_TOOLBAR_ICON_SIZE add ebx,IMAGE_TOOLBAR_ICON_SIZE
mcall ,,,(125 shl 16)+5 ;масштаб - mcall ,,,(125 shl 16)+5 ;масштаб -
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
mcall SF_REDRAW,SSF_END_DRAW mcall SF_REDRAW,SSF_END_DRAW
popad popad
ret ret
@ -130,7 +135,8 @@ key:
mov byte[txt_angle_y.v],0 mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
jmp still
@@: @@:
cmp ah,177 ;Down cmp ah,177 ;Down
jne @f jne @f
@ -144,7 +150,8 @@ key:
mov byte[txt_angle_y.v],0 mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
jmp still
@@: @@:
cmp ah,176 ;Left cmp ah,176 ;Left
jne @f jne @f
@ -158,7 +165,8 @@ key:
mov byte[txt_angle_z.v],0 mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
jmp still
@@: @@:
cmp ah,179 ;Right cmp ah,179 ;Right
jne @f jne @f
@ -172,7 +180,8 @@ key:
mov byte[txt_angle_z.v],0 mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
;jmp still
@@: @@:
jmp still jmp still
@ -216,21 +225,21 @@ align 4
but_st_point: but_st_point:
stdcall [gluQuadricDrawStyle], [qObj],GLU_POINT stdcall [gluQuadricDrawStyle], [qObj],GLU_POINT
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
but_st_line: but_st_line:
stdcall [gluQuadricDrawStyle], [qObj],GLU_LINE stdcall [gluQuadricDrawStyle], [qObj],GLU_LINE
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
but_st_face: but_st_face:
stdcall [gluQuadricDrawStyle], [qObj],GLU_FILL stdcall [gluQuadricDrawStyle], [qObj],GLU_FILL
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
@ -253,7 +262,7 @@ but_zoom_p:
mov byte[txt_scale.v],0 mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String stdcall str_cat, txt_scale.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
@ -276,16 +285,14 @@ but_zoom_m:
mov byte[txt_scale.v],0 mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String stdcall str_cat, txt_scale.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
caption db 'Test gluCylinder, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0 caption db 'Test gluCylinder, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
;sizeof.TinyGLContext = 28
align 4
rad1 dq 1.0 rad1 dq 1.0
rad2 dq 0.55 rad2 dq 0.55
rad3 dq 0.15 rad3 dq 0.15
@ -296,7 +303,7 @@ align 4
draw_3d: draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
stdcall [glPushMatrix] call [glPushMatrix]
call SetLight call SetLight
stdcall [glTranslatef], 0.0,0.0,0.5 stdcall [glTranslatef], 0.0,0.0,0.5
@ -316,7 +323,7 @@ stdcall [glPushMatrix]
stdcall [glColor3f], 0.0, 0.0, 1.0 stdcall [glColor3f], 0.0, 0.0, 1.0
stdcall [glTranslatef], 3.2,0.0,0.0 stdcall [glTranslatef], 3.2,0.0,0.0
stdcall [gluCylinder], [qObj], rad2,rad3,hei2, 16,8 stdcall [gluCylinder], [qObj], rad2,rad3,hei2, 16,8
stdcall [glPopMatrix] call [glPopMatrix]
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_z,5,15,0xffff00 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_z,5,15,0xffff00
@ -341,8 +348,6 @@ SetLight:
stdcall [glEnable],GL_LIGHT0 stdcall [glEnable],GL_LIGHT0
ret ret
qObj dd 0
scale dd 0.4 ;начальный масштаб scale dd 0.4 ;начальный масштаб
sc_delt dd 0.05 ;изменение масштаба при нажатии sc_delt dd 0.05 ;изменение масштаба при нажатии
sc_min dd 0.1 ;минимальный масштаб sc_min dd 0.1 ;минимальный масштаб
@ -432,49 +437,51 @@ import_buf2d:
align 4 align 4
import_libimg: import_libimg:
dd alib_init1 dd alib_init1
img_is_img dd aimg_is_img ; img_is_img dd aimg_is_img
img_info dd aimg_info ; img_info dd aimg_info
img_from_file dd aimg_from_file ; img_from_file dd aimg_from_file
img_to_file dd aimg_to_file ; img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb ; img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb ; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2 img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode img_decode dd aimg_decode
img_encode dd aimg_encode ; img_encode dd aimg_encode
img_create dd aimg_create ; img_create dd aimg_create
img_destroy dd aimg_destroy img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer ; img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count ; img_count dd aimg_count
img_lock_bits dd aimg_lock_bits ; img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits ; img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip ; img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer ; img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate ; img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer ; img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw ; img_draw dd aimg_draw
; img_convert dd aimg_convert
dd 0,0 dd 0,0
alib_init1 db 'lib_init',0 alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение ; aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
aimg_info db 'img_info',0 ; aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0 ; aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0 ; aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0 ; aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB ; aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
aimg_to_rgb2 db 'img_to_rgb2',0 aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных
aimg_encode db 'img_encode',0 ; aimg_encode db 'img_encode',0
aimg_create db 'img_create',0 ; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0 aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0 ; aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0 ; aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0 ; aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0 ; aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0 ; aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0 ; aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0 ; aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0 ; aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0 ; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
;-------------------------------------------------- ;--------------------------------------------------
system_dir_0 db '/sys/lib/' system_dir_0 db '/sys/lib/'
@ -483,14 +490,14 @@ system_dir_1 db '/sys/lib/'
lib_name_1 db 'buf2d.obj',0 lib_name_1 db 'buf2d.obj',0
system_dir_2 db '/sys/lib/' system_dir_2 db '/sys/lib/'
lib_name_2 db 'libimg.obj',0 lib_name_2 db 'libimg.obj',0
err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,0 err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0
err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,0 err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,'" -tE',0
err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,0 err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,'" -tE',0
head_f_i: head_f_i:
head_f_l db 'System error',0 head_f_l db '"System error',0
err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,0 err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0
err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,0 err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,0 err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,'" -tE',0
;-------------------------------------------------- ;--------------------------------------------------
txt_scale: txt_scale:
@ -538,6 +545,8 @@ l_libs_end:
align 4 align 4
i_end: i_end:
ctx1 rb 28 ;sizeof.TinyGLContext = 28
qObj dd 0
run_file_70 FileInfoBlock run_file_70 FileInfoBlock
sc system_colors sc system_colors
align 16 align 16

View File

@ -1,5 +1,5 @@
use32 use32
org 0x0 org 0
db 'MENUET01' db 'MENUET01'
dd 1,start,i_end,mem,stacktop,0,cur_dir_path dd 1,start,i_end,mem,stacktop,0,cur_dir_path
@ -8,6 +8,7 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc' include '../../../../../KOSfuncs.inc'
include '../../../../../load_img.inc' include '../../../../../load_img.inc'
include '../opengl_const.inc' include '../opengl_const.inc'
include '../zbuffer.inc'
include '../../../../../develop/info3ds/info_fun_float.inc' include '../../../../../develop/info3ds/info_fun_float.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
@ -16,7 +17,11 @@ align 4
image_data_toolbar dd 0 image_data_toolbar dd 0
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
offs_zbuf_pbuf equ 24 ;const. from 'zbuffer.inc' ;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
align 4 align 4
start: start:
@ -38,7 +43,7 @@ load_libraries l_libs_start,l_libs_end
stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1 stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1
stdcall [glEnable], GL_DEPTH_TEST stdcall [glEnable], GL_DEPTH_TEST
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
stdcall [gluNewQuadric] call [gluNewQuadric]
mov [qObj],eax mov [qObj],eax
stdcall [glClearColor], 0.25,0.25,0.25,0.0 stdcall [glClearColor], 0.25,0.25,0.25,0.0
@ -46,7 +51,7 @@ load_libraries l_libs_start,l_libs_end
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax mov dword[buf_ogl],eax
load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h
@ -96,7 +101,7 @@ draw_window:
add ebx,IMAGE_TOOLBAR_ICON_SIZE add ebx,IMAGE_TOOLBAR_ICON_SIZE
mcall ,,,(125 shl 16)+5 ;масштаб - mcall ,,,(125 shl 16)+5 ;масштаб -
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
mcall SF_REDRAW,SSF_END_DRAW mcall SF_REDRAW,SSF_END_DRAW
popad popad
ret ret
@ -130,7 +135,8 @@ key:
mov byte[txt_angle_y.v],0 mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
jmp still
@@: @@:
cmp ah,177 ;Down cmp ah,177 ;Down
jne @f jne @f
@ -144,7 +150,8 @@ key:
mov byte[txt_angle_y.v],0 mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
jmp still
@@: @@:
cmp ah,176 ;Left cmp ah,176 ;Left
jne @f jne @f
@ -158,7 +165,8 @@ key:
mov byte[txt_angle_z.v],0 mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
jmp still
@@: @@:
cmp ah,179 ;Right cmp ah,179 ;Right
jne @f jne @f
@ -172,7 +180,8 @@ key:
mov byte[txt_angle_z.v],0 mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
;jmp still
@@: @@:
jmp still jmp still
@ -216,21 +225,21 @@ align 4
but_st_point: but_st_point:
stdcall [gluQuadricDrawStyle], [qObj],GLU_POINT stdcall [gluQuadricDrawStyle], [qObj],GLU_POINT
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
but_st_line: but_st_line:
stdcall [gluQuadricDrawStyle], [qObj],GLU_LINE stdcall [gluQuadricDrawStyle], [qObj],GLU_LINE
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
but_st_face: but_st_face:
stdcall [gluQuadricDrawStyle], [qObj],GLU_FILL stdcall [gluQuadricDrawStyle], [qObj],GLU_FILL
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
@ -253,7 +262,7 @@ but_zoom_p:
mov byte[txt_scale.v],0 mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String stdcall str_cat, txt_scale.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
@ -276,21 +285,18 @@ but_zoom_m:
mov byte[txt_scale.v],0 mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String stdcall str_cat, txt_scale.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
caption db 'Test gluSphere, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0 caption db 'Test gluSphere, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
;sizeof.TinyGLContext = 28
align 4 align 4
draw_3d: draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
stdcall [glPushMatrix] call [glPushMatrix]
call SetLight call SetLight
stdcall [glTranslatef], 0.0,0.0,0.5 stdcall [glTranslatef], 0.0,0.0,0.5
@ -308,7 +314,7 @@ stdcall [glPushMatrix]
stdcall [glColor3f], 0.0, 0.0, 1.0 stdcall [glColor3f], 0.0, 0.0, 1.0
stdcall [glTranslatef], 3.2,0.0,0.0 stdcall [glTranslatef], 3.2,0.0,0.0
stdcall [gluSphere], [qObj], 0.55, 16,16 stdcall [gluSphere], [qObj], 0.55, 16,16
stdcall [glPopMatrix] call [glPopMatrix]
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_z,5,15,0xffff00 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_z,5,15,0xffff00
@ -333,8 +339,6 @@ SetLight:
stdcall [glEnable],GL_LIGHT0 stdcall [glEnable],GL_LIGHT0
ret ret
qObj dd 0
scale dd 0.4 ;начальный масштаб scale dd 0.4 ;начальный масштаб
sc_delt dd 0.05 ;изменение масштаба при нажатии sc_delt dd 0.05 ;изменение масштаба при нажатии
sc_min dd 0.1 ;минимальный масштаб sc_min dd 0.1 ;минимальный масштаб
@ -424,49 +428,51 @@ import_buf2d:
align 4 align 4
import_libimg: import_libimg:
dd alib_init1 dd alib_init1
img_is_img dd aimg_is_img ; img_is_img dd aimg_is_img
img_info dd aimg_info ; img_info dd aimg_info
img_from_file dd aimg_from_file ; img_from_file dd aimg_from_file
img_to_file dd aimg_to_file ; img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb ; img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb ; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2 img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode img_decode dd aimg_decode
img_encode dd aimg_encode ; img_encode dd aimg_encode
img_create dd aimg_create ; img_create dd aimg_create
img_destroy dd aimg_destroy img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer ; img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count ; img_count dd aimg_count
img_lock_bits dd aimg_lock_bits ; img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits ; img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip ; img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer ; img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate ; img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer ; img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw ; img_draw dd aimg_draw
; img_convert dd aimg_convert
dd 0,0 dd 0,0
alib_init1 db 'lib_init',0 alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение ; aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
aimg_info db 'img_info',0 ; aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0 ; aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0 ; aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0 ; aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB ; aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
aimg_to_rgb2 db 'img_to_rgb2',0 aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных
aimg_encode db 'img_encode',0 ; aimg_encode db 'img_encode',0
aimg_create db 'img_create',0 ; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0 aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0 ; aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0 ; aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0 ; aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0 ; aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0 ; aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0 ; aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0 ; aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0 ; aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0 ; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
;-------------------------------------------------- ;--------------------------------------------------
system_dir_0 db '/sys/lib/' system_dir_0 db '/sys/lib/'
@ -475,14 +481,14 @@ system_dir_1 db '/sys/lib/'
lib_name_1 db 'buf2d.obj',0 lib_name_1 db 'buf2d.obj',0
system_dir_2 db '/sys/lib/' system_dir_2 db '/sys/lib/'
lib_name_2 db 'libimg.obj',0 lib_name_2 db 'libimg.obj',0
err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,0 err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0
err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,0 err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,'" -tE',0
err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,0 err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,'" -tE',0
head_f_i: head_f_i:
head_f_l db 'System error',0 head_f_l db '"System error',0
err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,0 err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0
err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,0 err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,0 err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,'" -tE',0
;-------------------------------------------------- ;--------------------------------------------------
txt_scale: txt_scale:
@ -530,6 +536,8 @@ l_libs_end:
align 4 align 4
i_end: i_end:
ctx1 rb 28 ;sizeof.TinyGLContext = 28
qObj dd 0
run_file_70 FileInfoBlock run_file_70 FileInfoBlock
sc system_colors sc system_colors
align 16 align 16

View File

@ -8,16 +8,21 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc' include '../../../../../KOSfuncs.inc'
include '../../../../../load_img.inc' include '../../../../../load_img.inc'
include '../opengl_const.inc' include '../opengl_const.inc'
include '../zbuffer.inc'
include '../../../../../develop/info3ds/info_fun_float.inc' include '../../../../../develop/info3ds/info_fun_float.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
align 4 align 4
image_data_toolbar dd 0 image_data_toolbar dd 0
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
offs_zbuf_pbuf equ 24 ;const. from 'zbuffer.inc'
align 4 align 4
start: start:
load_libraries l_libs_start,l_libs_end load_libraries l_libs_start,l_libs_end
@ -38,7 +43,7 @@ load_libraries l_libs_start,l_libs_end
stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1 stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1
stdcall [glEnable], GL_DEPTH_TEST stdcall [glEnable], GL_DEPTH_TEST
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
stdcall [gluNewQuadric] call [gluNewQuadric]
mov [qObj],eax mov [qObj],eax
stdcall [gluQuadricTexture], eax,GL_TRUE stdcall [gluQuadricTexture], eax,GL_TRUE
@ -47,7 +52,7 @@ load_libraries l_libs_start,l_libs_end
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax mov dword[buf_ogl],eax
load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h
@ -290,7 +295,7 @@ align 4
draw_3d: draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
stdcall [glPushMatrix] call [glPushMatrix]
stdcall [glTranslatef], 0.0,0.0,0.5 stdcall [glTranslatef], 0.0,0.0,0.5
stdcall [glScalef], [scale], [scale], [scale] stdcall [glScalef], [scale], [scale], [scale]
stdcall [glRotatef], [angle_z],0.0,0.0,1.0 stdcall [glRotatef], [angle_z],0.0,0.0,1.0
@ -375,9 +380,9 @@ jne @f
stdcall [glTexCoord2f], 0.0f, 1.0f stdcall [glTexCoord2f], 0.0f, 1.0f
stdcall [glVertex3f], -1.0f, 1.0f, -1.0f ; Верх лево stdcall [glVertex3f], -1.0f, 1.0f, -1.0f ; Верх лево
stdcall [glEnd] call [glEnd]
@@: @@:
stdcall [glPopMatrix] call [glPopMatrix]
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_z,5,15,0xffff00 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_z,5,15,0xffff00
@ -473,49 +478,51 @@ import_buf2d:
align 4 align 4
import_libimg: import_libimg:
dd alib_init1 dd alib_init1
img_is_img dd aimg_is_img ; img_is_img dd aimg_is_img
img_info dd aimg_info ; img_info dd aimg_info
img_from_file dd aimg_from_file ; img_from_file dd aimg_from_file
img_to_file dd aimg_to_file ; img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb ; img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb ; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2 img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode img_decode dd aimg_decode
img_encode dd aimg_encode ; img_encode dd aimg_encode
img_create dd aimg_create ; img_create dd aimg_create
img_destroy dd aimg_destroy img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer ; img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count ; img_count dd aimg_count
img_lock_bits dd aimg_lock_bits ; img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits ; img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip ; img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer ; img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate ; img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer ; img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw ; img_draw dd aimg_draw
; img_convert dd aimg_convert
dd 0,0 dd 0,0
alib_init1 db 'lib_init',0 alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение ; aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
aimg_info db 'img_info',0 ; aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0 ; aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0 ; aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0 ; aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB ; aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
aimg_to_rgb2 db 'img_to_rgb2',0 aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных
aimg_encode db 'img_encode',0 ; aimg_encode db 'img_encode',0
aimg_create db 'img_create',0 ; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0 aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0 ; aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0 ; aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0 ; aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0 ; aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0 ; aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0 ; aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0 ; aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0 ; aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0 ; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
;-------------------------------------------------- ;--------------------------------------------------
system_dir_0 db '/sys/lib/' system_dir_0 db '/sys/lib/'
@ -579,8 +586,7 @@ l_libs_end:
align 4 align 4
i_end: i_end:
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext ctx1 rb 28 ;sizeof.TinyGLContext = 28
;sizeof.TinyGLContext = 28
dr_figure dd 0 dr_figure dd 0
qObj dd 0 qObj dd 0
TexObj dd 0 ;массив указателей на текстуры (в данном случае 1 шт.) TexObj dd 0 ;массив указателей на текстуры (в данном случае 1 шт.)

View File

@ -8,16 +8,21 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc' include '../../../../../KOSfuncs.inc'
include '../../../../../load_img.inc' include '../../../../../load_img.inc'
include '../opengl_const.inc' include '../opengl_const.inc'
include '../zbuffer.inc'
include '../../../../../develop/info3ds/info_fun_float.inc' include '../../../../../develop/info3ds/info_fun_float.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
align 4 align 4
image_data_toolbar dd 0 image_data_toolbar dd 0
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
offs_zbuf_pbuf equ 24 ;const. from 'zbuffer.inc'
align 4 align 4
start: start:
load_libraries l_libs_start,l_libs_end load_libraries l_libs_start,l_libs_end
@ -38,7 +43,7 @@ load_libraries l_libs_start,l_libs_end
stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1 stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1
stdcall [glEnable], GL_DEPTH_TEST stdcall [glEnable], GL_DEPTH_TEST
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
stdcall [gluNewQuadric] call [gluNewQuadric]
mov [qObj],eax mov [qObj],eax
stdcall [gluQuadricTexture], eax,GL_TRUE stdcall [gluQuadricTexture], eax,GL_TRUE
@ -47,7 +52,7 @@ load_libraries l_libs_start,l_libs_end
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax mov dword[buf_ogl],eax
load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h
@ -292,7 +297,7 @@ align 4
draw_3d: draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
stdcall [glPushMatrix] call [glPushMatrix]
stdcall [glTranslatef], 0.0,0.0,0.5 stdcall [glTranslatef], 0.0,0.0,0.5
stdcall [glScalef], [scale], [scale], [scale] stdcall [glScalef], [scale], [scale], [scale]
stdcall [glScalef], 1.0, 1.0, 0.1 ;прижимаем сферу, что-бы сразу не вылазила при увеличении stdcall [glScalef], 1.0, 1.0, 0.1 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
@ -314,7 +319,7 @@ jne @f
stdcall [gluQuadricDrawStyle], [qObj],GLU_FILL stdcall [gluQuadricDrawStyle], [qObj],GLU_FILL
stdcall [gluSphere], [qObj], 1.0, 64,64 stdcall [gluSphere], [qObj], 1.0, 64,64
@@: @@:
stdcall [glPopMatrix] call [glPopMatrix]
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_y,5,15,0xffff00 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_y,5,15,0xffff00
@ -403,49 +408,51 @@ import_buf2d:
align 4 align 4
import_libimg: import_libimg:
dd alib_init1 dd alib_init1
img_is_img dd aimg_is_img ; img_is_img dd aimg_is_img
img_info dd aimg_info ; img_info dd aimg_info
img_from_file dd aimg_from_file ; img_from_file dd aimg_from_file
img_to_file dd aimg_to_file ; img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb ; img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb ; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2 img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode img_decode dd aimg_decode
img_encode dd aimg_encode ; img_encode dd aimg_encode
img_create dd aimg_create ; img_create dd aimg_create
img_destroy dd aimg_destroy img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer ; img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count ; img_count dd aimg_count
img_lock_bits dd aimg_lock_bits ; img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits ; img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip ; img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer ; img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate ; img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer ; img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw ; img_draw dd aimg_draw
; img_convert dd aimg_convert
dd 0,0 dd 0,0
alib_init1 db 'lib_init',0 alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение ; aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
aimg_info db 'img_info',0 ; aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0 ; aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0 ; aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0 ; aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB ; aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
aimg_to_rgb2 db 'img_to_rgb2',0 aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных
aimg_encode db 'img_encode',0 ; aimg_encode db 'img_encode',0
aimg_create db 'img_create',0 ; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0 aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0 ; aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0 ; aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0 ; aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0 ; aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0 ; aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0 ; aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0 ; aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0 ; aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0 ; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
;-------------------------------------------------- ;--------------------------------------------------
system_dir_0 db '/sys/lib/' system_dir_0 db '/sys/lib/'
@ -515,8 +522,7 @@ l_libs_end:
align 4 align 4
i_end: i_end:
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext ctx1 rb 28 ;sizeof.TinyGLContext = 28
;sizeof.TinyGLContext = 28
dr_figure dd 0 dr_figure dd 0
qObj dd 0 qObj dd 0
TexObj dd 0 ;массив указателей на текстуры (в данном случае 1 шт.) TexObj dd 0 ;массив указателей на текстуры (в данном случае 1 шт.)

View File

@ -1,5 +1,5 @@
use32 use32
org 0x0 org 0
db 'MENUET01' db 'MENUET01'
dd 1,start,i_end,mem,stacktop,0,cur_dir_path dd 1,start,i_end,mem,stacktop,0,cur_dir_path
@ -8,16 +8,21 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc' include '../../../../../KOSfuncs.inc'
include '../../../../../load_img.inc' include '../../../../../load_img.inc'
include '../opengl_const.inc' include '../opengl_const.inc'
include '../zbuffer.inc'
include '../../../../../develop/info3ds/info_fun_float.inc' include '../../../../../develop/info3ds/info_fun_float.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
align 4 align 4
image_data_toolbar dd 0 image_data_toolbar dd 0
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3 IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
offs_zbuf_pbuf equ 24 ;const. from 'zbuffer.inc'
align 4 align 4
start: start:
load_libraries l_libs_start,l_libs_end load_libraries l_libs_start,l_libs_end
@ -38,7 +43,7 @@ load_libraries l_libs_start,l_libs_end
stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1 stdcall [kosglMakeCurrent], 5,30,[buf_ogl.w],[buf_ogl.h],ctx1
stdcall [glEnable], GL_DEPTH_TEST stdcall [glEnable], GL_DEPTH_TEST
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
stdcall [gluNewQuadric] call [gluNewQuadric]
mov [qObj],eax mov [qObj],eax
stdcall [gluQuadricDrawStyle], eax,GLU_FILL stdcall [gluQuadricDrawStyle], eax,GLU_FILL
stdcall [gluQuadricTexture], eax,GL_TRUE stdcall [gluQuadricTexture], eax,GL_TRUE
@ -48,7 +53,7 @@ load_libraries l_libs_start,l_libs_end
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax mov dword[buf_ogl],eax
load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h load_image_file 'font8x9.bmp', image_data_toolbar, buf_1.w,buf_1.h
@ -109,7 +114,7 @@ draw_window:
add ebx,IMAGE_TOOLBAR_ICON_SIZE add ebx,IMAGE_TOOLBAR_ICON_SIZE
mcall ,,,(35 shl 16)+5 ;масштаб - mcall ,,,(35 shl 16)+5 ;масштаб -
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
mcall SF_REDRAW,SSF_END_DRAW mcall SF_REDRAW,SSF_END_DRAW
popad popad
ret ret
@ -143,7 +148,7 @@ key:
mov byte[txt_angle_y.v],0 mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
@@: @@:
cmp ah,179 ;Right cmp ah,179 ;Right
jne @f jne @f
@ -157,7 +162,7 @@ key:
mov byte[txt_angle_y.v],0 mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
@@: @@:
cmp ah,178 ;Up cmp ah,178 ;Up
jne @f jne @f
@ -171,7 +176,7 @@ key:
mov byte[txt_angle_x.v],0 mov byte[txt_angle_x.v],0
stdcall str_cat, txt_angle_x.v,Data_String stdcall str_cat, txt_angle_x.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
@@: @@:
cmp ah,177 ;Down cmp ah,177 ;Down
jne @f jne @f
@ -185,7 +190,7 @@ key:
mov byte[txt_angle_x.v],0 mov byte[txt_angle_x.v],0
stdcall str_cat, txt_angle_x.v,Data_String stdcall str_cat, txt_angle_x.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
@@: @@:
jmp still jmp still
@ -230,7 +235,7 @@ but_zoom_p:
mov byte[txt_scale.v],0 mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String stdcall str_cat, txt_scale.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
@ -253,21 +258,17 @@ but_zoom_m:
mov byte[txt_scale.v],0 mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String stdcall str_cat, txt_scale.v,Data_String
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
align 4 align 4
caption db 'Test textures, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0 caption db 'Test textures, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
;sizeof.TinyGLContext = 28
align 4 align 4
draw_3d: draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
stdcall [glPushMatrix] call [glPushMatrix]
stdcall [glScalef], [scale], [scale], [scale] stdcall [glScalef], [scale], [scale], [scale]
stdcall [glScalef], 1.0, 1.0, 0.1 ;прижимаем сферу, что-бы сразу не вылазила при увеличении stdcall [glScalef], 1.0, 1.0, 0.1 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
stdcall [glRotatef], [angle_y],0.0,1.0,0.0 stdcall [glRotatef], [angle_y],0.0,1.0,0.0
@ -275,19 +276,13 @@ stdcall [glPushMatrix]
; рисование панорамы ; рисование панорамы
stdcall [gluSphere], [qObj], 1.0, 64,64 stdcall [gluSphere], [qObj], 1.0, 64,64
stdcall [glPopMatrix] call [glPopMatrix]
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_y,5,15,0xffff00 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_y,5,15,0xffff00
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_x,5,25,0xffff00 stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_x,5,25,0xffff00
ret ret
qObj dd 0
TexObj dd 0 ;массив указателей на текстуры (в данном случае 1 шт.)
texture dd 0 ;указатель на память с текстурой
text_w dd 0
text_h dd 0
scale dd 1.5 ;начальный масштаб scale dd 1.5 ;начальный масштаб
sc_delt dd 0.05 ;изменение масштаба при нажатии sc_delt dd 0.05 ;изменение масштаба при нажатии
sc_min dd 0.95 ;минимальный масштаб sc_min dd 0.95 ;минимальный масштаб
@ -370,49 +365,51 @@ import_buf2d:
align 4 align 4
import_libimg: import_libimg:
dd alib_init1 dd alib_init1
img_is_img dd aimg_is_img ; img_is_img dd aimg_is_img
img_info dd aimg_info ; img_info dd aimg_info
img_from_file dd aimg_from_file ; img_from_file dd aimg_from_file
img_to_file dd aimg_to_file ; img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb ; img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb ; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2 img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode img_decode dd aimg_decode
img_encode dd aimg_encode ; img_encode dd aimg_encode
img_create dd aimg_create ; img_create dd aimg_create
img_destroy dd aimg_destroy img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer ; img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count ; img_count dd aimg_count
img_lock_bits dd aimg_lock_bits ; img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits ; img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip ; img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer ; img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate ; img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer ; img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw ; img_draw dd aimg_draw
; img_convert dd aimg_convert
dd 0,0 dd 0,0
alib_init1 db 'lib_init',0 alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение ; aimg_is_img db 'img_is_img',0 ;определяет по данным, может ли библиотека сделать из них изображение
aimg_info db 'img_info',0 ; aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0 ; aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0 ; aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0 ; aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB ; aimg_to_rgb db 'img_to_rgb',0 ;преобразование изображения в данные RGB
aimg_to_rgb2 db 'img_to_rgb2',0 aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных aimg_decode db 'img_decode',0 ;автоматически определяет формат графических данных
aimg_encode db 'img_encode',0 ; aimg_encode db 'img_encode',0
aimg_create db 'img_create',0 ; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0 aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0 ; aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0 ; aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0 ; aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0 ; aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0 ; aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0 ; aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0 ; aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0 ; aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0 ; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
;-------------------------------------------------- ;--------------------------------------------------
system_dir_0 db '/sys/lib/' system_dir_0 db '/sys/lib/'
@ -421,14 +418,14 @@ system_dir_1 db '/sys/lib/'
lib_name_1 db 'buf2d.obj',0 lib_name_1 db 'buf2d.obj',0
system_dir_2 db '/sys/lib/' system_dir_2 db '/sys/lib/'
lib_name_2 db 'libimg.obj',0 lib_name_2 db 'libimg.obj',0
err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,0 err_msg_found_lib_0 db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0
err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,0 err_msg_found_lib_1 db 'Sorry I cannot load library ',39,'buf2d.obj',39,'" -tE',0
err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,0 err_msg_found_lib_2 db 'Sorry I cannot load library ',39,'libimg.obj',39,'" -tE',0
head_f_i: head_f_i:
head_f_l db 'System error',0 head_f_l db '"System error',0
err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,0 err_msg_import_0 db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0
err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,0 err_msg_import_1 db 'Error on load import library ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,0 err_msg_import_2 db 'Error on load import library ',39,'libimg.obj',39,'" -tE',0
;-------------------------------------------------- ;--------------------------------------------------
txt_scale: txt_scale:
@ -482,6 +479,12 @@ l_libs_end:
align 4 align 4
i_end: i_end:
ctx1 rb 28 ;sizeof.TinyGLContext = 28
qObj dd 0
TexObj dd 0 ;массив указателей на текстуры (в данном случае 1 шт.)
texture dd 0 ;указатель на память с текстурой
text_w dd 0
text_h dd 0
run_file_70 FileInfoBlock run_file_70 FileInfoBlock
sc system_colors sc system_colors
align 16 align 16

View File

@ -63,7 +63,6 @@ struct ZBuffer
xsize dd ? ;int xsize dd ? ;int
ysize dd ? ;int ysize dd ? ;int
linesize dd ? ;int ;line size, in bytes linesize dd ? ;int ;line size, in bytes
dd ? ;fix old error offset
mode dd ? ;int mode dd ? ;int
zbuf dd ? ;*unsigned short zbuf dd ? ;*unsigned short

View File

@ -3,20 +3,21 @@ use32
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 1, start, i_end, mem, stacktop, openfile_path, sys_path dd 1, start, i_end, mem, stacktop, openfile_path, sys_path
include '../../../../programs/macros.inc' include '../../../macros.inc'
include '../../../../programs/proc32.inc' include '../../../proc32.inc'
include '../../../../programs/KOSfuncs.inc' include '../../../KOSfuncs.inc'
include '../../../../programs/load_img.inc' include '../../../load_img.inc'
include '../../../../programs/develop/libraries/TinyGL/asm_fork/opengl_const.inc' include '../../../develop/libraries/TinyGL/asm_fork/opengl_const.inc'
include '../../../develop/libraries/TinyGL/asm_fork/zbuffer.inc'
include 'vox_3d.inc' include 'vox_3d.inc'
include '../trunk/str.inc' include '../trunk/str.inc'
include 'lang.inc' include 'lang.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
if lang eq ru if lang eq ru
caption db '<27>à®á¬®âà ¢®ªá¥«¥© 04.05.20',0 ;¯®¤¯¨áì ®ª­  caption db '<27>à®á¬®âà ¢®ªá¥«¥© 11.11.20',0 ;¯®¤¯¨áì ®ª­ 
else else
caption db 'Voxel viewer 04.05.20',0 caption db 'Voxel viewer 11.11.20',0
end if end if
3d_wnd_l equ 5 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  á«¥¢  3d_wnd_l equ 5 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  á«¥¢ 
@ -28,8 +29,6 @@ IMAGE_TOOLBAR_ICON_SIZE equ 16*16*3
IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*10 IMAGE_TOOLBAR_SIZE equ IMAGE_TOOLBAR_ICON_SIZE*10
image_data_toolbar dd 0 image_data_toolbar dd 0
offs_zbuf_pbuf equ 24
align 4 align 4
start: start:
load_libraries l_libs_start,l_libs_end load_libraries l_libs_start,l_libs_end
@ -111,7 +110,7 @@ timer_funct:
fsub dword[delt_size] fsub dword[delt_size]
fstp dword[angle_y] fstp dword[angle_y]
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
popad popad
jmp still jmp still
@ -130,37 +129,28 @@ pushad
mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3,[sc.work_button] mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3,[sc.work_button]
mov ebx,(30 shl 16)+20 mov ebx,(30 shl 16)+20
mov edx,4 mcall ,,,4
int 0x40
add ebx,25 shl 16 add ebx,25 shl 16
mov edx,5 mcall ,,,5
int 0x40
add ebx,30 shl 16 add ebx,30 shl 16
mov edx,6 mcall ,,,6
int 0x40
add ebx,25 shl 16 add ebx,25 shl 16
mov edx,7 mcall ,,,7
int 0x40
add ebx,25 shl 16 add ebx,25 shl 16
mov edx,8 mcall ,,,8
int 0x40
add ebx,25 shl 16 add ebx,25 shl 16
mov edx,9 mcall ,,,9
int 0x40
add ebx,25 shl 16 add ebx,25 shl 16
mov edx,10 mcall ,,,10
int 0x40
add ebx,25 shl 16 add ebx,25 shl 16
mov edx,11 mcall ,,,11
int 0x40
add ebx,25 shl 16 add ebx,25 shl 16
mov edx,12 mcall ,,,12
int 0x40
call draw_toolbar_i call draw_toolbar_i
stdcall [buf2d_draw], buf_0 stdcall [buf2d_draw], buf_0
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
mcall SF_REDRAW,SSF_END_DRAW mcall SF_REDRAW,SSF_END_DRAW
popad popad
@ -241,34 +231,31 @@ key:
fld dword[angle_x] fld dword[angle_x]
fadd dword[delt_size] fadd dword[delt_size]
fstp dword[angle_x] fstp dword[angle_x]
call draw_3d jmp .end0
stdcall [kosglSwapBuffers]
@@: @@:
cmp ah,177 ;Down cmp ah,177 ;Down
jne @f jne @f
fld dword[angle_x] fld dword[angle_x]
fsub dword[delt_size] fsub dword[delt_size]
fstp dword[angle_x] fstp dword[angle_x]
call draw_3d jmp .end0
stdcall [kosglSwapBuffers]
@@: @@:
cmp ah,176 ;Left cmp ah,176 ;Left
jne @f jne @f
fld dword[angle_y] fld dword[angle_y]
fadd dword[delt_size] fadd dword[delt_size]
fstp dword[angle_y] fstp dword[angle_y]
call draw_3d jmp .end0
stdcall [kosglSwapBuffers]
@@: @@:
cmp ah,179 ;Right cmp ah,179 ;Right
jne @f jne still ;@f
fld dword[angle_y] fld dword[angle_y]
fsub dword[delt_size] fsub dword[delt_size]
fstp dword[angle_y] fstp dword[angle_y]
.end0:
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
@@: ;@@:
jmp still jmp still
@ -319,7 +306,7 @@ mouse:
fstp dword[angle_y] fstp dword[angle_y]
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
jmp .end_d jmp .end_d
.end_m: .end_m:
bt eax,16 bt eax,16
@ -562,7 +549,7 @@ align 4
draw_cadr: draw_cadr:
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+offs_zbuf_pbuf] ;eax -> ZBuffer.pbuf mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_1],eax mov dword[buf_1],eax
mov dword[buf_1.w],512 mov dword[buf_1.w],512
@ -615,7 +602,7 @@ proc but_zoom_p uses eax
inc dword[v_zoom] inc dword[v_zoom]
stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom] stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom]
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
@@: @@:
ret ret
endp endp
@ -627,7 +614,7 @@ proc but_zoom_m uses eax
dec dword[v_zoom] dec dword[v_zoom]
stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom] stdcall buf_vox_obj_create_3d,[open_file_data],[open_file_ogl],0,0,[v_zoom]
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
@@: @@:
ret ret
endp endp
@ -646,7 +633,7 @@ proc but_light uses eax ebx ecx edx
.end_light: .end_light:
call draw_toolbar_i call draw_toolbar_i
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
endp endp
@ -655,7 +642,7 @@ proc but_4 uses eax ebx ecx edx
xor word[opt_cube_box],1 xor word[opt_cube_box],1
call draw_toolbar_i call draw_toolbar_i
call draw_3d call draw_3d
stdcall [kosglSwapBuffers] call [kosglSwapBuffers]
ret ret
endp endp
@ -747,7 +734,7 @@ proc but_draw_cadr uses eax ebx ecx edx
cmp word[opt_auto_rotate],0 cmp word[opt_auto_rotate],0
jne @f jne @f
call draw_3d call draw_3d
;stdcall [kosglSwapBuffers] ;call [kosglSwapBuffers]
@@: @@:
ret ret
endp endp
@ -772,7 +759,7 @@ draw_3d:
stdcall [glRotatef], [angle_z],0.0,0.0,1.0 stdcall [glRotatef], [angle_z],0.0,0.0,1.0
stdcall draw_voxels_3d,[open_file_ogl] stdcall draw_voxels_3d,[open_file_ogl]
stdcall [glPopMatrix] call [glPopMatrix]
ret ret
align 4 align 4
@ -911,49 +898,51 @@ l_libs_end:
align 4 align 4
import_libimg: import_libimg:
dd alib_init1 dd alib_init1
img_is_img dd aimg_is_img ; img_is_img dd aimg_is_img
img_info dd aimg_info ; img_info dd aimg_info
img_from_file dd aimg_from_file ; img_from_file dd aimg_from_file
img_to_file dd aimg_to_file ; img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb ; img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb ; img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2 img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode img_decode dd aimg_decode
img_encode dd aimg_encode ; img_encode dd aimg_encode
img_create dd aimg_create ; img_create dd aimg_create
img_destroy dd aimg_destroy img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer ; img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count ; img_count dd aimg_count
img_lock_bits dd aimg_lock_bits ; img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits ; img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip ; img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer ; img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate ; img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer ; img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw ; img_draw dd aimg_draw
; img_convert dd aimg_convert
dd 0,0 dd 0,0
alib_init1 db 'lib_init',0 alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥ ; aimg_is_img db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
aimg_info db 'img_info',0 ; aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0 ; aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0 ; aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0 ; aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB ; aimg_to_rgb db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
aimg_to_rgb2 db 'img_to_rgb2',0 aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå aimg_decode db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
aimg_encode db 'img_encode',0 ; aimg_encode db 'img_encode',0
aimg_create db 'img_create',0 ; aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0 aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0 ; aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0 ; aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0 ; aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0 ; aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0 ; aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0 ; aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0 ; aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0 ; aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0 ; aimg_draw db 'img_draw',0
; aimg_convert db 'img_convert',0
align 4 align 4
proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権 proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
@ -1023,13 +1012,13 @@ macro E_LIB n
{ {
n dd sz_#n n dd sz_#n
} }
include '../../../../programs/develop/libraries/TinyGL/asm_fork/export.inc' include '../../../develop/libraries/TinyGL/asm_fork/export.inc'
dd 0,0 dd 0,0
macro E_LIB n macro E_LIB n
{ {
sz_#n db `n,0 sz_#n db `n,0
} }
include '../../../../programs/develop/libraries/TinyGL/asm_fork/export.inc' include '../../../develop/libraries/TinyGL/asm_fork/export.inc'
last_time dd 0 last_time dd 0
@ -1051,18 +1040,11 @@ buf_1: dd 0 ;㪠
.color: dd 0xffffff ;+16 color .color: dd 0xffffff ;+16 color
db 24 ;+20 bit in pixel db 24 ;+20 bit in pixel
align 4
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
;sizeof.TinyGLContext = 28
scale dd 1.414213562 scale dd 1.414213562
angle_x dd 0.0 angle_x dd 0.0
angle_y dd 0.0 angle_y dd 0.0
angle_z dd 0.0 angle_z dd 0.0
delt_size dd 3.0 delt_size dd 3.0
mouse_drag dd 0 ;०¨¬ ¯®¢®à®â  áæ¥­ë ®â ¯¥à¥¬¥é¥­¨¨ ªãàá®à  ¬ëè¨
mouse_x dd 0
mouse_y dd 0
angle_dxm dd 2.8444 ;~ 3d_wnd_w/180 - ¯à¨¡ ¢«¥­¨¥ 㣫®¢ ¯®¢®à®â  áæ¥­ë ¯à¨ ¢à é¥­¨¨ ¬ë襩 angle_dxm dd 2.8444 ;~ 3d_wnd_w/180 - ¯à¨¡ ¢«¥­¨¥ 㣫®¢ ¯®¢®à®â  áæ¥­ë ¯à¨ ¢à é¥­¨¨ ¬ë襩
angle_dym dd 2.8444 ;~ 3d_wnd_h/180 angle_dym dd 2.8444 ;~ 3d_wnd_h/180
@ -1082,6 +1064,10 @@ lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ;
align 16 align 16
i_end: i_end:
ctx1 rb 28 ;sizeof.TinyGLContext = 28
mouse_drag dd 0 ;०¨¬ ¯®¢®à®â  áæ¥­ë ®â ¯¥à¥¬¥é¥­¨¨ ªãàá®à  ¬ëè¨
mouse_x dd 0
mouse_y dd 0
rb 4096 rb 4096
stacktop: stacktop:
sys_path rb 1024 sys_path rb 1024