/programs/develop/libraries/TinyGL/asm_fork/api.asm |
---|
563,6 → 563,31 |
ret |
endp |
align 4 |
proc glOrtho uses eax, left:qword, right:qword, bottom:qword, top:qword,\ |
near:qword, farv:qword |
locals |
p rd 7 |
endl |
mov dword[p],OP_Ortho |
fld qword[left] |
fstp dword[p+4] |
fld qword[right] |
fstp dword[p+8] |
fld qword[bottom] |
fstp dword[p+12] |
fld qword[top] |
fstp dword[p+16] |
fld qword[near] |
fstp dword[p+20] |
fld qword[farv] |
fstp dword[p+24] |
lea eax,[ebp-28] ;=sizeof(dd)*7 |
stdcall gl_add_op,eax |
ret |
endp |
; lightening |
align 4 |
/programs/develop/libraries/TinyGL/asm_fork/examples/test0.asm |
---|
1,16 → 1,13 |
use32 |
org 0x0 |
org 0 |
db 'MENUET01' |
dd 0x1 |
dd start |
dd i_end |
dd mem,stacktop |
dd 0,cur_dir_path |
dd 1,start,i_end,mem,stacktop,0,cur_dir_path |
include '../../../../../../programs/proc32.inc' |
include '../../../../../../programs/macros.inc' |
include '../../../../../../programs/develop/libraries/box_lib/load_lib.mac' |
include '../../../../../../programs/dll.inc' |
include '../../../../../proc32.inc' |
include '../../../../../macros.inc' |
include '../../../../../KOSfuncs.inc' |
include '../../../../../develop/libraries/box_lib/load_lib.mac' |
include '../../../../../dll.inc' |
include '../opengl_const.inc' |
@use_library |
19,10 → 16,10 |
start: |
load_library name_tgl, cur_dir_path, library_path, system_path, \ |
err_message_found_lib, head_f_l, import_lib_tinygl, err_message_import, head_f_i |
cmp eax,-1 |
cmp eax,SF_TERMINATE_PROCESS |
jz button.exit |
mcall 40,0x27 |
mcall SF_SET_EVENTS_MASK,0x27 |
stdcall [kosglMakeCurrent], 10,10,300,225,ctx1 |
stdcall [glEnable], GL_DEPTH_TEST |
34,9 → 31,9 |
red_win: |
call draw_window |
align 4 |
align 16 |
still: |
mcall 10 |
mcall SF_CHECK_EVENT |
cmp al,1 |
jz red_win |
cmp al,2 |
48,19 → 45,19 |
align 4 |
draw_window: |
pushad |
mcall 12,1 |
mcall SF_REDRAW,SSF_BEGIN_DRAW |
mov edx,0x33ffffff ;0x73ffffff |
mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption |
stdcall [kosglSwapBuffers] |
mcall SF_CREATE_WINDOW,(50 shl 16)+330,(30 shl 16)+275,,,caption |
call [kosglSwapBuffers] |
mcall 12,2 |
mcall SF_REDRAW,SSF_END_DRAW |
popad |
ret |
align 4 |
key: |
mcall 2 |
mcall SF_GET_KEY |
cmp ah,27 ;Esc |
je button.exit |
73,7 → 70,7 |
fadd dword[delt_size] |
fstp dword[angle_z] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
@@: |
cmp ah,179 ;Right |
jne @f |
81,7 → 78,7 |
fsub dword[delt_size] |
fstp dword[angle_z] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
@@: |
jmp still |
88,24 → 85,21 |
align 4 |
button: |
mcall 17 |
mcall SF_GET_BUTTON |
cmp ah,1 |
jne still |
.exit: |
mcall -1 |
mcall SF_TERMINATE_PROCESS |
align 4 |
caption db 'Test tinygl library, [Esc] - exit, [<-] and [->] - rotate',0 |
align 4 |
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext |
;sizeof.TinyGLContext = 28 |
align 4 |
draw_3d: |
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины |
stdcall [glPushMatrix] |
call [glPushMatrix] |
stdcall [glRotatef], [angle_z],0.0,0.0,1.0 |
stdcall [glColor3f],1.0, 0.0, 0.0 |
118,7 → 112,7 |
stdcall [glVertex3f], -0.354,-0.354, 0.1 |
stdcall [glVertex3f], -0.5, 0.0, 0.1 |
stdcall [glVertex3f], -0.354, 0.354, 0.1 |
stdcall [glEnd] |
call [glEnd] |
stdcall [glBegin],GL_LINES |
stdcall [glVertex3f], 0, 0.7, 0.3 |
131,9 → 125,9 |
stdcall [glVertex3f], -0.7, 0.0, 0.3 |
stdcall [glColor3f],1.0, 0.0, 0.0 |
stdcall [glVertex3f], -0.495, 0.495, 0.7 |
stdcall [glEnd] |
call [glEnd] |
stdcall [glPopMatrix] |
call [glPopMatrix] |
ret |
angle_z dd 0.0 |
158,13 → 152,17 |
;-------------------------------------------------- |
system_path db '/sys/lib/' |
name_tgl db 'tinygl.obj',0 |
err_message_found_lib db 'Sorry I cannot load library tinygl.obj',0 |
head_f_i: |
head_f_l db 'System error',0 |
err_message_import db 'Error on load import library tinygl.obj',0 |
head_f_l db '"System error',0 |
err_message_import db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0 |
err_message_found_lib db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0 |
;-------------------------------------------------- |
align 16 |
i_end: |
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext |
;sizeof.TinyGLContext = 28 |
rb 1024 |
stacktop: |
cur_dir_path: |
/programs/develop/libraries/TinyGL/asm_fork/examples/test1.asm |
---|
1,16 → 1,13 |
use32 |
org 0x0 |
org 0 |
db 'MENUET01' |
dd 0x1 |
dd start |
dd i_end |
dd mem,stacktop |
dd 0,cur_dir_path |
dd 1,start,i_end,mem,stacktop,0,cur_dir_path |
include '../../../../../../programs/proc32.inc' |
include '../../../../../../programs/macros.inc' |
include '../../../../../../programs/develop/libraries/box_lib/load_lib.mac' |
include '../../../../../../programs/dll.inc' |
include '../../../../../proc32.inc' |
include '../../../../../macros.inc' |
include '../../../../../KOSfuncs.inc' |
include '../../../../../develop/libraries/box_lib/load_lib.mac' |
include '../../../../../dll.inc' |
include '../opengl_const.inc' |
@use_library |
19,10 → 16,10 |
start: |
load_library name_tgl, cur_dir_path, library_path, system_path, \ |
err_message_found_lib, head_f_l, import_lib_tinygl, err_message_import, head_f_i |
cmp eax,-1 |
cmp eax,SF_TERMINATE_PROCESS |
jz button.exit |
mcall 40,0x27 |
mcall SF_SET_EVENTS_MASK,0x27 |
stdcall [kosglMakeCurrent], 10,10,300,225,ctx1 |
stdcall [glEnable], GL_DEPTH_TEST |
33,9 → 30,9 |
red_win: |
call draw_window |
align 4 |
align 16 |
still: |
mcall 10 |
mcall SF_CHECK_EVENT |
cmp al,1 |
jz red_win |
cmp al,2 |
47,19 → 44,19 |
align 4 |
draw_window: |
pushad |
mcall 12,1 |
mcall SF_REDRAW,SSF_BEGIN_DRAW |
mov edx,0x33ffffff ;0x73ffffff |
mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption |
stdcall [kosglSwapBuffers] |
mcall SF_CREATE_WINDOW,(50 shl 16)+330,(30 shl 16)+275,,,caption |
call [kosglSwapBuffers] |
mcall 12,2 |
mcall SF_REDRAW,SSF_END_DRAW |
popad |
ret |
align 4 |
key: |
mcall 2 |
mcall SF_GET_KEY |
cmp ah,27 ;Esc |
je button.exit |
72,7 → 69,7 |
fadd dword[delt_size] |
fstp dword[angle_z] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
@@: |
cmp ah,179 ;Right |
jne @f |
80,7 → 77,7 |
fsub dword[delt_size] |
fstp dword[angle_z] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
@@: |
jmp still |
87,24 → 84,21 |
align 4 |
button: |
mcall 17 |
mcall SF_GET_BUTTON |
cmp ah,1 |
jne still |
.exit: |
mcall -1 |
mcall SF_TERMINATE_PROCESS |
align 4 |
caption db 'Test tinygl library, [Esc] - exit, [<-] and [->] - rotate',0 |
align 4 |
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext |
;sizeof.TinyGLContext = 28 |
align 4 |
draw_3d: |
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины |
stdcall [glPushMatrix] |
call [glPushMatrix] |
stdcall [glRotatef], [angle_z],0.0,0.0,1.0 |
stdcall [glScalef], 0.3,0.3,0.3 |
133,7 → 127,7 |
stdcall [glVertex3f], -0.778, 0.778, 0.1 |
stdcall [glEnd] |
stdcall [glPopMatrix] |
call [glPopMatrix] |
ret |
angle_z dd 0.0 |
158,13 → 152,17 |
;-------------------------------------------------- |
system_path db '/sys/lib/' |
name_tgl db 'tinygl.obj',0 |
err_message_found_lib db 'Sorry I cannot load library tinygl.obj',0 |
head_f_i: |
head_f_l db 'System error',0 |
err_message_import db 'Error on load import library tinygl.obj',0 |
head_f_l db '"System error',0 |
err_message_import db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0 |
err_message_found_lib db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0 |
;-------------------------------------------------- |
align 16 |
i_end: |
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext |
;sizeof.TinyGLContext = 28 |
rb 1024 |
stacktop: |
cur_dir_path: |
/programs/develop/libraries/TinyGL/asm_fork/examples/test2.asm |
---|
1,16 → 1,13 |
use32 |
org 0x0 |
org 0 |
db 'MENUET01' |
dd 0x1 |
dd start |
dd i_end |
dd mem,stacktop |
dd 0,cur_dir_path |
dd 1,start,i_end,mem,stacktop,0,cur_dir_path |
include '../../../../../../programs/proc32.inc' |
include '../../../../../../programs/macros.inc' |
include '../../../../../../programs/develop/libraries/box_lib/load_lib.mac' |
include '../../../../../../programs/dll.inc' |
include '../../../../../proc32.inc' |
include '../../../../../macros.inc' |
include '../../../../../KOSfuncs.inc' |
include '../../../../../develop/libraries/box_lib/load_lib.mac' |
include '../../../../../dll.inc' |
include '../opengl_const.inc' |
@use_library |
19,10 → 16,10 |
start: |
load_library name_tgl, cur_dir_path, library_path, system_path, \ |
err_message_found_lib, head_f_l, import_lib_tinygl, err_message_import, head_f_i |
cmp eax,-1 |
cmp eax,SF_TERMINATE_PROCESS |
jz button.exit |
mcall 40,0x27 |
mcall SF_SET_EVENTS_MASK,0x27 |
stdcall [kosglMakeCurrent], 10,10,300,225,ctx1 |
stdcall [glEnable], GL_DEPTH_TEST |
63,9 → 60,9 |
red_win: |
call draw_window |
align 4 |
align 16 |
still: |
mcall 10 |
mcall SF_CHECK_EVENT |
cmp al,1 |
jz red_win |
cmp al,2 |
77,19 → 74,19 |
align 4 |
draw_window: |
pushad |
mcall 12,1 |
mcall SF_REDRAW,SSF_BEGIN_DRAW |
mov edx,0x33ffffff ;0x73ffffff |
mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption |
stdcall [kosglSwapBuffers] |
mcall SF_CREATE_WINDOW,(50 shl 16)+330,(30 shl 16)+275,,,caption |
call [kosglSwapBuffers] |
mcall 12,2 |
mcall SF_REDRAW,SSF_END_DRAW |
popad |
ret |
align 4 |
key: |
mcall 2 |
mcall SF_GET_KEY |
cmp ah,27 ;Esc |
je button.exit |
102,7 → 99,7 |
fadd dword[delt_size] |
fstp dword[angle_z] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
@@: |
cmp ah,179 ;Right |
jne @f |
110,7 → 107,7 |
fsub dword[delt_size] |
fstp dword[angle_z] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
@@: |
jmp still |
117,24 → 114,21 |
align 4 |
button: |
mcall 17 |
mcall SF_GET_BUTTON |
cmp ah,1 |
jne still |
.exit: |
mcall -1 |
mcall SF_TERMINATE_PROCESS |
align 4 |
caption db 'Test tinygl library, [Esc] - exit, [<-] and [->] - rotate',0 |
align 4 |
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext |
;sizeof.TinyGLContext = 28 |
align 4 |
draw_3d: |
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины |
stdcall [glPushMatrix] |
call [glPushMatrix] |
stdcall [glRotatef], [angle_z],0.0,0.0,1.0 |
stdcall [glScalef], 0.3,0.3,0.3 |
167,13 → 161,17 |
;-------------------------------------------------- |
system_path db '/sys/lib/' |
name_tgl db 'tinygl.obj',0 |
err_message_found_lib db 'Sorry I cannot load library tinygl.obj',0 |
head_f_i: |
head_f_l db 'System error',0 |
err_message_import db 'Error on load import library tinygl.obj',0 |
head_f_l db '"System error',0 |
err_message_import db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0 |
err_message_found_lib db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0 |
;-------------------------------------------------- |
align 16 |
i_end: |
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext |
;sizeof.TinyGLContext = 28 |
rb 1024 |
stacktop: |
cur_dir_path: |
/programs/develop/libraries/TinyGL/asm_fork/examples/test3.asm |
---|
1,16 → 1,13 |
use32 |
org 0x0 |
org 0 |
db 'MENUET01' |
dd 0x1 |
dd start |
dd i_end |
dd mem,stacktop |
dd 0,cur_dir_path |
dd 1,start,i_end,mem,stacktop,0,cur_dir_path |
include '../../../../../../programs/proc32.inc' |
include '../../../../../../programs/macros.inc' |
include '../../../../../../programs/develop/libraries/box_lib/load_lib.mac' |
include '../../../../../../programs/dll.inc' |
include '../../../../../proc32.inc' |
include '../../../../../macros.inc' |
include '../../../../../KOSfuncs.inc' |
include '../../../../../develop/libraries/box_lib/load_lib.mac' |
include '../../../../../dll.inc' |
include '../opengl_const.inc' |
@use_library |
19,10 → 16,10 |
start: |
load_library name_tgl, cur_dir_path, library_path, system_path, \ |
err_message_found_lib, head_f_l, import_lib_tinygl, err_message_import, head_f_i |
cmp eax,-1 |
cmp eax,SF_TERMINATE_PROCESS |
jz button.exit |
mcall 40,0x27 |
mcall SF_SET_EVENTS_MASK,0x27 |
stdcall [kosglMakeCurrent], 10,10,300,225,ctx1 |
;stdcall [glEnable], GL_DEPTH_TEST |
35,9 → 32,9 |
red_win: |
call draw_window |
align 4 |
align 16 |
still: |
mcall 10 |
mcall SF_CHECK_EVENT |
cmp al,1 |
jz red_win |
cmp al,2 |
49,19 → 46,19 |
align 4 |
draw_window: |
pushad |
mcall 12,1 |
mcall SF_REDRAW,SSF_BEGIN_DRAW |
mov edx,0x33ffffff ;0x73ffffff |
mcall 0,(50 shl 16)+330,(30 shl 16)+275,,,caption |
stdcall [kosglSwapBuffers] |
mcall SF_CREATE_WINDOW,(50 shl 16)+330,(30 shl 16)+275,,,caption |
call [kosglSwapBuffers] |
mcall 12,2 |
mcall SF_REDRAW,SSF_END_DRAW |
popad |
ret |
align 4 |
key: |
mcall 2 |
mcall SF_GET_KEY |
cmp ah,27 ;Esc |
je button.exit |
74,7 → 71,7 |
fadd dword[delt_size] |
fstp dword[angle_z] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
@@: |
cmp ah,179 ;Right |
jne @f |
82,7 → 79,7 |
fsub dword[delt_size] |
fstp dword[angle_z] |
call draw_3d |
stdcall [kosglSwapBuffers] |
call [kosglSwapBuffers] |
@@: |
jmp still |
89,24 → 86,21 |
align 4 |
button: |
mcall 17 |
mcall SF_GET_BUTTON |
cmp ah,1 |
jne still |
.exit: |
mcall -1 |
mcall SF_TERMINATE_PROCESS |
align 4 |
caption db 'Test tinygl library, [Esc] - exit, [<-] and [->] - rotate',0 |
align 4 |
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext |
;sizeof.TinyGLContext = 28 |
align 4 |
draw_3d: |
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины |
stdcall [glPushMatrix] |
call [glPushMatrix] |
stdcall [glRotatef], [angle_z],0.0,0.0,1.0 |
stdcall [glBegin],GL_TRIANGLES |
159,13 → 153,17 |
;-------------------------------------------------- |
system_path db '/sys/lib/' |
name_tgl db 'tinygl.obj',0 |
err_message_found_lib db 'Sorry I cannot load library tinygl.obj',0 |
head_f_i: |
head_f_l db 'System error',0 |
err_message_import db 'Error on load import library tinygl.obj',0 |
head_f_l db '"System error',0 |
err_message_import db 'Error on load import library ',39,'tinygl.obj',39,'" -tE',0 |
err_message_found_lib db 'Sorry I cannot load library ',39,'tinygl.obj',39,'" -tE',0 |
;-------------------------------------------------- |
align 16 |
i_end: |
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext |
;sizeof.TinyGLContext = 28 |
rb 1024 |
stacktop: |
cur_dir_path: |
/programs/develop/libraries/TinyGL/asm_fork/export.inc |
---|
141,7 → 141,7 |
;E_LIB glDepthFunc(int) |
;E_LIB glBlendFunc(int, int) |
;E_LIB glTexEnvf(int, int, int) |
;E_LIB glOrtho(float, float, float, float, float, float) |
E_LIB glOrtho ;(float, float, float, float, float, float) |
;E_LIB glVertex2i(int, int) |
;E_LIB glDepthMask(int) |
;E_LIB glFogi(int, int) |
/programs/develop/libraries/TinyGL/asm_fork/matrix.asm |
---|
96,8 → 96,7 |
proc glopLoadMatrix uses eax edi esi, context:dword, p:dword |
mov eax,[context] |
mov edi,[eax+GLContext.matrix_mode] |
shl edi,2 |
add edi,eax |
lea edi,[eax+4*edi] |
mov edi,dword[edi+GLContext.matrix_stack_ptr] |
mov esi,[p] |
112,8 → 111,7 |
proc glopLoadIdentity uses eax ebx, context:dword, p:dword |
mov eax,[context] |
mov ebx,[eax+GLContext.matrix_mode] |
shl ebx,2 |
add ebx,eax |
lea ebx,[eax+4*ebx] |
stdcall gl_M4_Id,[ebx+GLContext.matrix_stack_ptr] |
gl_matrix_update eax,ebx |
127,14 → 125,12 |
endl |
mov esi,[p] |
add esi,4 |
mov edi,ebp |
sub edi,sizeof.M4 |
lea edi,[ebp-sizeof.M4] |
stdcall gl_M4_Transpose,edi,esi ;транспонируем входную матрицу в локальную матрицу m |
mov eax,[context] |
mov esi,[eax+GLContext.matrix_mode] |
shl esi,2 |
add esi,eax |
lea esi,[eax+4*esi] |
stdcall gl_M4_MulLeft,dword[esi+GLContext.matrix_stack_ptr],edi |
gl_matrix_update eax,edi |
149,9 → 145,7 |
; assert( (c->matrix_stack_ptr[ebx] - c->matrix_stack[ebx] + 1 ) |
; < c->matrix_stack_depth_max[ebx] ); |
shl ebx,2 |
add ebx,eax |
add ebx,GLContext.matrix_stack_ptr |
lea ebx,[eax+4*ebx+GLContext.matrix_stack_ptr] |
add dword[ebx],sizeof.M4 |
mov ebx,[ebx] ;ebx = ++context.matrix_stack_ptr[context.matrix_mode] |
171,8 → 165,7 |
; assert( c->matrix_stack_ptr[n] > c->matrix_stack[n] ); |
shl ebx,2 |
add ebx,eax |
lea ebx,[eax+4*ebx] |
sub dword[ebx+GLContext.matrix_stack_ptr],sizeof.M4 |
gl_matrix_update eax,ebx |
193,8 → 186,7 |
mov eax,[context] |
mov ebx,[p] |
mov ecx,ebp |
sub ecx,sizeof.M4 ;ecx=&m |
lea ecx,[ebp-sizeof.M4] ;ecx=&m |
finit |
fldpi |
fmul dword[ebx+4] |
425,8 → 417,7 |
mov eax,[context] |
mov ebx,[eax+GLContext.matrix_mode] |
shl ebx,2 |
add ebx,eax |
lea ebx,[eax+4*ebx] |
stdcall gl_M4_MulLeft,dword[ebx+GLContext.matrix_stack_ptr],ecx |
gl_matrix_update eax,ebx |
jmp .end_f |
445,8 → 436,7 |
mov eax,[context] |
mov ebx,[eax+GLContext.matrix_mode] |
shl ebx,2 |
add ebx,eax |
lea ebx,[eax+4*ebx] |
mov ebx,[ebx+GLContext.matrix_stack_ptr] ;ebx = &m[0] |
fld dword[ecx+ 4] ;x |
482,8 → 472,7 |
mov eax,[context] |
mov ebx,[eax+GLContext.matrix_mode] |
shl ebx,2 |
add ebx,eax |
lea ebx,[eax+4*ebx] |
mov ebx,[ebx+GLContext.matrix_stack_ptr] ;ebx = &m[0] |
fld dword[ecx+ 4] ;x |
607,4 → 596,94 |
ret |
endp |
align 4 |
proc glopOrtho uses eax ebx ecx, context:dword, p:dword |
locals |
x dd ? |
y dd ? |
A dd ? |
B dd ? |
C dd ? |
D dd ? |
m M4 |
endl |
mov eax,[context] |
mov ebx,[p] |
fld dword[ebx+8] |
fsub dword[ebx+4] ;st0 = (right-left) |
fld1 |
fadd st0,st0 ;st0 = 2.0 |
fdiv st0,st1 |
fstp dword[x] ;x = 2.0 / (right-left) |
fld dword[ebx+16] |
fsub dword[ebx+12] ;st0 = (top-bottom) |
fld1 |
fadd st0,st0 ;st0 = 2.0 |
fdiv st0,st1 |
fstp dword[y] ;y = 2.0 / (top-bottom) |
fld dword[ebx+8] |
fadd dword[ebx+4] |
fchs ;st0 = -(right+left) |
fdiv st0,st2 ;st2 = (right-left) |
fstp dword[A] ;A = -(right+left) / (right-left) |
fld dword[ebx+16] |
fadd dword[ebx+12] |
fchs ;st0 = -(top+bottom) |
fdiv st0,st1 ;st1 = (top-bottom) |
fstp dword[B] ;B = -(top+bottom) / (top-bottom) |
fld dword[ebx+24] |
fsub dword[ebx+20] ;st0 = (farp-near) |
fld1 |
fadd st0,st0 |
fchs ;st0 = -2.0 |
fdiv st0,st1 |
fstp dword[C] ;C = -2.0 / (farp-near) |
fld dword[ebx+24] |
fadd dword[ebx+20] ;st0 = farp+near |
fchs ;st0 = -(farp+near) |
fdiv st0,st1 |
fstp dword[D] ;D = -(farp*near) / (farp-near) |
ffree st0 |
fincstp |
ffree st0 |
fincstp |
ffree st0 |
fincstp |
lea ecx,[ebp-sizeof.M4] |
mov ebx,[x] |
mov dword[ecx],ebx |
mov dword[ecx+4],0.0 |
mov dword[ecx+8],0.0 |
mov ebx,[A] |
mov dword[ecx+12],ebx |
mov dword[ecx+16],0.0 |
mov ebx,[y] |
mov dword[ecx+20],ebx |
mov dword[ecx+24],0.0 |
mov ebx,[B] |
mov dword[ecx+28],ebx |
mov dword[ecx+32],0.0 |
mov dword[ecx+36],0.0 |
mov ebx,[C] |
mov dword[ecx+40],ebx |
mov ebx,[D] |
mov dword[ecx+44],ebx |
mov dword[ecx+48],0.0 |
mov dword[ecx+52],0.0 |
mov dword[ecx+56],0.0 |
mov dword[ecx+60],1.0 |
mov ebx,[eax+GLContext.matrix_mode] |
lea ebx,[eax+4*ebx] |
stdcall gl_M4_MulLeft,dword[ebx+GLContext.matrix_stack_ptr],ecx |
if DEBUG ;glopOrtho |
stdcall gl_print_matrix,ecx,4 |
stdcall gl_print_matrix,dword[ebx+GLContext.matrix_stack_ptr],4 |
end if |
gl_matrix_update eax,ebx |
ret |
endp |
/programs/develop/libraries/TinyGL/asm_fork/opinfo.inc |
---|
22,6 → 22,7 |
ADD_OP Viewport,4,'%d %d %d %d' |
ADD_OP Frustum,6,'%f %f %f %f %f %f' |
ADD_OP Ortho,6,'%f %f %f %f %f %f' |
ADD_OP Material,6,'%C %C %f %f %f %f' |
ADD_OP ColorMaterial,2,'%C %C' |
/programs/develop/libraries/TinyGL/asm_fork/vertex.asm |
---|
58,8 → 58,7 |
mov dword[q+8],ecx |
mov esi,[p] |
add esi,4 |
mov edi,ebp |
sub edi,16 ;edi = &q[3] |
lea edi,[ebp-16] ;edi = &q[3] |
mov ecx,4 |
rep movsd |
;mov edi,ebp |
144,8 → 143,7 |
stdcall gl_print_matrix,dword[edx+GLContext.matrix_stack_ptr],4 |
end if |
; precompute inverse modelview |
mov ebx,ebp |
sub ebx,sizeof.M4 |
lea ebx,[ebp-sizeof.M4] |
stdcall gl_M4_Inv, ebx,dword[edx+GLContext.matrix_stack_ptr] |
if DEBUG ;tmp |
stdcall dbg_print,txt_sp,txt_nl |
152,8 → 150,7 |
stdcall gl_print_matrix,ebx,4 |
end if |
push ebx |
mov ebx,edx |
add ebx,GLContext.matrix_model_view_inv |
lea ebx,[edx+GLContext.matrix_model_view_inv] |
stdcall gl_M4_Transpose, ebx |
if DEBUG ;context.matrix_model_view_inv |
stdcall dbg_print,txt_sp,txt_nl |
162,8 → 159,7 |
jmp .end_if_0 |
align 4 |
@@: |
mov ecx,edx |
add ecx,GLContext.matrix_model_projection |
lea ecx,[edx+GLContext.matrix_model_projection] |
; precompute projection matrix |
stdcall gl_M4_Mul, ecx,dword[edx+GLContext.matrix_stack_ptr+4],dword[edx+GLContext.matrix_stack_ptr] |
192,8 → 188,7 |
.end_if_0: |
; test if the texture matrix is not Identity |
mov eax,edx |
add eax,GLContext.matrix_stack_ptr+8 |
lea eax,[edx+GLContext.matrix_stack_ptr+8] |
stdcall gl_M4_IsId,eax |
xor eax,1 |
mov dword[edx+GLContext.apply_texture_matrix],eax |
265,9 → 260,9 |
; eye coordinates needed for lighting |
mov ebx,dword[eax+GLContext.matrix_stack_ptr] |
finit |
fld dword[edx+offs_vert_coord+offs_X] |
fld dword[edx+offs_vert_coord+offs_Y] |
fld dword[edx+offs_vert_coord+offs_Z] |
fld dword[edx+GLVertex.coord+offs_X] |
fld dword[edx+GLVertex.coord+offs_Y] |
fld dword[edx+GLVertex.coord+offs_Z] |
mov ecx,4 |
.cycle_0: |
280,7 → 275,7 |
fmul st0,st2 ;st0 *= v.coord.Z |
fadd dword[ebx+12] ;st0 += m[3] |
faddp ;st0 = v.ec.X |
fstp dword[edx+offs_vert_ec] ;v.ec.X = v.coord.X * m[0] + v.coord.Y * m[1] + v.coord.Z * m[2] + m[3] |
fstp dword[edx+GLVertex.ec] ;v.ec.X = v.coord.X * m[0] + v.coord.Y * m[1] + v.coord.Z * m[2] + m[3] |
add ebx,16 ;следущая строка матрицы |
add edx,4 ;следущая координата вектора |
loop .cycle_0 |
295,10 → 290,10 |
mov ebx,dword[eax+GLContext.matrix_stack_ptr+4] |
mov edx,[v] |
fld dword[edx+offs_vert_ec+offs_X] |
fld dword[edx+offs_vert_ec+offs_Y] |
fld dword[edx+offs_vert_ec+offs_Z] |
fld dword[edx+offs_vert_ec+offs_W] |
fld dword[edx+GLVertex.ec+offs_X] |
fld dword[edx+GLVertex.ec+offs_Y] |
fld dword[edx+GLVertex.ec+offs_Z] |
fld dword[edx+GLVertex.ec+offs_W] |
mov ecx,4 |
.cycle_1: |
313,7 → 308,7 |
fld dword[ebx+12] ;st0 = m[3] |
fmul st0,st2 ;st0 *= v.ec.W |
faddp ;st0 = v.pc.X |
fstp dword[edx+offs_vert_pc] ;v.pc.X = v.ec.X * m[0] + v.ec.Y * m[1] + v.ec.Z * m[2] + v.ec.W * m[3] |
fstp dword[edx+GLVertex.pc] ;v.pc.X = v.ec.X * m[0] + v.ec.Y * m[1] + v.ec.Z * m[2] + v.ec.W * m[3] |
add ebx,16 ;следущая строка матрицы |
add edx,4 ;следущая координата вектора |
loop .cycle_1 |
326,10 → 321,8 |
ffree st0 |
fincstp |
mov ebx,eax |
add ebx,GLContext.matrix_model_view_inv |
mov edi,eax |
add edi,GLContext.current_normal |
lea ebx,[eax+GLContext.matrix_model_view_inv] |
lea edi,[eax+GLContext.current_normal] |
mov edx,[v] |
fld dword[edi] ;edi = &n |
336,7 → 329,7 |
fld dword[edi+offs_Y] |
fld dword[edi+offs_Z] |
add edx,offs_vert_normal |
add edx,GLVertex.normal |
fld dword[ebx] ;st0 = m[0] |
fmul st0,st3 ;st0 *= n.X |
376,16 → 369,14 |
.els_0: |
; no eye coordinates needed, no normal |
; NOTE: W = 1 is assumed |
mov ebx,eax |
add ebx,GLContext.matrix_model_projection |
lea ebx,[eax+GLContext.matrix_model_projection] |
finit |
fld dword[edx+offs_vert_coord+offs_X] |
fld dword[edx+offs_vert_coord+offs_Y] |
fld dword[edx+offs_vert_coord+offs_Z] |
fld dword[edx+GLVertex.coord+offs_X] |
fld dword[edx+GLVertex.coord+offs_Y] |
fld dword[edx+GLVertex.coord+offs_Z] |
mov esi,edx |
add esi,offs_vert_pc |
lea esi,[edx+GLVertex.pc] |
fld dword[ebx] ;st0 = m[0] |
fmul st0,st3 ;st0 *= v.coord.X |
449,13 → 440,13 |
if DEBUG ;gl_vertex_transform |
stdcall dbg_print,f_vt,txt_nl |
mov edx,[v] |
add edx,offs_vert_pc |
add edx,GLVertex.pc |
stdcall gl_print_matrix,edx,1 |
end if |
mov edx,[v] |
stdcall gl_clipcode, dword[edx+offs_vert_pc+offs_X], dword[edx+offs_vert_pc+offs_Y],\ |
dword[edx+offs_vert_pc+offs_Z], dword[edx+offs_vert_pc+offs_W] |
mov dword[edx+offs_vert_clip_code],eax |
stdcall gl_clipcode, dword[edx+GLVertex.pc+offs_X], dword[edx+GLVertex.pc+offs_Y],\ |
dword[edx+GLVertex.pc+offs_Z], dword[edx+GLVertex.pc+offs_W] |
mov dword[edx+GLVertex.clip_code],eax |
popad |
ret |
endp |
503,8 → 494,7 |
mov esi,[p] |
add esi,4 |
mov edi,ebx |
add edi,offs_vert_coord ;edi = &v.coord |
lea edi,[ebx+GLVertex.coord] ;edi = &v.coord |
mov ecx,4 |
rep movsd |
517,10 → 507,8 |
jmp @f |
align 4 |
.els_0: |
mov esi,edx |
add esi,GLContext.current_color |
mov edi,ebx |
add edi,offs_vert_color ;edi = &v.color |
lea esi,[edx+GLContext.current_color] |
lea edi,[ebx+GLVertex.color] ;edi = &v.color |
mov ecx,4 |
rep movsd |
@@: |
530,25 → 518,21 |
je @f |
cmp dword[edx+GLContext.apply_texture_matrix],0 |
je .els_1 |
mov eax,edx |
add eax,GLContext.current_tex_coord |
lea eax,[edx+GLContext.current_tex_coord] |
push eax ;&context.current_tex_coord |
mov eax,ebx |
add eax,offs_vert_tex_coord |
lea eax,[ebx+GLVertex.tex_coord] |
stdcall gl_M4_MulV4, eax, dword[edx+GLContext.matrix_stack_ptr+8] |
jmp @f |
align 4 |
.els_1: |
mov esi,edx |
add esi,GLContext.current_tex_coord |
mov edi,ebx |
add edi,offs_vert_tex_coord |
lea esi,[edx+GLContext.current_tex_coord] |
lea edi,[ebx+GLVertex.tex_coord] |
mov ecx,4 |
rep movsd |
@@: |
; precompute the mapping to the viewport |
cmp dword[ebx+offs_vert_clip_code],0 |
cmp dword[ebx+GLVertex.clip_code],0 |
jne @f |
stdcall gl_transform_to_viewport, edx,ebx |
@@: |
555,7 → 539,7 |
; edge flag |
mov eax,[edx+GLContext.current_edge_flag] |
mov dword[ebx+offs_vert_edge_flag],eax ;v.edge_flag = context.current_edge_flag |
mov dword[ebx+GLVertex.edge_flag],eax ;v.edge_flag = context.current_edge_flag |
cmp dword[edx+GLContext.begin_type],GL_POINTS |
jne @f |
585,8 → 569,7 |
cmp dword[n],1 |
jne .els_2 |
mov esi,[edx+GLContext.vertex] |
mov edi,esi |
add edi,2*sizeof.GLVertex |
lea edi,[esi+2*sizeof.GLVertex] |
mov ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb |
rep movsd ;context.vertex[2] = context.vertex[0] |
jmp .end_f |
594,12 → 577,9 |
.els_2: |
cmp dword[n],2 |
jne .end_f ;else if (n == 2) |
mov eax,[edx+GLContext.vertex] |
push eax |
mov edi,eax |
add eax,sizeof.GLVertex |
mov esi,eax |
stdcall gl_draw_line, edx, eax |
mov edi,[edx+GLContext.vertex] |
lea esi,[edi+sizeof.GLVertex] |
stdcall gl_draw_line, edx, esi, edi |
mov ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb |
rep movsd ;context.vertex[0] = context.vertex[1] |
mov dword[n],1 |
662,12 → 642,10 |
jne .end_f |
mov eax,[edx+GLContext.vertex] |
mov [esp-12],eax |
add eax,sizeof.GLVertex |
mov [esp-8],eax |
mov edi,eax |
add eax,sizeof.GLVertex |
mov [esp-4],eax |
mov esi,eax |
lea edi,[eax+sizeof.GLVertex] |
mov [esp-8],edi |
lea esi,[edi+sizeof.GLVertex] |
mov [esp-4],esi |
sub esp,12 |
stdcall gl_draw_triangle, edx ;v0,v1,v2 |
mov ecx,(sizeof.GLVertex)/4 ;((...)/4) что-бы использовать movsd вместо movsb |
682,15 → 660,15 |
jne .end_f |
mov eax,[edx+GLContext.vertex] |
add eax,2*sizeof.GLVertex |
mov dword[eax+offs_vert_edge_flag],0 ;context.vertex[2].edge_flag = 0 |
mov dword[eax+GLVertex.edge_flag],0 ;context.vertex[2].edge_flag = 0 |
push eax |
sub eax,sizeof.GLVertex |
push eax |
sub eax,sizeof.GLVertex |
stdcall gl_draw_triangle, edx,eax ;v0,v1,v2 |
mov dword[eax+offs_vert_edge_flag],0 ;context.vertex[0].edge_flag = 0 |
mov dword[eax+GLVertex.edge_flag],0 ;context.vertex[0].edge_flag = 0 |
add eax,2*sizeof.GLVertex |
mov dword[eax+offs_vert_edge_flag],1 ;context.vertex[2].edge_flag = 1 |
mov dword[eax+GLVertex.edge_flag],1 ;context.vertex[2].edge_flag = 1 |
add eax,sizeof.GLVertex |
push eax |
sub eax,sizeof.GLVertex |