Compare commits
1 Commits
qrcodegen
...
3e03bd4e10
Author | SHA1 | Date | |
---|---|---|---|
3e03bd4e10 |
@@ -605,6 +605,7 @@ tup.append_table(extra_files, {
|
||||
{"kolibrios/3D/voxel_utilites/VOX_CREATOR" , VAR_PROGS .. "/media/voxel_editor/utilites/vox_creator"},
|
||||
{"kolibrios/3D/voxel_utilites/VOX_MOVER" , VAR_PROGS .. "/media/voxel_editor/utilites/vox_mover"},
|
||||
{"kolibrios/3D/voxel_utilites/VOX_TGL" , VAR_PROGS .. "/media/voxel_editor/utilites/vox_tgl"},
|
||||
{"kolibrios/demos/flag", VAR_PROGS .. "/demos/flag/flag"},
|
||||
{"kolibrios/demos/life3", VAR_PROGS .. "/games/life3/life3"},
|
||||
{"kolibrios/demos/qjulia", VAR_PROGS .. "/demos/qjulia/trunk/qjulia"},
|
||||
{"kolibrios/develop/koldbg", VAR_PROGS .. "/develop/koldbg/koldbg"},
|
||||
|
2
programs/demos/flag/Tupfile.lua
Normal file
2
programs/demos/flag/Tupfile.lua
Normal file
@@ -0,0 +1,2 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
tup.rule("flag.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "flag")
|
315
programs/demos/flag/flag.asm
Normal file
315
programs/demos/flag/flag.asm
Normal file
@@ -0,0 +1,315 @@
|
||||
; SPDX-License-Identifier: GPL-2.0-only
|
||||
; Program - demo program shows a flag with the inscription 'KolibriOS'
|
||||
; Copyright (C) 2011-2025 KolibriOS team
|
||||
|
||||
use32
|
||||
org 0
|
||||
db 'MENUET01'
|
||||
dd 1,start,i_end,mem,stacktop,0,cur_dir_path
|
||||
|
||||
include '../../proc32.inc'
|
||||
include '../../macros.inc'
|
||||
include '../../KOSfuncs.inc'
|
||||
include '../../load_lib.mac'
|
||||
include '../../dll.inc'
|
||||
include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc'
|
||||
include '../../develop/libraries/TinyGL/asm_fork/examples/fps.inc'
|
||||
|
||||
@use_library
|
||||
|
||||
;Macro for double type parameters (8 bytes)
|
||||
macro glpush GLDoubleVar {
|
||||
push dword[GLDoubleVar+4]
|
||||
push dword[GLDoubleVar]
|
||||
}
|
||||
|
||||
align 4
|
||||
start:
|
||||
load_library name_tgl, library_path, system_path, import_tinygl
|
||||
cmp eax,SF_TERMINATE_PROCESS
|
||||
jz button.exit
|
||||
|
||||
mcall SF_SET_EVENTS_MASK, 0x27
|
||||
|
||||
; *** init ***
|
||||
stdcall [kosglMakeCurrent], 0,15,600,380,ctx1
|
||||
|
||||
stdcall [glMatrixMode], GL_MODELVIEW
|
||||
call [glLoadIdentity]
|
||||
|
||||
stdcall [glClearColor], 0.549, 0.549, 0.588, 1.0
|
||||
|
||||
;stdcall [glEnable], GL_LIGHTING
|
||||
;stdcall [glLightf], GL_LIGHT0, GL_SPOT_EXPONENT, 0.0
|
||||
;stdcall [glLightf], GL_LIGHT0, GL_SPOT_CUTOFF, 180.0
|
||||
;stdcall [glEnable], GL_LIGHT0
|
||||
|
||||
stdcall [glLightfv], GL_LIGHT0, GL_POSITION, lightpos
|
||||
stdcall [glLightfv], GL_LIGHT0, GL_SPOT_DIRECTION, lightdirect
|
||||
|
||||
stdcall [glEnable], GL_COLOR_MATERIAL
|
||||
|
||||
glpush p3
|
||||
stdcall [glClearDepth]
|
||||
stdcall [glEnable], GL_CULL_FACE
|
||||
stdcall [glEnable], GL_DEPTH_TEST
|
||||
|
||||
mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 1
|
||||
fninit
|
||||
|
||||
stdcall reshape, 600,380
|
||||
; *** end init ***
|
||||
|
||||
|
||||
align 4
|
||||
red_win:
|
||||
call draw_window
|
||||
mcall SF_THREAD_INFO, procinfo,-1
|
||||
mov eax,dword[procinfo.box.height]
|
||||
cmp eax,120
|
||||
jge @f
|
||||
mov eax,120 ;min size
|
||||
@@:
|
||||
sub eax,43
|
||||
mov ebx,dword[procinfo.box.width]
|
||||
cmp ebx,200
|
||||
jge @f
|
||||
mov ebx,200
|
||||
@@:
|
||||
sub ebx,10
|
||||
stdcall reshape, ebx,eax
|
||||
.end0:
|
||||
|
||||
align 16
|
||||
still:
|
||||
call draw_3d
|
||||
cmp dword[stop],1
|
||||
je @f
|
||||
stdcall Fps, 365,4
|
||||
|
||||
mov dword[esp-4],eax
|
||||
fild dword[esp-4]
|
||||
fmul dword[delt_3]
|
||||
fchs
|
||||
fadd dword[dangle]
|
||||
fstp dword[dangle] ;dangle -= 0.01*Fps(x,y)
|
||||
|
||||
;mcall SF_CHECK_EVENT
|
||||
mcall SF_WAIT_EVENT_TIMEOUT, 1
|
||||
jmp .end0
|
||||
align 4
|
||||
@@:
|
||||
mcall SF_WAIT_EVENT
|
||||
.end0:
|
||||
cmp al, EV_REDRAW
|
||||
jz red_win
|
||||
cmp al, EV_KEY
|
||||
jz key
|
||||
cmp al, EV_BUTTON
|
||||
jz button
|
||||
|
||||
jmp still
|
||||
|
||||
|
||||
; new window size or exposure
|
||||
align 4
|
||||
proc reshape, width:dword, height:dword
|
||||
locals
|
||||
dxy dq ?
|
||||
endl
|
||||
stdcall [glViewport], 0, 0, [width], [height]
|
||||
stdcall [glMatrixMode], GL_PROJECTION
|
||||
call [glLoadIdentity]
|
||||
fild dword[width]
|
||||
fidiv dword[height]
|
||||
fstp qword[dxy] ;dxy = width/height
|
||||
glpush p4
|
||||
glpush p3
|
||||
glpush dxy
|
||||
glpush p1
|
||||
call [gluPerspective] ;28.0, width/height, 1.0, 40.0
|
||||
|
||||
stdcall [glMatrixMode], GL_MODELVIEW
|
||||
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
p1 dq 28.0
|
||||
p3 dq 1.0
|
||||
p4 dq 40.0
|
||||
|
||||
align 4
|
||||
draw_window:
|
||||
pushad
|
||||
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
||||
|
||||
mcall SF_CREATE_WINDOW, (50 shl 16)+609,(30 shl 16)+425,0x33404040,,title1
|
||||
call [kosglSwapBuffers]
|
||||
|
||||
;Title
|
||||
mcall SF_DRAW_TEXT, (338 shl 16)+4, 0xc0c0c0, fps, fps.end-fps
|
||||
mcall SF_DRAW_TEXT, (8 shl 16)+4, 0xc0c0c0, title3, title3.end-title3
|
||||
;mcall SF_DRAW_TEXT, (180 shl 16)+4, 0xc0c0c0, title2, title2.end-title2
|
||||
|
||||
mcall SF_REDRAW,SSF_END_DRAW
|
||||
popad
|
||||
ret
|
||||
|
||||
align 4
|
||||
key:
|
||||
mcall SF_GET_KEY
|
||||
|
||||
cmp ah,27 ;Esc
|
||||
je button.exit
|
||||
|
||||
cmp ah,112 ;P
|
||||
jne @f
|
||||
xor dword[stop],1
|
||||
jmp still
|
||||
@@:
|
||||
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
button:
|
||||
mcall SF_GET_BUTTON
|
||||
cmp ah,1
|
||||
jne still
|
||||
.exit:
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
|
||||
|
||||
align 4
|
||||
title1: db 'TinyGL in KolibriOS'
|
||||
.end: db 0
|
||||
;title2: db 'F full screen'
|
||||
;.end: db 0
|
||||
title3: db 'ESC - exit, P - pause'
|
||||
.end: db 0
|
||||
fps: db 'FPS:'
|
||||
.end: db 0
|
||||
|
||||
align 16
|
||||
proc draw_3d uses ebx ecx edx esi edi
|
||||
locals
|
||||
z dd ?
|
||||
endl
|
||||
call [glLoadIdentity]
|
||||
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT
|
||||
stdcall [glTranslatef], 0.0, 0.0, -2.0
|
||||
stdcall [glRotatef], 10.0, 0.0, 0.0, 1.0
|
||||
stdcall [glRotatef], 43.0, 0.0, 1.0, 0.0
|
||||
stdcall [glTranslatef], -0.6, -0.2, -0.1
|
||||
|
||||
mov edi, logo+9*41 ;edi = logo[9][0]
|
||||
mov esi, 41 ;esi = i
|
||||
align 4
|
||||
.cycle0: ;for(int i=0;i<41;i++)
|
||||
stdcall [glTranslatef], 0.045, 0.0, 0.0
|
||||
call [glPushMatrix]
|
||||
fld dword[angle]
|
||||
fsin
|
||||
fmul dword[delt_1]
|
||||
fstp dword[z] ;= 0.08*sin(angle)
|
||||
|
||||
fld dword[angle]
|
||||
fadd dword[delt_2]
|
||||
fstp dword[angle] ;angle += 0.2
|
||||
|
||||
mov ecx, 9
|
||||
mov ebx, edi
|
||||
|
||||
; ebx = @temp1, ecx = j
|
||||
.cycle1: ;for(int j=9;j>=0;j--)
|
||||
cmp byte[ebx],0 ;if(logo[j][i])
|
||||
je @f
|
||||
push 0.0 ;b
|
||||
push 0.0 ;g
|
||||
push 1.0 ;r
|
||||
jmp .end_c2
|
||||
@@:
|
||||
push 0.945 ;b
|
||||
push 0.855 ;g
|
||||
push 0.859 ;r
|
||||
.end_c2:
|
||||
call [glColor3f]
|
||||
stdcall [glTranslatef], 0.0, 0.045, 0.0
|
||||
stdcall [glBegin], GL_QUADS
|
||||
stdcall [glVertex3f], 0.0, -0.04,[z]
|
||||
stdcall [glVertex3f], 0.04,-0.04,[z]
|
||||
stdcall [glVertex3f], 0.04, 0.0, [z]
|
||||
stdcall [glVertex3f], 0.0, 0.0, [z]
|
||||
call [glEnd]
|
||||
add ebx, -41
|
||||
dec ecx
|
||||
jnz .cycle1
|
||||
|
||||
call [glPopMatrix]
|
||||
inc edi ;edi = logo[9][i]
|
||||
dec esi
|
||||
jnz .cycle0
|
||||
|
||||
mov edx,dword[dangle]
|
||||
mov dword[angle],edx
|
||||
call [kosglSwapBuffers]
|
||||
|
||||
ret
|
||||
endp
|
||||
|
||||
align 4
|
||||
delt_1 dd 0.08
|
||||
delt_2 dd 0.2
|
||||
delt_3 dd 0.01
|
||||
|
||||
lightpos dd 2.0, 0.0, -2.5, 1.0
|
||||
lightdirect dd 0.0, 0.0, -0.7
|
||||
angle dd 0.0
|
||||
dangle dd 0.0
|
||||
|
||||
stop dd 0
|
||||
|
||||
;[10][41]
|
||||
logo db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
db 0,0,1,0,0,0,1,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0,1,0,0,1,1,1,0,0,0,1,1,1,0,0,0,\
|
||||
0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,\
|
||||
0,0,1,0,1,0,0,0,0,1,1,0,0,1,0,1,0,1,1,1,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,1,1,0,0,0,0,\
|
||||
0,0,1,1,1,0,0,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,\
|
||||
0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,\
|
||||
0,0,1,0,0,0,1,0,0,1,1,0,0,1,0,1,0,0,1,1,0,0,1,0,0,0,1,0,0,1,1,1,0,0,0,1,1,1,0,0,0
|
||||
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
|
||||
|
||||
;--------------------------------------------------
|
||||
align 4
|
||||
import_tinygl:
|
||||
|
||||
macro E_LIB n
|
||||
{
|
||||
n dd sz_#n
|
||||
}
|
||||
include '../../develop/libraries/TinyGL/asm_fork/export.inc'
|
||||
dd 0,0
|
||||
macro E_LIB n
|
||||
{
|
||||
sz_#n db `n,0
|
||||
}
|
||||
include '../../develop/libraries/TinyGL/asm_fork/export.inc'
|
||||
|
||||
;--------------------------------------------------
|
||||
system_path db '/sys/lib/'
|
||||
name_tgl db 'tinygl.obj',0
|
||||
;--------------------------------------------------
|
||||
|
||||
align 16
|
||||
i_end:
|
||||
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
|
||||
;sizeof.TinyGLContext = 28
|
||||
procinfo process_information
|
||||
cur_dir_path rb 4096
|
||||
library_path rb 4096
|
||||
rb 4096
|
||||
stacktop:
|
||||
mem:
|
@@ -1082,7 +1082,7 @@ l_libs_start:
|
||||
lib_2 l_libs lib_name_2, file_name, system_dir_2, import_box_lib
|
||||
lib_3 l_libs lib_name_3, file_name, system_dir_3, import_buf2d
|
||||
lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu
|
||||
lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl
|
||||
lib_5 l_libs lib_name_5, file_name, system_dir_5, import_tinygl
|
||||
lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini
|
||||
l_libs_end:
|
||||
|
||||
@@ -1287,7 +1287,7 @@ dd 0,0
|
||||
akmenuitem_draw db 'kmenuitem_draw',0
|
||||
|
||||
align 4
|
||||
import_lib_tinygl:
|
||||
import_tinygl:
|
||||
macro E_LIB n
|
||||
{
|
||||
n dd sz_#n
|
||||
@@ -1343,7 +1343,7 @@ buf_1:
|
||||
align 4
|
||||
el_focus dd tree1
|
||||
tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\
|
||||
16,16, 0xffffff,0xb0d0ff,0x400040, 5,35,195-16,250, 16,list_offs_text,0,\
|
||||
16,16, 0xffffff,0xb0d0ff,0x10400040, 5,35,195-16,250, 16,list_offs_text,0,\
|
||||
el_focus,w_scr_t1,0
|
||||
|
||||
align 4
|
||||
@@ -1362,9 +1362,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ;
|
||||
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20><>ࠬ<EFBFBD><E0A0AC><EFBFBD><EFBFBD> 䮭<><E4AEAD><EFBFBD><EFBFBD><EFBFBD> <20>ᢥ饭<E1A2A5><E9A5AD>
|
||||
|
||||
if lang eq ru_RU
|
||||
capt db 'info 3ds <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 29.09.20',0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
capt db 'info 3ds <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 14.04.25',0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
else ; Default to en_US
|
||||
capt db 'info 3ds version 29.09.20',0 ;window caption
|
||||
capt db 'info 3ds version 14.04.25',0 ;window caption
|
||||
end if
|
||||
|
||||
align 16
|
||||
|
@@ -1408,7 +1408,7 @@ buf_1:
|
||||
align 4
|
||||
el_focus dd tree1
|
||||
tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\
|
||||
16,16, 0xffffff,0xb0d0ff,0x400040, 5,47,195-16,250, 16,list_offs_text,0, el_focus,\
|
||||
16,16, 0xffffff,0xb0d0ff,0x10400040, 5,47,195-16,250, 16,list_offs_text,0, el_focus,\
|
||||
w_scr_t1,0
|
||||
|
||||
align 4
|
||||
@@ -1427,9 +1427,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ;
|
||||
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20><>ࠬ<EFBFBD><E0A0AC><EFBFBD><EFBFBD> 䮭<><E4AEAD><EFBFBD><EFBFBD><EFBFBD> <20>ᢥ饭<E1A2A5><E9A5AD>
|
||||
|
||||
if lang eq ru_RU
|
||||
capt db 'info 3ds [user] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 29.09.20',0 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
capt db 'info 3ds [user] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 14.04.25',0 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
else ; Default to en_US
|
||||
capt db 'info 3ds [user] version 29.09.20',0 ; Window caption
|
||||
capt db 'info 3ds [user] version 14.04.25',0 ; Window caption
|
||||
end if
|
||||
|
||||
align 16
|
||||
|
@@ -812,9 +812,8 @@ proc draw_3d uses eax ebx ecx edi, o_data:dword
|
||||
@@:
|
||||
stdcall [glDisable],GL_LIGHTING
|
||||
.end_l:
|
||||
stdcall [glTranslatef], 0.0,0.0,0.5 ;correct for z
|
||||
stdcall [glScalef], [edi+obj_3d.x_scale],[edi+obj_3d.y_scale],[edi+obj_3d.z_scale]
|
||||
stdcall [glScalef], 1.0,1.0,0.7 ;correct for z
|
||||
stdcall [glScalef], 1.0,1.0,1.4 ;correct for z
|
||||
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
|
||||
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
|
||||
stdcall [glRotatef], [angle_x],1.0,0.0,0.0
|
||||
|
@@ -951,13 +951,12 @@ endl
|
||||
endp
|
||||
|
||||
align 4
|
||||
proc glClearDepth uses eax, depth:dword
|
||||
proc glClearDepth uses eax, depth:qword
|
||||
locals
|
||||
p rd 2
|
||||
endl
|
||||
mov dword[p],OP_ClearDepth
|
||||
mov eax,[depth]
|
||||
fld qword[eax]
|
||||
fld qword[depth]
|
||||
fstp dword[p+4]
|
||||
|
||||
lea eax,[ebp-8] ;=sizeof(dd)*2
|
||||
|
@@ -23,8 +23,7 @@ endl
|
||||
imul ecx,ebx
|
||||
shl ecx,2
|
||||
add ecx,[eax+GLContext.color_array] ;ecx = &context.color_array[i]
|
||||
mov ebx,ebp
|
||||
sub ebx,20 ;=sizeof(dd)*5
|
||||
lea ebx,[ebp-20] ;=sizeof(dd)*5
|
||||
mov edx,[ecx]
|
||||
mov [ebx+4],edx
|
||||
mov edx,[ecx+4]
|
||||
@@ -48,8 +47,7 @@ endl
|
||||
imul esi,ebx
|
||||
shl esi,2
|
||||
add esi,[eax+GLContext.normal_array] ;esi = &normal_array[ebx * (3 + c->normal_array_stride)]
|
||||
mov edi,eax
|
||||
add edi,GLContext.current_normal
|
||||
lea edi,[eax+GLContext.current_normal]
|
||||
mov ecx,3
|
||||
rep movsd
|
||||
mov dword[edi],0.0
|
||||
@@ -92,8 +90,7 @@ endl
|
||||
imul ecx,ebx
|
||||
shl ecx,2
|
||||
add ecx,[eax+GLContext.vertex_array] ;ecx = &context.vertex_array[i]
|
||||
mov ebx,ebp
|
||||
sub ebx,20 ;=sizeof(dd)*5
|
||||
lea ebx,[ebp-20] ;=sizeof(dd)*5
|
||||
mov edx,[ecx]
|
||||
mov [ebx+4],edx
|
||||
mov edx,[ecx+4]
|
||||
@@ -130,8 +127,7 @@ endl
|
||||
mov eax,[i]
|
||||
mov dword[p+4],eax
|
||||
|
||||
mov eax,ebp
|
||||
sub eax,8 ;=sizeof(dd)*2
|
||||
lea eax,[ebp-8] ;=sizeof(dd)*2
|
||||
stdcall gl_add_op,eax
|
||||
ret
|
||||
endp
|
||||
@@ -139,10 +135,9 @@ endp
|
||||
align 4
|
||||
proc glopDrawArrays, context:dword, param:dword
|
||||
locals
|
||||
vi dd ?
|
||||
idx dd ?
|
||||
states dd ?
|
||||
size dd ?
|
||||
a_size dd ?
|
||||
p rd 8 ;функция glopColor требует 8 параметров, другие функции требуют меньше, берем по максимуму что-бы не портить стек
|
||||
endl
|
||||
pushad
|
||||
@@ -155,132 +150,19 @@ pushad
|
||||
mov [idx],eax ;param[2].i
|
||||
mov eax,[ebx+4]
|
||||
mov [p+4],eax ;p[1].i = param[1].i
|
||||
mov eax,ebp
|
||||
sub eax,32 ;=sizeof(dd)*8
|
||||
lea eax,[ebp-32] ;=sizeof(dd)*8
|
||||
stdcall glopBegin, edx,eax
|
||||
|
||||
mov dword[vi],0
|
||||
cmp ecx,1
|
||||
jl @f
|
||||
align 4
|
||||
.cycle_0: ;for (int vi=0; vi<count; vi++)
|
||||
cmp dword[vi],ecx
|
||||
jge .cycle_0_end
|
||||
bt dword[states],1 ;2^1=COLOR_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.color_array_size]
|
||||
mov [size],esi
|
||||
add esi,[edx+GLContext.color_array_stride]
|
||||
imul esi,[idx] ;esi = i
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.color_array] ;esi = &context.color_array[i]
|
||||
mov edi,ebp
|
||||
sub edi,28 ;edi = &p[1]
|
||||
mov ebx,[esi+8]
|
||||
mov [edi],ebx ;p[1].f = context.color_array[i+2]
|
||||
mov ebx,[esi+4]
|
||||
mov [edi+4],ebx ;p[2].f = context.color_array[i+1]
|
||||
mov ebx,[esi]
|
||||
mov [edi+8],ebx ;p[3].f = context.color_array[i]
|
||||
add edi,12
|
||||
cmp dword[size],3
|
||||
jle .e1
|
||||
add esi,12
|
||||
movsd
|
||||
jmp .e2
|
||||
.e1:
|
||||
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
|
||||
.e2:
|
||||
mov edi,ebp
|
||||
sub edi,32 ;edi = &p[0]
|
||||
mov ebx,ebp
|
||||
sub ebx,12 ;ebp-12 = &p[5]
|
||||
push ebx
|
||||
add ebx,4 ;ebp-8 = &p[6]
|
||||
push ebx
|
||||
add ebx,4 ;ebp-4 = &p[7]
|
||||
push ebx
|
||||
stdcall RGBFtoRGBI,[edi+12],[edi+8],[edi+4] ;call: r,g,b,&p[7],&p[6],&p[5]
|
||||
stdcall glopColor, edx,edi ;(context, p(op,rf,gf,bf,af,ri,gi,bi))
|
||||
@@:
|
||||
bt dword[states],2 ;2^2=NORMAL_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.normal_array_stride]
|
||||
add esi,3
|
||||
imul esi,[idx]
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.normal_array] ;esi = &context.normal_array[ idx * (3 + context.normal_array_stride) ]
|
||||
mov edi,edx
|
||||
add edi,GLContext.current_normal
|
||||
movsd ;context.current_normal.X = context.normal_array[i]
|
||||
movsd
|
||||
movsd
|
||||
mov dword[edi],0.0 ;context.current_normal.W = 0.0f
|
||||
@@:
|
||||
bt dword[states],3 ;2^3=TEXCOORD_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.texcoord_array_size]
|
||||
mov [size],esi
|
||||
add esi,[edx+GLContext.texcoord_array_stride]
|
||||
imul esi,[idx] ;esi = i
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.texcoord_array] ;esi = &context.texcoord_array[i]
|
||||
mov edi,edx
|
||||
add edi,GLContext.current_tex_coord
|
||||
movsd ;context.current_tex_coord.X = ccontext.texcoord_array[i]
|
||||
movsd
|
||||
cmp dword[size],2
|
||||
jle .e3
|
||||
movsd
|
||||
jmp .e4
|
||||
.e3:
|
||||
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
|
||||
add edi,4
|
||||
.e4:
|
||||
cmp dword[size],3
|
||||
jle .e5
|
||||
movsd
|
||||
jmp @f
|
||||
.e5:
|
||||
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
|
||||
@@:
|
||||
bt dword[states],0 ;2^0=VERTEX_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.vertex_array_size]
|
||||
mov [size],esi
|
||||
add esi,[edx+GLContext.vertex_array_stride]
|
||||
imul esi,[idx] ;esi = i
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.vertex_array] ;esi = &context.vertex_array[i]
|
||||
mov edi,ebp
|
||||
sub edi,28 ;edi = &p[1]
|
||||
movsd ;p[1].f = context.vertex_array[i]
|
||||
movsd
|
||||
cmp dword[size],2
|
||||
jle .e6
|
||||
movsd
|
||||
jmp .e7
|
||||
.e6:
|
||||
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
|
||||
add edi,4
|
||||
jmp .e8 ;и 4-й тоже ставим по умолчанию
|
||||
.e7:
|
||||
cmp dword[size],3
|
||||
jle .e8
|
||||
movsd
|
||||
sub edi,20 ;edi=&p[0]
|
||||
jmp .e9
|
||||
.e8:
|
||||
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
|
||||
sub edi,16 ;edi=&p[0]
|
||||
.e9:
|
||||
stdcall glopVertex, edx,edi
|
||||
@@:
|
||||
call CopyArrayElementByIndex
|
||||
inc dword[idx]
|
||||
inc dword[vi]
|
||||
jmp .cycle_0
|
||||
.cycle_0_end:
|
||||
loop .cycle_0
|
||||
@@:
|
||||
|
||||
;mov eax,ebp
|
||||
;sub eax,32 ;=sizeof(dd)*8
|
||||
lea eax,[ebp-32] ;=sizeof(dd)*8
|
||||
stdcall glopEnd, edx,eax
|
||||
popad
|
||||
ret
|
||||
@@ -299,8 +181,7 @@ endl
|
||||
mov eax,[count]
|
||||
mov dword[p+12],eax
|
||||
|
||||
mov eax,ebp
|
||||
sub eax,16 ;=sizeof(dd)*4
|
||||
lea eax,[ebp-16] ;=sizeof(dd)*4
|
||||
stdcall gl_add_op,eax
|
||||
ret
|
||||
endp
|
||||
@@ -308,12 +189,12 @@ endp
|
||||
align 4
|
||||
proc glopDrawElements, context:dword, param:dword
|
||||
locals
|
||||
type dd ?
|
||||
indices dd ? ;указатель на 16 или 32 битные индексы
|
||||
ii dd ?
|
||||
idx dd ?
|
||||
states dd ?
|
||||
type dd ?
|
||||
size dd ?
|
||||
indices dd ? ;указатель на 16 или 32 битные индексы
|
||||
a_size dd ?
|
||||
p rd 8
|
||||
endl
|
||||
pushad
|
||||
@@ -328,8 +209,7 @@ pushad
|
||||
mov [type],eax ;type = param[3].i
|
||||
mov eax,[ebx+16]
|
||||
mov [indices],eax ;*indices = param[4].p
|
||||
mov eax,ebp
|
||||
sub eax,32 ;=sizeof(dd)*8
|
||||
lea eax,[ebp-32] ;=sizeof(dd)*8
|
||||
stdcall glopBegin, edx,eax
|
||||
|
||||
mov dword[ii],0
|
||||
@@ -351,127 +231,133 @@ align 4
|
||||
.end_0:
|
||||
mov [idx],esi
|
||||
|
||||
bt dword[states],1 ;2^1=COLOR_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.color_array_size]
|
||||
mov [size],esi
|
||||
add esi,[edx+GLContext.color_array_stride]
|
||||
imul esi,[idx] ;esi = i
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.color_array] ;esi = &context.color_array[i]
|
||||
mov edi,ebp
|
||||
sub edi,28 ;edi = &p[1]
|
||||
mov ebx,[esi+8]
|
||||
mov [edi],ebx ;p[1].f = context.color_array[i+2]
|
||||
mov ebx,[esi+4]
|
||||
mov [edi+4],ebx ;p[2].f = context.color_array[i+1]
|
||||
mov ebx,[esi]
|
||||
mov [edi+8],ebx ;p[3].f = context.color_array[i]
|
||||
add edi,12
|
||||
cmp dword[size],3
|
||||
jle .e1
|
||||
add esi,12
|
||||
movsd
|
||||
jmp .e2
|
||||
.e1:
|
||||
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
|
||||
.e2:
|
||||
mov edi,ebp
|
||||
sub edi,32 ;edi = &p[0]
|
||||
mov ebx,ebp
|
||||
sub ebx,12 ;ebp-12 = &p[5]
|
||||
push ebx
|
||||
add ebx,4 ;ebp-8 = &p[6]
|
||||
push ebx
|
||||
add ebx,4 ;ebp-4 = &p[7]
|
||||
push ebx
|
||||
stdcall RGBFtoRGBI,[edi+12],[edi+8],[edi+4] ;call: r,g,b,&p[7],&p[6],&p[5]
|
||||
stdcall glopColor, edx,edi ;(context, p(op,rf,gf,bf,af,ri,gi,bi))
|
||||
@@:
|
||||
bt dword[states],2 ;2^2=NORMAL_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.normal_array_stride]
|
||||
add esi,3
|
||||
imul esi,[idx] ;esi = idx * (3 + context.normal_array_stride)
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.normal_array]
|
||||
mov edi,edx
|
||||
add edi,GLContext.current_normal
|
||||
movsd ;context.current_normal.X = context.normal_array[i]
|
||||
movsd
|
||||
movsd
|
||||
mov dword[edi],0.0 ;context.current_normal.W = 0.0f
|
||||
@@:
|
||||
bt dword[states],3 ;2^3=TEXCOORD_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.texcoord_array_size]
|
||||
mov [size],esi
|
||||
add esi,[edx+GLContext.texcoord_array_stride]
|
||||
imul esi,[idx] ;esi = i
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.texcoord_array] ;esi = &context.texcoord_array[i]
|
||||
mov edi,edx
|
||||
add edi,GLContext.current_tex_coord
|
||||
movsd ;context.current_tex_coord.X = ccontext.texcoord_array[i]
|
||||
movsd
|
||||
cmp dword[size],2
|
||||
jle .e3
|
||||
movsd
|
||||
jmp .e4
|
||||
.e3:
|
||||
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
|
||||
add edi,4
|
||||
.e4:
|
||||
cmp dword[size],3
|
||||
jle .e5
|
||||
movsd
|
||||
jmp @f
|
||||
.e5:
|
||||
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
|
||||
@@:
|
||||
bt dword[states],0 ;2^0=VERTEX_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.vertex_array_size]
|
||||
mov [size],esi
|
||||
add esi,[edx+GLContext.vertex_array_stride]
|
||||
imul esi,[idx] ;esi = i
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.vertex_array] ;esi = &context.vertex_array[i]
|
||||
mov edi,ebp
|
||||
sub edi,28 ;edi = &p[1]
|
||||
movsd ;p[1].f = context.vertex_array[i]
|
||||
movsd
|
||||
cmp dword[size],2
|
||||
jle .e6
|
||||
movsd
|
||||
jmp .e7
|
||||
.e6:
|
||||
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
|
||||
add edi,4
|
||||
jmp .e8 ;и 4-й тоже ставим по умолчанию
|
||||
.e7:
|
||||
cmp dword[size],3
|
||||
jle .e8
|
||||
movsd
|
||||
sub edi,20 ;edi=&p[0]
|
||||
jmp .e9
|
||||
.e8:
|
||||
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
|
||||
sub edi,16 ;edi=&p[0]
|
||||
.e9:
|
||||
stdcall glopVertex, edx,edi
|
||||
@@:
|
||||
call CopyArrayElementByIndex
|
||||
inc dword[ii]
|
||||
jmp .cycle_0
|
||||
.cycle_0_end:
|
||||
|
||||
mov eax,ebp
|
||||
sub eax,32 ;=sizeof(dd)*8
|
||||
lea eax,[ebp-32] ;=sizeof(dd)*8
|
||||
stdcall glopEnd, edx,eax
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
;input:
|
||||
; edx - GLContext
|
||||
idx equ ebp-44
|
||||
states equ ebp-40
|
||||
a_size equ ebp-36
|
||||
align 4
|
||||
CopyArrayElementByIndex:
|
||||
bt dword[states],1 ;2^1=COLOR_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.color_array_size]
|
||||
mov [a_size],esi
|
||||
add esi,[edx+GLContext.color_array_stride]
|
||||
imul esi,[idx] ;esi = i
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.color_array] ;esi = &context.color_array[i]
|
||||
lea edi,[ebp-28] ;edi = &p[1]
|
||||
mov ebx,[esi+8]
|
||||
mov [edi],ebx ;p[1].f = context.color_array[i+2]
|
||||
mov ebx,[esi+4]
|
||||
mov [edi+4],ebx ;p[2].f = context.color_array[i+1]
|
||||
mov ebx,[esi]
|
||||
mov [edi+8],ebx ;p[3].f = context.color_array[i]
|
||||
add edi,12
|
||||
cmp dword[a_size],3
|
||||
jle .e1
|
||||
add esi,12
|
||||
movsd
|
||||
jmp .e2
|
||||
.e1:
|
||||
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
|
||||
.e2:
|
||||
lea edi,[ebp-32] ;edi = &p[0]
|
||||
lea ebx,[ebp-12] ;ebp-12 = &p[5]
|
||||
push ebx
|
||||
add ebx,4 ;ebp-8 = &p[6]
|
||||
push ebx
|
||||
add ebx,4 ;ebp-4 = &p[7]
|
||||
push ebx
|
||||
stdcall RGBFtoRGBI,[edi+12],[edi+8],[edi+4] ;call: r,g,b,&p[7],&p[6],&p[5]
|
||||
stdcall glopColor, edx,edi ;(context, p(op,rf,gf,bf,af,ri,gi,bi))
|
||||
@@:
|
||||
bt dword[states],2 ;2^2=NORMAL_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.normal_array_stride]
|
||||
add esi,3
|
||||
imul esi,[idx] ;esi = idx * (3 + context.normal_array_stride)
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.normal_array] ;esi = &context.normal_array[ idx * (3 + context.normal_array_stride) ]
|
||||
lea edi,[edx+GLContext.current_normal]
|
||||
movsd ;context.current_normal.X = context.normal_array[i]
|
||||
movsd
|
||||
movsd
|
||||
mov dword[edi],0.0 ;context.current_normal.W = 0.0f
|
||||
@@:
|
||||
bt dword[states],3 ;2^3=TEXCOORD_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.texcoord_array_size]
|
||||
mov [a_size],esi
|
||||
add esi,[edx+GLContext.texcoord_array_stride]
|
||||
imul esi,[idx] ;esi = i
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.texcoord_array] ;esi = &context.texcoord_array[i]
|
||||
lea edi,[edx+GLContext.current_tex_coord]
|
||||
movsd ;context.current_tex_coord.X = ccontext.texcoord_array[i]
|
||||
movsd
|
||||
cmp dword[a_size],2
|
||||
jle .e3
|
||||
movsd
|
||||
jmp .e4
|
||||
.e3:
|
||||
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
|
||||
add edi,4
|
||||
.e4:
|
||||
cmp dword[a_size],3
|
||||
jle .e5
|
||||
movsd
|
||||
jmp @f
|
||||
.e5:
|
||||
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
|
||||
@@:
|
||||
bt dword[states],0 ;2^0=VERTEX_ARRAY
|
||||
jnc @f
|
||||
mov esi,[edx+GLContext.vertex_array_size]
|
||||
mov [a_size],esi
|
||||
add esi,[edx+GLContext.vertex_array_stride]
|
||||
imul esi,[idx] ;esi = i
|
||||
shl esi,2
|
||||
add esi,[edx+GLContext.vertex_array] ;esi = &context.vertex_array[i]
|
||||
lea edi,[ebp-28] ;edi = &p[1]
|
||||
movsd ;p[1].f = context.vertex_array[i]
|
||||
movsd
|
||||
cmp dword[a_size],2
|
||||
jle .e6
|
||||
movsd
|
||||
jmp .e7
|
||||
.e6:
|
||||
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
|
||||
add edi,4
|
||||
jmp .e8 ;и 4-й тоже ставим по умолчанию
|
||||
.e7:
|
||||
cmp dword[a_size],3
|
||||
jle .e8
|
||||
movsd
|
||||
sub edi,20 ;edi=&p[0]
|
||||
jmp .e9
|
||||
.e8:
|
||||
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
|
||||
sub edi,16 ;edi=&p[0]
|
||||
.e9:
|
||||
stdcall glopVertex, edx,edi
|
||||
@@:
|
||||
ret
|
||||
purge idx
|
||||
purge states
|
||||
purge a_size
|
||||
|
||||
align 4
|
||||
proc glDrawElements uses eax, mode:dword, count:dword, type:dword, indices:dword
|
||||
locals
|
||||
@@ -488,8 +374,7 @@ endl
|
||||
mov eax,[indices]
|
||||
mov dword[p+16],eax
|
||||
|
||||
mov eax,ebp
|
||||
sub eax,20 ;=sizeof(dd)*5
|
||||
lea eax,[ebp-20] ;=sizeof(dd)*5
|
||||
stdcall gl_add_op,eax
|
||||
ret
|
||||
endp
|
||||
@@ -533,8 +418,7 @@ endl
|
||||
;assert(0);
|
||||
.end_f:
|
||||
|
||||
mov eax,ebp
|
||||
sub eax,8 ;=sizeof(dd)*2
|
||||
lea eax,[ebp-8] ;=sizeof(dd)*2
|
||||
stdcall gl_add_op,eax
|
||||
ret
|
||||
endp
|
||||
@@ -578,8 +462,7 @@ endl
|
||||
;assert(0);
|
||||
.end_f:
|
||||
|
||||
mov eax,ebp
|
||||
sub eax,8 ;=sizeof(dd)*2
|
||||
lea eax,[ebp-8] ;=sizeof(dd)*2
|
||||
stdcall gl_add_op,eax
|
||||
ret
|
||||
endp
|
||||
@@ -612,8 +495,7 @@ endl
|
||||
mov eax,[pointer]
|
||||
mov dword[p+12],eax
|
||||
|
||||
mov eax,ebp
|
||||
sub eax,16 ;=sizeof(dd)*4
|
||||
lea eax,[ebp-16] ;=sizeof(dd)*4
|
||||
stdcall gl_add_op,eax
|
||||
ret
|
||||
endp
|
||||
@@ -646,8 +528,7 @@ endl
|
||||
mov eax,[pointer]
|
||||
mov dword[p+12],eax
|
||||
|
||||
mov eax,ebp
|
||||
sub eax,16 ;=sizeof(dd)*4
|
||||
lea eax,[ebp-16] ;=sizeof(dd)*4
|
||||
stdcall gl_add_op,eax
|
||||
ret
|
||||
endp
|
||||
@@ -676,8 +557,7 @@ endl
|
||||
mov eax,[pointer]
|
||||
mov dword[p+8],eax
|
||||
|
||||
mov eax,ebp
|
||||
sub eax,12 ;=sizeof(dd)*3
|
||||
lea eax,[ebp-12] ;=sizeof(dd)*3
|
||||
stdcall gl_add_op,eax
|
||||
ret
|
||||
endp
|
||||
@@ -710,8 +590,7 @@ endl
|
||||
mov eax,[pointer]
|
||||
mov dword[p+12],eax
|
||||
|
||||
mov eax,ebp
|
||||
sub eax,16 ;=sizeof(dd)*4
|
||||
lea eax,[ebp-16] ;=sizeof(dd)*4
|
||||
stdcall gl_add_op,eax
|
||||
ret
|
||||
endp
|
||||
|
@@ -12,6 +12,15 @@ include '../opengl_const.inc'
|
||||
|
||||
@use_library
|
||||
|
||||
;Константы описывающие файл house.3ds (получены с использованием программы info_3ds)
|
||||
VERTICES_OFFSET = 0x33 ;смещение по которому идут координаты вершин
|
||||
FACES_COUNT = 0x162 ;число граней
|
||||
FACES_OFFSET = 0x96b ;смещение по которому идет информация о гранях
|
||||
|
||||
HOUSE_FILE_SIZE = 5297
|
||||
txt_error_file_size db '"House.3ds file size does not match" -tE',0
|
||||
|
||||
|
||||
align 4
|
||||
start:
|
||||
load_library name_tgl, library_path, system_path, import_tinygl
|
||||
@@ -22,9 +31,9 @@ start:
|
||||
|
||||
;заполняем массив индексов из файла house.3ds (который вшит внутрь данной программы)
|
||||
mov esi,house_3ds
|
||||
add esi,0x1798 ;смещение по которому идет информация о гранях в файле 3ds (получено с использованием программы info_3ds)
|
||||
add esi,FACES_OFFSET
|
||||
mov edi,Indices
|
||||
mov eax,0x1a6 ;число граней в файле 3ds (получено с использованием программы info_3ds)
|
||||
mov eax,FACES_COUNT
|
||||
@@:
|
||||
movsd
|
||||
movsw
|
||||
@@ -48,13 +57,13 @@ red_win:
|
||||
align 4
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp al,1
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
jmp still
|
||||
cmp al,EV_REDRAW
|
||||
jz red_win
|
||||
cmp al,EV_KEY
|
||||
jz key
|
||||
cmp al,EV_BUTTON
|
||||
jz button
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
draw_window:
|
||||
@@ -141,10 +150,15 @@ caption db 'Test opengl 1.1 arrays, [Esc] - exit, [<-],[->],[Up],[Down] - rotate
|
||||
align 4
|
||||
draw_3d:
|
||||
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
|
||||
mov eax,house_3ds.end-house_3ds
|
||||
cmp eax,HOUSE_FILE_SIZE
|
||||
je @f
|
||||
notify_window_run txt_error_file_size
|
||||
ret
|
||||
@@:
|
||||
call [glPushMatrix]
|
||||
|
||||
;масштаб и повороты
|
||||
stdcall [glTranslatef], 0.0,0.0,0.5
|
||||
stdcall [glScalef], [scale], [scale], [scale]
|
||||
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
|
||||
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
|
||||
@@ -152,17 +166,17 @@ call [glPushMatrix]
|
||||
|
||||
;рисование через индексный массив
|
||||
mov eax,house_3ds ;начало внедренного файла 3ds
|
||||
add eax,0xeb ;смещение по которому идут координаты вершин (получено с использованием программы info_3ds)
|
||||
add eax,VERTICES_OFFSET
|
||||
stdcall [glVertexPointer], 3, GL_FLOAT, 0, eax ;задаем массив для вершин, 3 - число координат для одной вершины
|
||||
stdcall [glEnableClientState], GL_VERTEX_ARRAY ;включаем режим рисования вершин
|
||||
stdcall [glDrawElements], GL_TRIANGLES, 0x1a6*3, GL_UNSIGNED_SHORT, Indices ;mode, count, type, *indices
|
||||
stdcall [glDrawElements], GL_TRIANGLES, FACES_COUNT*3, GL_UNSIGNED_SHORT, Indices ;mode, count, type, *indices
|
||||
stdcall [glDisableClientState], GL_VERTEX_ARRAY ;отключаем режим рисования вершин
|
||||
|
||||
call [glPopMatrix]
|
||||
ret
|
||||
|
||||
align 4
|
||||
scale dd 0.0065 ;начальный масштаб (в идеальном случае должен вычислятся, но для даного примера подобран в ручную на глаз)
|
||||
scale dd 0.07 ;начальный масштаб (в идеальном случае должен вычислятся, но для даного примера подобран в ручную на глаз)
|
||||
delt_sc dd 0.0005
|
||||
angle_z dd 90.0
|
||||
angle_y dd 90.0
|
||||
@@ -172,8 +186,9 @@ delt_size dd 3.0
|
||||
align 4
|
||||
house_3ds: ;внедряем файл внутрь программы (в идеальном случае должен открыватся через окно диалога, но для облегчения примера вшит внутрь)
|
||||
file '../../../../../demos/view3ds/3ds_objects/House.3ds'
|
||||
.end:
|
||||
align 4
|
||||
Indices rb 0x1a6*6 ;0x1a6 - число граней, на каждую грань по 3 точки, индекс точки 2 байта
|
||||
Indices rb FACES_COUNT*6 ;на каждую грань по 3 точки, индекс точки 2 байта
|
||||
|
||||
;--------------------------------------------------
|
||||
align 4
|
||||
|
@@ -36,13 +36,13 @@ red_win:
|
||||
align 16
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp al,1
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
jmp still
|
||||
cmp al,EV_REDRAW
|
||||
jz red_win
|
||||
cmp al,EV_KEY
|
||||
jz key
|
||||
cmp al,EV_BUTTON
|
||||
jz button
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
draw_window:
|
||||
@@ -141,7 +141,6 @@ stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим б
|
||||
stdcall [glColor3f], 1.0, 1.0, 0.0
|
||||
|
||||
call [glPushMatrix]
|
||||
stdcall [glTranslatef], 0.0,0.0,0.5
|
||||
stdcall [glScalef], [scale], [scale], [scale]
|
||||
|
||||
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
|
||||
|
@@ -60,6 +60,7 @@ load_libraries l_libs_start,l_libs_end
|
||||
stdcall [buf2d_convert_text_matrix], buf_1
|
||||
|
||||
load_image_file 'toolb_1.png', image_data_toolbar
|
||||
call SetLight
|
||||
call draw_3d
|
||||
|
||||
align 4
|
||||
@@ -69,13 +70,13 @@ red_win:
|
||||
align 4
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp al,1
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
jmp still
|
||||
cmp al,EV_REDRAW
|
||||
jz red_win
|
||||
cmp al,EV_KEY
|
||||
jz key
|
||||
cmp al,EV_BUTTON
|
||||
jz button
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
draw_window:
|
||||
@@ -303,11 +304,7 @@ draw_3d:
|
||||
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
|
||||
|
||||
call [glPushMatrix]
|
||||
call SetLight
|
||||
|
||||
stdcall [glTranslatef], 0.0,0.0,0.5
|
||||
stdcall [glScalef], [scale], [scale], [scale]
|
||||
stdcall [glScalef], 1.0, 1.0, 0.5
|
||||
|
||||
stdcall [glColor3f], 1.0, 1.0, 0.0
|
||||
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
|
||||
|
@@ -60,6 +60,7 @@ load_libraries l_libs_start,l_libs_end
|
||||
stdcall [buf2d_convert_text_matrix], buf_1
|
||||
|
||||
load_image_file 'toolb_1.png', image_data_toolbar
|
||||
call SetLight
|
||||
call draw_3d
|
||||
|
||||
align 4
|
||||
@@ -69,13 +70,13 @@ red_win:
|
||||
align 4
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp al,1
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
jmp still
|
||||
cmp al,EV_REDRAW
|
||||
jz red_win
|
||||
cmp al,EV_KEY
|
||||
jz key
|
||||
cmp al,EV_BUTTON
|
||||
jz button
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
draw_window:
|
||||
@@ -296,9 +297,6 @@ draw_3d:
|
||||
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
|
||||
|
||||
call [glPushMatrix]
|
||||
call SetLight
|
||||
|
||||
stdcall [glTranslatef], 0.0,0.0,0.5
|
||||
stdcall [glScalef], [scale], [scale], [scale]
|
||||
|
||||
stdcall [glColor3f], 1.0, 1.0, 0.0
|
||||
|
@@ -88,13 +88,13 @@ red_win:
|
||||
align 4
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp al,1
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
jmp still
|
||||
cmp al,EV_REDRAW
|
||||
jz red_win
|
||||
cmp al,EV_KEY
|
||||
jz key
|
||||
cmp al,EV_BUTTON
|
||||
jz button
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
draw_window:
|
||||
@@ -295,7 +295,6 @@ draw_3d:
|
||||
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
|
||||
|
||||
call [glPushMatrix]
|
||||
stdcall [glTranslatef], 0.0,0.0,0.5
|
||||
stdcall [glScalef], [scale], [scale], [scale]
|
||||
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
|
||||
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
|
||||
|
@@ -88,13 +88,13 @@ red_win:
|
||||
align 4
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp al,1
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
jmp still
|
||||
cmp al,EV_REDRAW
|
||||
jz red_win
|
||||
cmp al,EV_KEY
|
||||
jz key
|
||||
cmp al,EV_BUTTON
|
||||
jz button
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
draw_window:
|
||||
@@ -297,9 +297,8 @@ draw_3d:
|
||||
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
|
||||
|
||||
call [glPushMatrix]
|
||||
stdcall [glTranslatef], 0.0,0.0,0.5
|
||||
stdcall [glScalef], [scale], [scale], [scale]
|
||||
stdcall [glScalef], 1.0, 1.0, 0.1 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
|
||||
stdcall [glScalef], 1.0, 1.0, 0.2 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
|
||||
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
|
||||
stdcall [glRotatef], [angle_x],1.0,0.0,0.0
|
||||
|
||||
|
@@ -89,13 +89,13 @@ red_win:
|
||||
align 4
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
cmp al,1
|
||||
jz red_win
|
||||
cmp al,2
|
||||
jz key
|
||||
cmp al,3
|
||||
jz button
|
||||
jmp still
|
||||
cmp al,EV_REDRAW
|
||||
jz red_win
|
||||
cmp al,EV_KEY
|
||||
jz key
|
||||
cmp al,EV_BUTTON
|
||||
jz button
|
||||
jmp still
|
||||
|
||||
align 4
|
||||
draw_window:
|
||||
@@ -268,8 +268,9 @@ draw_3d:
|
||||
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
|
||||
|
||||
call [glPushMatrix]
|
||||
stdcall [glTranslatef], 0.0,0.0,-1.0 ;двигаем сферу на себя, что-бы отсечь переднюю часть
|
||||
stdcall [glScalef], [scale], [scale], [scale]
|
||||
stdcall [glScalef], 1.0, 1.0, 0.1 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
|
||||
stdcall [glScalef], 1.0, 1.0, 0.2 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
|
||||
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
|
||||
stdcall [glRotatef], [angle_x],1.0,0.0,0.0
|
||||
|
||||
|
@@ -185,7 +185,7 @@ align 4
|
||||
cmp ecx,GL_SPOT_EXPONENT
|
||||
jne @f
|
||||
mov ecx,[ebx+12]
|
||||
mov [edi+GLLight.spot_exponent],ecx ;l.spot_exponent=p[3]
|
||||
mov [edx+GLLight.spot_exponent],ecx ;l.spot_exponent=p[3]
|
||||
jmp .end_f
|
||||
align 4
|
||||
@@:
|
||||
@@ -193,7 +193,7 @@ align 4
|
||||
jne .end_spot_c
|
||||
fld dword[ebp+12] ;float a=v.v[0]
|
||||
; assert(a == 180 || (a>=0 && a<=90));
|
||||
fst dword[edi+GLLight.spot_cutoff] ;l.spot_cutoff=a
|
||||
fst dword[edx+GLLight.spot_cutoff] ;l.spot_cutoff=a
|
||||
fcom dword[an180f] ;if (a != 180)
|
||||
fstsw ax
|
||||
sahf
|
||||
@@ -202,7 +202,7 @@ align 4
|
||||
fmulp
|
||||
fdiv dword[an180f]
|
||||
fcos
|
||||
fstp dword[edi+GLLight.cos_spot_cutoff] ;l.cos_spot_cutoff=cos(a * M_PI / 180.0)
|
||||
fstp dword[edx+GLLight.cos_spot_cutoff] ;l.cos_spot_cutoff=cos(a * M_PI / 180.0)
|
||||
jmp .end_f
|
||||
@@:
|
||||
ffree st0
|
||||
@@ -213,21 +213,21 @@ align 4
|
||||
cmp ecx,GL_CONSTANT_ATTENUATION
|
||||
jne @f
|
||||
mov ecx,[ebx+12]
|
||||
mov [edi+GLLight.attenuation],ecx ;l->attenuation[0]=p[3]
|
||||
mov [edx+GLLight.attenuation],ecx ;l->attenuation[0]=p[3]
|
||||
jmp .end_f
|
||||
align 4
|
||||
@@:
|
||||
cmp ecx,GL_LINEAR_ATTENUATION
|
||||
jne @f
|
||||
mov ecx,[ebx+12]
|
||||
mov [edi+GLLight.attenuation+4],ecx ;l->attenuation[1]=p[3]
|
||||
mov [edx+GLLight.attenuation+4],ecx ;l->attenuation[1]=p[3]
|
||||
jmp .end_f
|
||||
align 4
|
||||
@@:
|
||||
cmp ecx,GL_QUADRATIC_ATTENUATION
|
||||
jne @f
|
||||
mov ecx,[ebx+12]
|
||||
mov [edi+GLLight.attenuation+8],ecx ;l->attenuation[2]=p[3]
|
||||
mov [edx+GLLight.attenuation+8],ecx ;l->attenuation[2]=p[3]
|
||||
jmp .end_f
|
||||
align 4
|
||||
@@: ;default:
|
||||
@@ -363,15 +363,14 @@ fl_1e_3 dd 1.0e-3
|
||||
align 16
|
||||
proc gl_shade_vertex, context:dword, v:dword
|
||||
locals
|
||||
R dd ? ;float ebp-96
|
||||
G dd ? ;float ebp-92
|
||||
B dd ? ;float ebp-88
|
||||
A dd ? ;float ebp-84
|
||||
s V3 ;ebp-80
|
||||
d V3 ;ebp-68
|
||||
tmp dd ? ;float ebp-56
|
||||
att dd ? ;float ebp-52
|
||||
dot_spot dd ? ;float ebp-48
|
||||
R dd ? ;float ebp-92
|
||||
G dd ? ;float ebp-88
|
||||
B dd ? ;float ebp-84
|
||||
A dd ? ;float ebp-80
|
||||
s V3 ;ebp-76
|
||||
d V3 ;ebp-64
|
||||
tmp dd ? ;float ebp-52
|
||||
att dd ? ;float ebp-48
|
||||
lR dd ? ;float ebp-44
|
||||
lB dd ? ;float ebp-40
|
||||
lG dd ? ;float ebp-36
|
||||
@@ -563,7 +562,6 @@ align 4
|
||||
fmul dword[d+offs_Z]
|
||||
faddp
|
||||
fchs
|
||||
fst dword[dot_spot]
|
||||
cmp dword[twoside],0 ;if (twoside && dot_spot < 0)
|
||||
je @f
|
||||
ftst ;if (dot_spot<0)
|
||||
|
@@ -197,21 +197,24 @@ push edi esi
|
||||
add ebx,4
|
||||
inc esi
|
||||
|
||||
cmp byte[esi],'f'
|
||||
cmp byte[esi],'f' ;float
|
||||
jne @f
|
||||
fld dword[ebx]
|
||||
fstp qword[Data_Double]
|
||||
call DoubleFloat_to_String
|
||||
stdcall str_cat, edi,Data_String
|
||||
@@:
|
||||
cmp byte[esi],'d'
|
||||
jne @f
|
||||
cmp byte[esi],'C' ;const
|
||||
je @f
|
||||
cmp byte[esi],'d' ;integer
|
||||
je @f
|
||||
jmp .no_param
|
||||
@@:
|
||||
stdcall str_len,edi
|
||||
add edi,eax
|
||||
sub ecx,eax
|
||||
mov eax,dword[ebx]
|
||||
stdcall convert_int_to_str,ecx
|
||||
@@:
|
||||
.no_param:
|
||||
inc esi
|
||||
cmp byte[esi],0
|
||||
|
@@ -134,7 +134,7 @@ endl
|
||||
|
||||
cmp dword[edx+GLContext.lighting_enabled],0 ;if(context.lighting_enabled)
|
||||
jne .if_0
|
||||
cmp dword[eax+GLContext.texture_2d_enabled],0
|
||||
cmp dword[edx+GLContext.texture_2d_enabled],0
|
||||
jne .if_0
|
||||
jmp @f
|
||||
align 4
|
||||
|
@@ -17,7 +17,7 @@ proc ZB_plot uses eax ebx ecx edx edi, zb:dword, p:dword
|
||||
mov edi,[ebx+ZBufferPoint.z]
|
||||
shr edi,ZB_POINT_Z_FRAC_BITS
|
||||
cmp di,word[ecx]
|
||||
jl .end_f
|
||||
jb .end_f
|
||||
if TGL_FEATURE_RENDER_BITS eq 24
|
||||
mov eax,[ebx+ZBufferPoint.r]
|
||||
mov byte[edx],ah
|
||||
|
@@ -101,7 +101,7 @@ local .end_0
|
||||
mov [zz],eax
|
||||
mov ebx,[pz]
|
||||
cmp ax,word[ebx]
|
||||
jl .end_0
|
||||
jb .end_0
|
||||
RGBPIXEL
|
||||
mov eax,dword[zz]
|
||||
mov ebx,[pz]
|
||||
|
@@ -102,7 +102,7 @@ local .end_0
|
||||
mov [zz],eax
|
||||
mov ebx,[pz]
|
||||
cmp ax,word[ebx]
|
||||
jl .end_0
|
||||
jb .end_0
|
||||
RGBPIXEL
|
||||
mov eax,dword[zz]
|
||||
mov ebx,[pz]
|
||||
|
@@ -58,7 +58,7 @@ end if
|
||||
mov eax,[z]
|
||||
shr eax,ZB_POINT_Z_FRAC_BITS
|
||||
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
|
||||
jl .end_0
|
||||
jb .end_0
|
||||
;edi = pp
|
||||
mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
|
||||
if TGL_FEATURE_RENDER_BITS eq 24
|
||||
@@ -103,7 +103,7 @@ local .end_0
|
||||
mov eax,[z]
|
||||
shr eax,ZB_POINT_Z_FRAC_BITS
|
||||
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
|
||||
jl .end_0
|
||||
jb .end_0
|
||||
;edi = pp
|
||||
mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
|
||||
if TGL_FEATURE_RENDER_BITS eq 24
|
||||
@@ -171,7 +171,7 @@ local .end_0
|
||||
mov eax,[z]
|
||||
shr eax,ZB_POINT_Z_FRAC_BITS
|
||||
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
|
||||
jl .end_0
|
||||
jb .end_0
|
||||
;edi = pp
|
||||
mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
|
||||
if TGL_FEATURE_RENDER_BITS eq 24
|
||||
@@ -251,7 +251,7 @@ local .end_0
|
||||
mov eax,[z]
|
||||
shr eax,ZB_POINT_Z_FRAC_BITS
|
||||
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
|
||||
jl .end_0
|
||||
jb .end_0
|
||||
;edi = pp
|
||||
mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
|
||||
if TGL_FEATURE_RENDER_BITS eq 24
|
||||
|
@@ -16,9 +16,9 @@ include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US.
|
||||
|
||||
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
|
||||
if lang eq ru_RU
|
||||
caption db '<27><><EFBFBD>ᬮ<EFBFBD><E1ACAE> <20><><EFBFBD>ᥫ<EFBFBD><E1A5AB> 11.11.20',0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
caption db '<27><><EFBFBD>ᬮ<EFBFBD><E1ACAE> <20><><EFBFBD>ᥫ<EFBFBD><E1A5AB> 14.04.25',0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
else ; Default to en_US
|
||||
caption db 'Voxel viewer 11.11.20',0
|
||||
caption db 'Voxel viewer 14.04.25',0
|
||||
end if
|
||||
|
||||
3d_wnd_l equ 5 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> tinygl <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <><E1ABA5>
|
||||
@@ -750,12 +750,8 @@ draw_3d:
|
||||
je @f
|
||||
call SetLight
|
||||
@@:
|
||||
stdcall [glTranslatef], 0.0,0.0,0.5 ;<3B><><EFBFBD>न<EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> z <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20>।<EFBFBD><E0A5A4><EFBFBD><EFBFBD> <20><> 0.0 <20><> 1.0, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ࠦ<EFBFBD><E0A0A6><EFBFBD><EFBFBD> <20>㤥<EFBFBD> <20><>ᥪ<EFBFBD><E1A5AA><EFBFBD><EFBFBD><EFBFBD>
|
||||
;<3B><><EFBFBD>ᥫ<EFBFBD><E1A5AB><EFBFBD><EFBFBD> <20><>ꥪ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>न<EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><> -0.5 <20><> 0.5, <20><>⮬<EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> +0.5
|
||||
;<3B><> <20><><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><>ᥪ<EFBFBD><E1A5AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>뫥<EFBFBD><EBABA5><EFBFBD> <20><> <20>।<EFBFBD><E0A5A4><EFBFBD> <20><><EFBFBD><EFBFBD>⥩ <20><><EFBFBD><EFBFBD>祭<EFBFBD><E7A5AD>
|
||||
;<3B> <20><><EFBFBD>ᨨ opengl <20><><EFBFBD> Win <20><><EFBFBD>न<EFBFBD><E0A4A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> -1.0 <20><> 1.0 <20><>⮬<EFBFBD> ⠬ <20>⮣<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>㦭<EFBFBD>
|
||||
stdcall [glScalef], [scale], [scale], [scale] ;㢥<><E3A2A5>稢<EFBFBD><E7A8A2><EFBFBD> <20><><EFBFBD>ᥫ<EFBFBD><E1A5AB><EFBFBD><EFBFBD> <20><>ꥪ<EFBFBD>, <20><><EFBFBD>-<2D><> <20><> <20><><EFBFBD> <20>祭<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>쪨<EFBFBD>
|
||||
stdcall [glScalef], 1.0, 1.0, 0.25 ;<3B><><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD> <20><>ꥪ<EFBFBD><EAA5AA> <20><> <20>뫠<EFBFBD><EBABA0><EFBFBD><EFBFBD> <20><> <20>࠭<EFBFBD> <20><><EFBFBD><EFBFBD>祭<EFBFBD><E7A5AD>
|
||||
stdcall [glScalef], 1.0, 1.0, 0.5 ;<3B><><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD> <20><>ꥪ<EFBFBD><EAA5AA> <20><> <20>뫠<EFBFBD><EBABA0><EFBFBD><EFBFBD> <20><> <20>࠭<EFBFBD> <20><><EFBFBD><EFBFBD>祭<EFBFBD><E7A5AD>
|
||||
stdcall [glRotatef], [angle_x],1.0,0.0,0.0
|
||||
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
|
||||
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
|
||||
|
@@ -1,209 +0,0 @@
|
||||
; Now being rewritten from https://github.com/nayuki/QR-Code-generator/blob/master/c/qrcodegen.c
|
||||
|
||||
; __DEBUG__ = 1
|
||||
; __DEBUG_LEVEL__ = DBG_ALL
|
||||
; DBG_ALL = 0 ; all messages
|
||||
; DBG_INFO = 1 ; info and errors
|
||||
; DBG_ERR = 2 ; only errors
|
||||
|
||||
include '../../proc32.inc'
|
||||
include '../../struct.inc'
|
||||
include '../../if.inc'
|
||||
; include '../../debug-fdo.inc'
|
||||
|
||||
; The error correction level in a QR Code symbol.
|
||||
qrcodegen_Ecc_LOW = 0 ; The QR Code can tolerate about 7% erroneous codewords
|
||||
qrcodegen_Ecc_MEDIUM = 1 ; The QR Code can tolerate about 15% erroneous codewords
|
||||
qrcodegen_Ecc_QUARTILE = 2 ; The QR Code can tolerate about 25% erroneous codewords
|
||||
qrcodegen_Ecc_HIGH = 3 ; The QR Code can tolerate about 30% erroneous codewords
|
||||
|
||||
; The mask pattern used in a QR Code symbol.
|
||||
;
|
||||
; A special value to tell the QR Code encoder to
|
||||
; automatically select an appropriate mask pattern:
|
||||
qrcodegen_Mask_AUTO = -1
|
||||
; The eight actual mask patterns:
|
||||
qrcodegen_Mask_0 = 0
|
||||
qrcodegen_Mask_1 = 1
|
||||
qrcodegen_Mask_2 = 2
|
||||
qrcodegen_Mask_3 = 3
|
||||
qrcodegen_Mask_4 = 4
|
||||
qrcodegen_Mask_5 = 5
|
||||
qrcodegen_Mask_6 = 6
|
||||
qrcodegen_Mask_7 = 7
|
||||
|
||||
; Describes how a segment's data bits are interpreted.
|
||||
qrcodegen_Mode_NUMERIC = 0x1
|
||||
qrcodegen_Mode_ALPHANUMERIC = 0x2
|
||||
qrcodegen_Mode_BYTE = 0x4
|
||||
qrcodegen_Mode_KANJI = 0x8
|
||||
qrcodegen_Mode_ECI = 0x7
|
||||
|
||||
; A segment of character/binary/control data in a QR Code symbol.
|
||||
; The mid-level way to create a segment is to take the payload data
|
||||
; and call a factory function such as qrcodegen_makeNumeric().
|
||||
; The low-level way to create a segment is to custom-make the bit buffer
|
||||
; and initialize a qrcodegen_Segment struct with appropriate values.
|
||||
; Even in the most favorable conditions, a QR Code can only hold 7089 characters of data.
|
||||
; Any segment longer than this is meaningless for the purpose of generating QR Codes.
|
||||
; Moreover, the maximum allowed bit length is 32767 because
|
||||
; the largest QR Code (version 40) has 31329 modules.
|
||||
struct qrcodegen_Segment
|
||||
; The mode indicator of this segment.
|
||||
mode dd ? ; qrcodegen_Mode
|
||||
|
||||
; The length of this segment's unencoded data. Measured in characters for
|
||||
; numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
|
||||
; Always zero or positive. Not the same as the data's bit length.
|
||||
numChars dd ?
|
||||
|
||||
; The data bits of this segment, packed in bitwise big endian.
|
||||
; Can be null if the bit length is zero.
|
||||
data dd ?
|
||||
|
||||
; The number of valid data bits used in the buffer. Requires
|
||||
; 0 <= bitLength <= 32767, and bitLength <= (capacity of data array) * 8.
|
||||
; The character count (numChars) must agree with the mode and the bit buffer length.
|
||||
bitLength dd ?
|
||||
ends
|
||||
|
||||
; The minimum version number supported in the QR Code Model 2 standard
|
||||
qrcodegen_VERSION_MIN = 1
|
||||
; The maximum version number supported in the QR Code Model 2 standard
|
||||
qrcodegen_VERSION_MAX = 40
|
||||
|
||||
; Calculates the number of bytes needed to store any QR Code up to and including the given version number,
|
||||
; as a compile-time constant. For example, 'uint8_t buffer[qrcodegen_BUFFER_LEN_FOR_VERSION(25)];'
|
||||
; can store any single QR Code from version 1 to 25 (inclusive). The result fits in an int (or int16).
|
||||
; Requires qrcodegen_VERSION_MIN <= n <= qrcodegen_VERSION_MAX.
|
||||
; TODO make this fasm macro:
|
||||
; #define qrcodegen_BUFFER_LEN_FOR_VERSION(n) ((((n) * 4 + 17) * ((n) * 4 + 17) + 7) / 8 + 1)
|
||||
|
||||
; The worst-case number of bytes needed to store one QR Code, up to and including
|
||||
; version 40. This value equals 3918, which is just under 4 kilobytes.
|
||||
; Use this more convenient value to avoid calculating tighter memory bounds for buffers.
|
||||
; TODO make this fasm macro:
|
||||
; #define qrcodegen_BUFFER_LEN_MAX qrcodegen_BUFFER_LEN_FOR_VERSION(qrcodegen_VERSION_MAX)
|
||||
|
||||
INT16_MAX = 32767
|
||||
|
||||
; Sentinel value for use in only some functions
|
||||
LENGTH_OVERFLOW = -1
|
||||
|
||||
; Based on the table ECC_CODEWORDS_PER_BLOCK
|
||||
qrcodegen_REED_SOLOMON_DEGREE_MAX = 30
|
||||
|
||||
; For automatic mask pattern selection.
|
||||
PENALTY_N1 = 3
|
||||
PENALTY_N2 = 3
|
||||
PENALTY_N3 = 40
|
||||
PENALTY_N4 = 10
|
||||
|
||||
|
||||
; CODE:
|
||||
|
||||
proc qrcodegen_encodeBinary, dataAndTemp, dataLen, qrcode, ecl, minVersion, maxVersion, mask, boostEcl
|
||||
locals
|
||||
seg qrcodegen_Segment
|
||||
endl
|
||||
mov [seg + qrcodegen_Segment.mode], qrcodegen_Mode_BYTE
|
||||
stdcall calcSegmentBitLength, [seg + qrcodegen_Segment.mode], [dataLen]
|
||||
mov [seg + qrcodegen_Segment.bitLength], eax
|
||||
.if [seg + qrcodegen_Segment.bitLength] = LENGTH_OVERFLOW
|
||||
mov byte [qrcode + 0], 0 ; Set size to invalid value for safety
|
||||
jmp .ret
|
||||
.endif
|
||||
mov eax, [dataLen]
|
||||
mov [seg + qrcodegen_Segment.numChars], eax
|
||||
mov eax, [dataAndTemp]
|
||||
mov [seg + qrcodegen_Segment.data], eax
|
||||
lea eax, [seg]
|
||||
stdcall qrcodegen_encodeSegmentsAdvanced, eax, 1, [ecl], [minVersion], [maxVersion], [mask], [boostEcl], [dataAndTemp], [qrcode]
|
||||
.ret:
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
|
||||
; Returns the number of data bits needed to represent a segment
|
||||
; containing the given number of characters using the given mode. Notes:
|
||||
; - Returns LENGTH_OVERFLOW on failure, i.e. numChars > INT16_MAX
|
||||
; or the number of needed bits exceeds INT16_MAX (i.e. 32767).
|
||||
; - Otherwise, all valid results are in the range [0, INT16_MAX].
|
||||
; - For byte mode, numChars measures the number of bytes, not Unicode code points.
|
||||
; - For ECI mode, numChars must be 0, and the worst-case number of bits is returned.
|
||||
; An actual ECI segment can have shorter data. For non-ECI modes, the result is exact.
|
||||
|
||||
proc calcSegmentBitLength uses edx ebx, mode, numChars
|
||||
.if [numChars] > INT16_MAX
|
||||
mov eax, LENGTH_OVERFLOW
|
||||
jmp .ret
|
||||
.endif
|
||||
mov eax, [numChars]
|
||||
.if [mode] = qrcodegen_Mode_NUMERIC
|
||||
; eax = ceil(10/3 * n)
|
||||
xor edx, edx
|
||||
mov ebx, 10
|
||||
mul ebx
|
||||
add eax, 2
|
||||
mov ebx, 3
|
||||
div eax, ebx
|
||||
.elseif [mode] = qrcodegen_Mode_ALPHANUMERIC
|
||||
; eax = ceil(11/2 * n)
|
||||
xor edx, edx
|
||||
mov ebx, 11
|
||||
mul eax, ebx
|
||||
inc eax
|
||||
mov ebx, 2
|
||||
div eax, ebx
|
||||
.elseif [mode] = qrcodegen_Mode_BYTE
|
||||
shl eax, 3 ; *8
|
||||
.elseif [mode] = qrcodegen_Mode_KANJI
|
||||
xor edx, edx
|
||||
mov ebx, 13
|
||||
mul ebx
|
||||
.elseif [mode] = qrcodegen_Mode_ECI
|
||||
.if [numChars] = 0
|
||||
mov eax, 3*8
|
||||
.endif
|
||||
.else ; Invalid argument
|
||||
mov eax, LENGTH_OVERFLOW
|
||||
jmp .ret
|
||||
.endif
|
||||
; TODO assert(result >= 0)
|
||||
.if eax > INT16_MAX
|
||||
mov eax, LENGTH_OVERFLOW
|
||||
.endif
|
||||
.ret:
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
|
||||
; DATA:
|
||||
|
||||
; include_debug_strings
|
||||
|
||||
; The set of all legal characters in alphanumeric mode, where each character
|
||||
; value maps to the index in the string. For checking text and encoding segments.
|
||||
ALPHANUMERIC_CHARSET db "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",0
|
||||
|
||||
; For generating error correction codes.
|
||||
ECC_CODEWORDS_PER_BLOCK db \
|
||||
\ ; Version: (note that index 0 is for padding, and is set to an illegal value)
|
||||
\ ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
||||
-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, \ ; Low
|
||||
-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, \ ; Medium
|
||||
-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, \ ; Quartile
|
||||
-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 ; High
|
||||
|
||||
; For generating error correction codes.
|
||||
NUM_ERROR_CORRECTION_BLOCKS db \
|
||||
\ ; Version: (note that index 0 is for padding, and is set to an illegal value)
|
||||
\ ; 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
||||
-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25, \ ; Low
|
||||
-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49, \ ; Medium
|
||||
-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68, \ ; Quartile
|
||||
-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81 ; High
|
||||
|
||||
|
Reference in New Issue
Block a user