1 Commits

Author SHA1 Message Date
fbab20acc2 flood-it-fix-buttons-position
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 28s
Build system / Build (pull_request) Successful in 5m42s
2025-04-03 12:26:21 +02:00
91 changed files with 3122 additions and 4752 deletions

View File

@@ -49,6 +49,8 @@ img_files = {
{"MEDIA/IMGF/INVSOL.OBJ", "common/media/ImgF/invSol.obj"},
{"MEDIA/PIXIESKN.PNG", SRC_PROGS .. "/cmm/pixie2/pixieskn.png"},
{"NETWORK/FTPC.INI", SRC_PROGS .. "/network/ftpc/ftpc.ini"},
{"NETWORK/FTPC_SYS.PNG", SRC_PROGS .. "/network/ftpc/ftpc_sys.png"},
{"NETWORK/FTPC_NOD.PNG", SRC_PROGS .. "/network/ftpc/ftpc_nod.png"},
{"NETWORK/FTPD.INI", "common/network/ftpd.ini"},
{"NETWORK/KNMAP", "common/network/knmap"},
{"NETWORK/USERS.INI", "common/network/users.ini"},
@@ -152,6 +154,9 @@ extra_files = {
{"HD_Load/USB_boot_old/", SRC_PROGS .. "/hd_load/usb_boot_old/usb_boot_866.txt"},
{"HD_Load/USB_boot_old/", SRC_PROGS .. "/hd_load/usb_boot_old/usb_boot_1251.txt"},
{"kolibrios/3D/info3ds/INFO3DS.INI", SRC_PROGS .. "/develop/info3ds/info3ds.ini"},
{"kolibrios/3D/info3ds/OBJECTS.PNG", SRC_PROGS .. "/develop/info3ds/objects.png"},
{"kolibrios/3D/info3ds/TOOLBAR.PNG", SRC_PROGS .. "/develop/info3ds/toolbar.png"},
{"kolibrios/3D/info3ds/FONT8X9.BMP", SRC_PROGS .. "/fs/kfar/trunk/font8x9.bmp"},
{"kolibrios/3D/blocks/blocks.kex", "../programs/bcc32/games/blocks/bin/blocks.kex"},
{"kolibrios/3D/blocks/models/", "../programs/bcc32/games/blocks/models/*"},
{"kolibrios/3D/md2view/", "common/3d/md2view/*"},
@@ -407,7 +412,6 @@ tup.append_table(img_files, {
{"ACLOCK", VAR_PROGS .. "/demos/aclock/aclock"},
{"APM", VAR_PROGS .. "/system/apm/apm"},
{"CALC", VAR_PROGS .. "/other/calc/trunk/calc"},
{"CALCPLUS", VAR_PROGS .. "/other/calcplus/calcplus"},
{"CALENDAR", VAR_PROGS .. "/system/calendar/trunk/calendar"},
{"COLRDIAL", VAR_PROGS .. "/system/colrdial/color_dialog"},
{"CROPFLAT", VAR_PROGS .. "/system/cropflat/cropflat"},
@@ -425,7 +429,7 @@ tup.append_table(img_files, {
{"KPACK", VAR_PROGS .. "/other/kpack/trunk/kpack"},
{"LAUNCHER", VAR_PROGS .. "/system/launcher/trunk/launcher"},
{"LOADDRV", VAR_PROGS .. "/system/loaddrv/loaddrv"},
{"MAGNIFY", VAR_PROGS .. "/system/magnify/magnify"},
{"MAGNIFY", VAR_PROGS .. "/demos/magnify/trunk/magnify"},
{"MGB", VAR_PROGS .. "/testing/mgb/trunk/mgb"},
{"MOUSEMUL", VAR_PROGS .. "/system/mousemul/trunk/mousemul"},
{"MADMOUSE", VAR_PROGS .. "/other/madmouse/madmouse"},
@@ -601,7 +605,6 @@ 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"},
@@ -625,6 +628,7 @@ tup.append_table(extra_files, {
{"kolibrios/media/zsea/plugins/rotate.obj", VAR_PROGS .. "/media/zsea/plugins/rotate/rotate.obj"},
{"kolibrios/media/zsea/plugins/scaling.obj", VAR_PROGS .. "/media/zsea/plugins/scaling/scaling.obj"},
{"kolibrios/utils/AMDtemp", VAR_PROGS .. "/system/amd_temp_view/AMDtemp"},
{"kolibrios/utils/calcplus", VAR_PROGS .. "/other/calcplus/calcplus"},
{"kolibrios/utils/kfm/kfm", VAR_PROGS .. "/fs/kfm/trunk/kfm"},
{"kolibrios/utils/tedit/t_edit", VAR_PROGS .. "/other/t_edit/t_edit"},
{"kolibrios/3D/blocks/block.bin", VAR_PROGS .. "/bcc32/games/blocks/block.bin"}

View File

@@ -29,6 +29,7 @@ Dicty=/k/utils/DICTY.KEX,79
fNav=/k/utils/fNav/fNav,93
CncEditor=/k/utils/cnc_editor/cnc_editor,15
Life=/k/demos/life2,13
Calc+=/k/utils/calcplus,4
TinyBasic=/k/develop/TinyBasic/TinyBasic,91
THashView=/k/utils/thashview,124
Notes=/k/utils/notes,117

View File

@@ -235,8 +235,8 @@ ico=58
x=68
y=68
[21]
name=CALC+
path=CALCPLUS
name=CALC
path=CALC
param=
ico=4
x=204

View File

@@ -92,7 +92,6 @@
59 Screen keyboard |zkey
#10 **** DATA PROCESSING
16 Calculator |calc
16 Calculator+ |calcplus
03 Tinypad |tinypad
28 CodeEdit |develop/cedit
21 Table processor |table

View File

@@ -235,8 +235,8 @@ ico=58
x=68
y=68
[21]
name=CALC+
path=CALCPLUS
name=CALC
path=CALC
param=
ico=4
x=204

View File

@@ -96,7 +96,6 @@
24 NDN * |/kolibrios/utils/ndn/ndn
#11 **** PROCESO DE DATOS
16 Calculadora |calc
16 Calculadora+ |calcplus
16 Tinypad |tinypad
16 CodeEdit |develop/cedit
16 Procesador de tablas |table

View File

@@ -235,8 +235,8 @@ ico=58
x=68
y=68
[21]
name=CALC+
path=CALCPLUS
name=CALC
path=CALC
param=
ico=4
x=204

View File

@@ -80,7 +80,6 @@
65 NDN * |/kolibrios/utils/ndn/ndn
#11 **** DATA PROCESSING ****
16 Kalkulaator |calc
16 Kalkulaator+ |calcplus
16 Teksti redaktor |tinypad
16 CodeEdit |develop/cedit
16 Tabelarvutus |table

View File

@@ -235,8 +235,8 @@ ico=58
x=68
y=68
[21]
name=CALC+
path=CALCPLUS
name=CALC
path=CALC
param=
ico=4
x=204

View File

@@ -79,7 +79,6 @@
65 NDN * |/kolibrios/utils/ndn/ndn
#11 **** DATA PROCESSING
16 Calcolatrice |calc
16 Calcolatrice+ |calcplus
16 Tinypad |tinypad
16 CodeEdit |develop/cedit
16 Table Processor |table

View File

@@ -235,8 +235,8 @@ ico=58
x=68
y=68
[21]
name=CALC+
path=CALCPLUS
name=CALC
path=CALC
param=
ico=4
x=204

View File

@@ -90,7 +90,6 @@
59 <20><><EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |zkey
#10 **** <20><><EFBFBD><EFBFBD>
16 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |calc
16 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+ |calcplus
03 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Tinypad |tinypad
28 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CodeEdit |develop/cedit
21 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> |table

View File

@@ -668,8 +668,6 @@ socket_accept:
DEBUGF DEBUG_NETWORK_VERBOSE, "SOCKET_accept: socknum=%u sockaddr=%x length=%u\n", ecx, edx, esi
push edx esi
call socket_num_to_ptr
test eax, eax
jz .invalid
@@ -698,24 +696,6 @@ socket_accept:
mov ebx, [ebx + APPDATA.tid]
mov [eax + SOCKET.TID], ebx
pop esi edx
test edx, edx
jz .skip_sockaddr
mov word[edx], 0 ; unknown domain
cmp esi, 8 ; domain + port + ipv4
jb .skip_sockaddr
mov word[edx], AF_INET4
mov esi, edx
mov edx, [eax + IP_SOCKET.RemoteIP]
mov [esi + sockaddr.ip], edx
mov dx, [eax + TCP_SOCKET.RemotePort]
mov [esi + sockaddr.port], dx
.skip_sockaddr:
; Return socket number to caller
mov eax, [eax + SOCKET.Number]
mov [esp + SYSCALL_STACK.eax], eax
@@ -731,19 +711,16 @@ socket_accept:
.wouldblock:
mov dword[esp + SYSCALL_STACK.ebx], EWOULDBLOCK
mov dword[esp + SYSCALL_STACK.eax], -1
pop esi edx
ret
.invalid:
mov dword[esp + SYSCALL_STACK.ebx], EINVAL
mov dword[esp + SYSCALL_STACK.eax], -1
pop esi edx
ret
.notsupp:
mov dword[esp + SYSCALL_STACK.ebx], EOPNOTSUPP
mov dword[esp + SYSCALL_STACK.eax], -1
pop esi edx
ret
;-----------------------------------------------------------------;

View File

@@ -692,15 +692,6 @@ struct TinyGLContext
long int dx, dy, x, y;
};
struct GLUquadricObj
{
GLenum DrawStyle; // GLU_FILL, LINE, SILHOUETTE, or POINT
GLenum Orientation; // GLU_INSIDE or GLU_OUTSIDE
GLboolean TextureFlag; // Generate texture coords?
GLenum Normals; // GLU_NONE, GLU_FLAT, or GLU_SMOOTH
void (__stdcall* ErrorFunc)(GLenum err); // Error handler callback function
};
//
// tinygl - import table
//
@@ -757,7 +748,7 @@ void (__stdcall* glEdgeFlag)(int flag) = (void (__stdcall*)(int))&"glEdgeFlag";
void (__stdcall* glMatrixMode)(int mode) = (void (__stdcall*)(int))&"glMatrixMode";
void (__stdcall* glLoadMatrixf)(const float* m) = (void (__stdcall*)(const float*))&"glLoadMatrixf";
void (__stdcall* glLoadIdentity)() = (void (__stdcall*)())&"glLoadIdentity";
void (__stdcall* glMultMatrixf)(const GLfloat *m) = (void (__stdcall*)(const GLfloat*))&"glMultMatrixf";
//void (__stdcall* glMultMatrixf)(...) = (void (__stdcall*)(...))&"glMultMatrixf";
void (__stdcall* glPushMatrix)() = (void (__stdcall*)())&"glPushMatrix";
void (__stdcall* glPopMatrix)() = (void (__stdcall*)())&"glPopMatrix";
void (__stdcall* glRotatef)(float angle, float x, float y, float z) = (void (__stdcall*)(float, float, float, float))&"glRotatef";
@@ -772,7 +763,7 @@ void (__stdcall* glEndList)() = (void (__stdcall*)())&"glEndList";
void (__stdcall* glCallList)(unsigned int list) = (void (__stdcall*)(unsigned int))&"glCallList";
void (__stdcall* glClear)(int mask) = (void (__stdcall*)(int))&"glClear";
void (__stdcall* glClearColor)(float r, float g, float b, float a) = (void (__stdcall*)(float, float, float, float))&"glClearColor";
void (__stdcall* glClearDepth)(double depth) = (void (__stdcall*)(double))&"glClearDepth";
//void (__stdcall* glClearDepth)(...) = (void (__stdcall*)(...))&"glClearDepth";
void (__stdcall* glRenderMode)(int mode) = (void (__stdcall*)(int))&"glRenderMode";
//void (__stdcall* glSelectBuffer)(...) = (void (__stdcall*)(...))&"glSelectBuffer";
//void (__stdcall* glInitNames)(...) = (void (__stdcall*)(...))&"glInitNames";
@@ -808,22 +799,18 @@ void (__stdcall* glColorPointer)(GLint size, GLenum type, GLsizei stride, const
void (__stdcall* glNormalPointer)(GLenum type, GLsizei stride, const GLvoid* pointer) = (void (__stdcall*)(GLenum, GLsizei, const GLvoid*))&"glNormalPointer";
void (__stdcall* glTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) = (void (__stdcall*)(GLint, GLenum, GLsizei, const GLvoid*))&"glTexCoordPointer";
//void (__stdcall* glPolygonOffset)(...) = (void (__stdcall*)(...))&"glPolygonOffset";
void (__stdcall* glOrtho)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar) = (void (__stdcall*)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble))&"glOrtho";
//void (__stdcall* glOrtho)(...) = (void (__stdcall*)(...))&"glOrtho";
//void (__stdcall* glDebug)(...) = (void (__stdcall*)(...))&"glDebug";
//void (__stdcall* glInit)(...) = (void (__stdcall*)(...))&"glInit";
//void (__stdcall* glClose)(...) = (void (__stdcall*)(...))&"glClose";
void (__stdcall* gluPerspective)(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar) = (void (__stdcall*)(GLdouble, GLdouble, GLdouble, GLdouble))&"gluPerspective";
GLUquadricObj* (__stdcall* gluNewQuadric)() = (GLUquadricObj* (__stdcall*)())&"gluNewQuadric";
void (__stdcall* gluDeleteQuadric)(GLUquadricObj *state) = (void (__stdcall*)(GLUquadricObj*))&"gluDeleteQuadric";
void (__stdcall* gluQuadricDrawStyle)(GLUquadricObj *quadObject, GLenum drawStyle) = (void (__stdcall*)(GLUquadricObj*, GLenum))&"gluQuadricDrawStyle";
void (__stdcall* gluQuadricOrientation)(GLUquadricObj *quadObject, GLenum orientation) = (void (__stdcall*)(GLUquadricObj*, GLenum))&"gluQuadricOrientation";
void (__stdcall* gluQuadricTexture)(GLUquadricObj *quadObject, GLboolean textureCoords) = (void (__stdcall*)(GLUquadricObj*, GLboolean))&"gluQuadricTexture";
void (__stdcall* gluCylinder)(GLUquadricObj *qobj,
GLdouble baseRadius, GLdouble topRadius, GLdouble height, GLint slices, GLint stacks) = (void (__stdcall*)(GLUquadricObj*, GLdouble, GLdouble, GLdouble, GLint, GLint))&"gluCylinder";
void (__stdcall* gluDisk)(GLUquadricObj *qobj,
GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops) = (void (__stdcall*)(GLUquadricObj*, GLdouble, GLdouble, GLint, GLint))&"gluDisk";
void (__stdcall* gluSphere)(GLUquadricObj *qobj,
GLdouble radius, GLint slices, GLint stacks) = (void (__stdcall*)(GLUquadricObj*, GLdouble, GLint, GLint))&"gluSphere";
//void (__stdcall* gluPerspective)(...) = (void (__stdcall*)(...))&"gluPerspective";
//void (__stdcall* gluNewQuadric)(...) = (void (__stdcall*)(...))&"gluNewQuadric";
//void (__stdcall* gluDeleteQuadric)(...) = (void (__stdcall*)(...))&"gluDeleteQuadric";
//void (__stdcall* gluQuadricDrawStyle)(...) = (void (__stdcall*)(...))&"gluQuadricDrawStyle";
//void (__stdcall* gluQuadricOrientation)(...) = (void (__stdcall*)(...))&"gluQuadricOrientation";
//void (__stdcall* gluQuadricTexture)(...) = (void (__stdcall*)(...))&"gluQuadricTexture";
//void (__stdcall* gluCylinder)(...) = (void (__stdcall*)(...))&"gluCylinder";
//void (__stdcall* gluSphere)(...) = (void (__stdcall*)(...))&"gluSphere";
void (__stdcall* kosglMakeCurrent)(long l, long t, long w, long h, TinyGLContext*) = (void (__stdcall*)(long, long, long, long, TinyGLContext*))&"kosglMakeCurrent";
void (__stdcall* kosglSwapBuffers)() = (void (__stdcall*)())&"kosglSwapBuffers";
asm{

View File

@@ -85,7 +85,6 @@ struct TWebBrowser {
void tag_table();
void tag_td();
void tag_tr();
void reset_font_style();
};
#include "TWB\render.h"
@@ -95,16 +94,16 @@ void TWebBrowser::SetPageDefaults()
{
t_html = t_body = link = false;
style.reset();
reset_font_style();
link_color_default = 0x0000FF;
link_color_active = 0xFF0000;
style.cur_line_h = list.item_h;
links.clear();
anchors.clear();
img_url.drop();
text_colors.drop();
text_colors.add(0);
if (secondrun) {
canvas.Init(list.x, list.y, list.w, math.max(list.visible, list.count)+200);
canvas.Init(list.x, list.y, list.w, math.max(list.visible, list.count));
canvas.Fill(0, bg_colors.get(0));
}
bg_colors.drop();
@@ -115,6 +114,7 @@ void TWebBrowser::SetPageDefaults()
draw_w = list.w - BODY_MARGIN - BODY_MARGIN;
linebuf = 0;
redirect = '\0';
list.SetFont(8, 14, 10011000b);
tag_table_reset();
is_html = true;
if (!strstri(bufpointer, "<body")) {

View File

@@ -49,14 +49,14 @@ void TWebBrowser::RenderLine(dword _line)
pc = text_colors.get_last();
if (link) && (pc == text_colors.get(0)) pc = link_color_default;
canvas.WriteText(draw_x, draw_y+1, list.font_type, pc, _line, NULL);
if (style.b) canvas.WriteText(draw_x+1, draw_y+1, list.font_type, pc, _line, NULL);
canvas.WriteText(draw_x, draw_y, list.font_type, pc, _line, NULL);
if (style.b) canvas.WriteText(draw_x+1, draw_y, list.font_type, pc, _line, NULL);
if (style.s) canvas.DrawBar(draw_x, list.item_h / 2 - zoom + draw_y, pw, zoom, pc);
if (style.u) canvas.DrawBar(draw_x, draw_y + list.font_h, pw, zoom, pc);
if (style.u) canvas.DrawBar(draw_x, list.item_h - zoom - zoom + draw_y, pw, zoom, pc);
if (link) {
if (ESBYTE[_line]==' ') && (ESBYTE[_line+1]==NULL) {} else {
canvas.DrawBar(draw_x, draw_y + list.font_h, pw, zoom, link_color_default);
links.add_text(draw_x, draw_y + list.y, pw, list.font_h, zoom);
canvas.DrawBar(draw_x, draw_y + list.item_h - calc(zoom*2)-1, pw, zoom, link_color_default);
links.add_text(draw_x, draw_y + list.y, pw, list.item_h - calc(zoom*2)-1, zoom);
}
}
_SKIP_DRAW:

View File

@@ -208,20 +208,9 @@ void TWebBrowser::tag_li()
void TWebBrowser::tag_hr()
{
dword hrcol = 0x00777777;
dword hr_width = draw_w-BODY_MARGIN-BODY_MARGIN;
dword hr_size = 1;
if (tag.get_value_of("color")) {
hrcol = GetColor(tag.value);
}
if (tag.get_value_of("width")) && (!strchr(tag.value, '%')) {
hr_width = math.min(hr_width, tag.get_number_of("width"));
}
if (tag.get_number_of("size")) {
hr_size = math.min(500, tag.number);
}
if (tag.get_value_of("color")) hrcol = GetColor(tag.value);
if (draw_x != left_gap) NewLine();
if (secondrun) canvas.DrawBar(left_gap, style.cur_line_h / 2 + draw_y - 1, hr_width, hr_size, hrcol);
draw_y += hr_size - 3;
if (secondrun) canvas.DrawBar(5+left_gap, style.cur_line_h / 2 + draw_y - 1, draw_w-10, 1, hrcol);
draw_x++;
NewLine();
return;
@@ -246,12 +235,6 @@ void TWebBrowser::tag_q()
chrncat(#linebuf, '\"', sizeof(TWebBrowser.linebuf));
}
void TWebBrowser::reset_font_style()
{
list.SetFont(BASIC_CHAR_W, 14, 10011000b);
style.cur_line_h = list.item_h = list.font_h + 5;
}
void TWebBrowser::tag_h1234_caption()
{
if (ESBYTE[#tag.name+1]=='4') {
@@ -267,18 +250,19 @@ void TWebBrowser::tag_h1234_caption()
NewLine();
}
if (tag.is("h1")) {
list.SetFont(BASIC_CHAR_W*2, 14+13, 10011001b);
list.SetFont(BASIC_CHAR_W*2, 14+14, 10011001b);
style.b = true;
} else if (tag.is("h2")) {
list.SetFont(BASIC_CHAR_W*2, 14+13, 10011001b);
list.SetFont(BASIC_CHAR_W*2, 14+14, 10011001b);
} else {
list.SetFont(6*2, 9+8, 10001001b);
list.SetFont(6*2, 9+7, 10001001b);
}
style.cur_line_h = list.item_h = list.font_h + 3;
style.cur_line_h = list.item_h = list.font_h + 2;
} else {
if (tag.is("h1")) style.b = false;
NewLine();
reset_font_style();
list.SetFont(BASIC_CHAR_W, 14, 10011000b);
style.cur_line_h = list.item_h = BASIC_LINE_H;
}
}
}
@@ -292,7 +276,7 @@ void TWebBrowser::tag_kosicon()
if (shared_i18) && (tag.get_number_of("n")) {
if (tag.number < maxicon) {
if (draw_x + 18 > canvas.bufw) NewLine();
canvas.DrawImage(draw_x, draw_y-1, 18, 18, 18*18*4*tag.number+shared_i18);
canvas.DrawImage(draw_x, draw_y-2, 18, 18, 18*18*4*tag.number+shared_i18);
draw_x += 22;
}
}

View File

@@ -112,4 +112,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw";
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
char version[]="WebView 3.91";
char version[]="WebView 3.9";

View File

@@ -1,7 +1,7 @@
#ifdef LANG_RUS
#define HISTORY_HEADER "<html><title><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></title><body bgcolor=#fff><h3><3E><><EFBFBD><EFBFBD><EFBFBD><E9A5AD><EFBFBD> <20><><EFBFBD><E0A0AD><EFBFBD></h3><br>"
#define HISTORY_HEADER "<html><title><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></title><body><b><3E><><EFBFBD><EFBFBD><EFBFBD><E9A5AD><EFBFBD> <20><><EFBFBD><E0A0AD><EFBFBD></b><br>"
#else
#define HISTORY_HEADER "<html><title>History</title><body bgcolor=#fff><h3>Visited pages</h3><br>"
#define HISTORY_HEADER "<html><title>History</title><body><b>Visited pages</b><br>"
#endif
@@ -13,7 +13,7 @@ ShowHistory()
for (i=0; i<history.items.count-1; i++) //if (cache.type.get(i) == PAGE)
{
strcat(history_pointer, "<kosicon n=3><a href='");
strcat(history_pointer, "<a href='");
strcat(history_pointer, history.items.get(i));
strcat(history_pointer, "'>");
strcat(history_pointer, history.items.get(i));

View File

@@ -1,18 +1,18 @@
<html><head><title>New tab</title></head>
<body bgcolor=#fff>
<table><tr><td width=20><td width=220><pre>
_____________________
|# : : #|
| : WebView : |
| : for : |
| : KolibriOS : |
| : : |
| :_______________: |
| ____________ |
| | __ | |
| || | | |
\_____||__|________|__|<font color=#DDD>lc</font>
<table><tr><td width=20><td width=210><pre>
___________________
|# : : #|
| : WebView : |
| : TextBased : |
| : Browser : |
| : : |
| :_____________: |
| ___________ |
| | __ | |
| || | | |
\____||__|_______|__|<font color=#DDD>lc</font>
<font bg=#F8F15B> web <font bg=#FF5A7E color=#fff> 1.0 <font bg=#47D018> compatable
<font bg=#3CE7FF> </font></font></font></font>

View File

@@ -1,18 +1,18 @@
<html><head><title><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></title></head>
<body bgcolor=#fff>
<table><tr><td width=20><td width=220><pre>
_____________________
|# : : #|
| : WebView : |
| : for : |
| : KolibriOS : |
| : : |
| :_______________: |
| ____________ |
| | __ | |
| || | | |
\_____||__|________|__|<font color=#DDD>lc</font>
<table><tr><td width=20><td width=210><pre>
___________________
|# : : #|
| : WebView : |
| : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : |
| : <EFBFBD><EFBFBD><EFBFBD><EFBFBD> : |
| : : |
| :_____________: |
| ___________ |
| | __ | |
| || | | |
\____||__|_______|__|<font color=#DDD>lc</font>
<font bg=#F8F15B> web <font bg=#FF5A7E color=#fff> 1.0 <font bg=#47D018> compatable
<font bg=#3CE7FF> </font></font></font></font>

View File

@@ -5,19 +5,12 @@
<title>Тест Acid 0.1</title>
</head>
<body bgcolor="#000000" link="#0066FF" text="#FFFFFF">
<h1 align=center>Тест Acid 0.1</h1>
<br>
<b>Это тестовая страница для проверки текстового браузера <s>HTML Viewer</s> WebView</b>
<p>Из кодировок поддерживаются: CP866(DOS), CP1251(Windows), CP1252(Latin legacy), KOI8, и конечно UTF8. CSS и Javascript пока не реализованы (ахахаха). Поддержка тега &lt;table&gt; крайне базовая, поддержки вложенных таблиц нет.
<h1 align=center>Это тестовая страница для проверки WebViewer</h1>
<br />
<p>WebViewer является текстовым браузером и поддерживает все популярные кодировки (cp1251, koi-8, cp866, unicode)
и некоторые теги. Поддержка таблииц (&lt;table&gt;), CSS, Javascript'a и Контактика пока не реализована :)
</p>
<h3>История</h3>
Ранее программа называлась <b >HTMLv (HTML Viewer)</b> и изначально задумывалась как <q>Центр справки и поддержки</q>. Чтобы не изобретать велосипед и одновременно исполнить мечту многих, форматом просматриваемых страниц был выбран html.
Первоначальный автор Veliant, затем разработка была подхвачена дизайнером Leency. Это была моя вторая программа после файлового менеджера Eolite.<br>
<span> <br />
<br />
<b>
<font color="#FF0000">K</font>
@@ -40,8 +33,7 @@
</b>
<br>
<table>
<td>
<p>
<bg bgcolor=#333>
Небольшой список:<ol>
<li><q>Этот текст в кавычках</q></li>
@@ -54,14 +46,17 @@
</p>
<br>
<pre>
"Осень уже пришла!"-
Шепнул мне на ухо ветер,
Подкравшись к подушке моей.
Басе
</pre>
<!-- комментарий: этого текста здесь <нет> -->
<br>
<img alt="нет картинки, просто alt">
<img src = http://wiby.org/about/wibyplex.gif>
<a href="http://kolibrios.org/i/logo.png"><img id="2.1.4" src="http://kolibrios.org/i/logo.png" alt="logo"><br>Открыть</a><br>
<br>
@@ -70,25 +65,10 @@
<a href='/sys/index.htm'>Незакрытый тег а - index.htm<br>
<a href="/sys/calc">/sys/calc</a><br>
<a href="#2.1.4">#2.1.4</a><br>
<a href="http://kolibrios.org">http://kolibrios.org</a><br>
<a href="http://bash.im">http://bash.im</a><br>
<a href="mailto:leency@mail.ru">Mail to Leency</a><br>
<br>
<h1><a href=#>Link H1</a> <u>Underline H1</u></h1>
<h2><a href=#>Link H2</a> <u>Underline H2</u></h2>
<h3><a href=#>Link H3</a> <u>Underline H2</u></h3>
<a href=#>Link</a> <u>Underline</u>
<td>
<pre>
"Осень уже пришла!"-
Шепнул мне на ухо ветер,
Подкравшись к подушке моей.
Басе
</pre><br>
<br>
В этом тексте есть переход на следующую строку, но браузер
его должен проигнорировать. Еще много пробелов. А тут есть
@@ -100,19 +80,8 @@
&#1082;&#1086;&#1088;&#1087;&#1091;&#1089; &#1085;&#1072; &#1090;&#1077;&#1088;&#1088;&#1080;&#1090;&#1086;&#1088;&#1080;&#1080; &#1053;&#1058;&#1059; «&#1061;&#1055;&#1048;»
</p>
<pre><font color="#000">
<font bg=#FFED00 style="background-color:#FFED00"> Заметки </font>
<font bg=#FFFBCE style="background-color:#FFFBCE"> </font>
<font bg=#FFFBCE style="background-color:#FFFBCE"> Речка на Жукова </font>
<font bg=#FFFBCE style="background-color:#FFFBCE"> Heroes 3 </font>
<font bg=#FFFBCE style="background-color:#FFFBCE"> Рисостерон, куринабол </font>
<font bg=#FFFBCE style="background-color:#FFFBCE"> </font>
</font></pre>
</table>
<hr color="#758999">
<center>Zhytomyr 2008-2025</center>
<center>Zhitomyr 2008-2015</center>
</body>

View File

@@ -1,2 +0,0 @@
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("flag.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "flag")

View File

@@ -1,306 +0,0 @@
; SPDX-License-Identifier: GPL-2.0-only
; Flag - demo program shows a flag with the inscription 'KolibriOS'
; Copyright (C) 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/kosgl.inc'
include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc'
include '../../develop/libraries/TinyGL/asm_fork/examples/fps.inc'
@use_library
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
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
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_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
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, 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 '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
; 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
p1 dq 28.0
p3 dq 1.0
p4 dq 40.0
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
{
if defined sz_#n
n dd sz_#n
end if
}
include '../../develop/libraries/TinyGL/asm_fork/export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../../develop/libraries/TinyGL/asm_fork/export.inc'
;--------------------------------------------------
system_path db '/sys/lib/'
name_tgl db 'tinygl.obj',0
;--------------------------------------------------
align 16
i_end:
ctx1 TinyGLContext
procinfo process_information
cur_dir_path rb 4096
library_path rb 4096
rb 4096
stacktop:
mem:

View File

@@ -0,0 +1,7 @@
if tup.getconfig("NO_FASM") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
add_include(tup.getvariantdir())
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en_US" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"})
tup.rule({"magnify.asm", extra_inputs = {"lang.inc"}}, FASM .. " %f %o " .. tup.getconfig("KPACK_CMD"), "magnify")

View File

@@ -0,0 +1,6 @@
@erase lang.inc
@echo lang fix en_US >lang.inc
@fasm magnify.asm magnify
@kpack magnify
@erase lang.inc
@pause

View File

@@ -0,0 +1,6 @@
@erase lang.inc
@echo lang fix ru_RU >lang.inc
@fasm magnify.asm magnify
@kpack magnify
@erase lang.inc
@pause

View File

@@ -0,0 +1,156 @@
;---------------------------------------------------------------------
; MAGNIFY SCREEN v1.0
;
; Version for KolibriOS 2005-2011
;
; Version for Menuet to 2005
;---------------------------------------------------------------------
; last update: 08/18/2011
; changed by: Marat Zakiyanov aka Mario79, aka Mario
; changes: Checking for "rolled up" window
;---------------------------------------------------------------------
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 1 ; header version
dd START ; program start
dd I_END ; program image size
dd 0x1000 ; required amount of memory
dd 0x1000 ; esp
dd 0, 0 ; no parameters, no path
;---------------------------------------------------------------------
include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US.
include '..\..\..\macros.inc'
delay equ 20
magnify_width = 40
magnify_height = 30
;---------------------------------------------------------------------
START: ; start of execution
redraw:
call draw_window
still:
call draw_magnify
wtevent:
mcall 23,delay ; wait here for event with timeout
dec eax
js still
jz redraw
dec eax
jnz button
; key in buffer
mov al, 2
mcall
jmp wtevent
;---------------------------------------------------------------------
button:
; we have only one button, close
or eax, -1
mcall
;---------------------------------------------------------------------
; ******* WINDOW DEFINITIONS AND DRAW ********
;---------------------------------------------------------------------
draw_window:
mcall 12,1
mov al, 48 ; function 48 : graphics parameters
mov bl, 4 ; subfunction 4 : get skin height
mcall
; DRAW WINDOW
mov ebx, 100*65536 + 8*magnify_width + 8
lea ecx, [eax + 100*65536 + 8*magnify_height + 3]
mov edx, 0x34000000 ; color of work area RRGGBB
mov edi, labelt ; header
xor eax, eax ; function 0 : define and draw window
mcall
mcall 12,2
ret
;---------------------------------------------------------------------
draw_magnify:
mcall 9,procinfo,-1
mov eax,[procinfo+70] ;status of window
test eax,100b
jne .end
mcall 14 ; get screen size
movzx ecx, ax
inc ecx
mov [size_y], ecx
shr eax, 16
inc eax
mov [size_x], eax
xor ebx, ebx
mcall 37 ; get mouse coordinates
mov ecx, eax
shr ecx, 16 ; ecx = x
movzx edx, ax ; edx = y
inc ecx
mov [m_xe], ecx
inc edx
mov [m_ye], edx
sub ecx, magnify_width
sub edx, magnify_height
mov [m_x], ecx
mov [m_y], edx
.loop_y:
.loop_x:
xor eax, eax ; assume black color for invalid pixels
test ecx, ecx
js .nopix
cmp ecx, [size_x]
jge .nopix
test edx, edx
js .nopix
cmp edx, [size_y]
jge .nopix
mov ebx, edx
imul ebx, [size_x]
add ebx, ecx
mcall 35 ; read pixel
.nopix:
push ecx edx
sub ecx, [m_x]
sub edx, [m_y]
mov ebx, ecx
shl ebx, 3+16
mov bl, 8
mov ecx, edx
shl ecx, 3+16
mov cl, 8
mov edx, eax
mcall 13
pop edx ecx
inc ecx
cmp ecx, [m_xe]
jnz .loop_x
mov ecx, [m_x]
inc edx
cmp edx, [m_ye]
jnz .loop_y
.end:
ret
;---------------------------------------------------------------------
; DATA AREA
;---------------------------------------------------------------------
if lang eq ru_RU
labelt:
db 'Magnifier - <20><><EFBFBD><E0A0AD><EFBFBD> <20>㯠', 0
else ; Default to en_US
labelt:
db 'Magnifier', 0
end if
I_END:
align 4
m_x dd ?
m_y dd ?
m_xe dd ?
m_ye dd ?
size_x dd ?
size_y dd ?
;---------------------------------------------------------------------
procinfo:
rb 1024
;---------------------------------------------------------------------

Binary file not shown.

View File

@@ -28,7 +28,7 @@ IMPORT
RW, Ini, EB := EditBox, Tabs, Toolbar, SB := StatusBar;
CONST
HEADER = "CEdit (30-apr-2025)";
HEADER = "CEdit (27-feb-2025)";
ShellFilter = "";
EditFilter = "sh|inc|txt|asm|ob07|c|cpp|h|pas|pp|lua|ini|json";
@@ -1320,7 +1320,7 @@ BEGIN
|menuBoard:
K.Run("/sys/develop/board", "")
|menuSysFunc:
K.Run("/sys/docpack", "e")
K.Run("/sys/docpack", "f")
|menuLineNumbers:
T.toggleNumbers;
Ini.setInt("settings", "line_numbers", ORD(T.lineNumbers))

View File

@@ -1,4 +1,2 @@
if tup.getconfig("NO_FASM") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
tup.rule("charsets.asm", FASM .. " -dlang=" .. tup.getconfig("LANG") .. " %f %o" .. tup.getconfig("KPACK_CMD"), "%B")
tup.rule("charsets.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "charsets")

View File

@@ -31,19 +31,3 @@ Development history
- Renamed to Charsets Viewer/Charsets
- Symbol highlight UI tweaks
- Fixed rolled up bug
30.03.2025 - 0.4.0
- Localization for all system languages
- Display all character scales
- Abolity to copy character codes
- Block on charpage 00 for CP866
- New character code half markers
- Navigation using keys (see hotkeys.txt)
03.04.2025 - 0.4.1
- Fixed bug with codes color subscription
04.04.2025 - 0.4.2
- Fixed bug with resetting UTF charpage to zero on double charset swap to CP866
- Improved charpage blocking for CP866 UX
- Improved char codes copying UI

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +0,0 @@
Control hotkeys
- Navigate inside charpage:
- Arrows
- Num2/4/6/8
- Navigation between charpages:
- PgDN, PgUP - previous/next page
- Num0, Home - reset page to zero
- Change symbol scale:
- Num- and Num+

View File

@@ -2,6 +2,9 @@ if not exist bin mkdir bin
@erase lang.inc
@echo lang fix en_US >lang.inc
@copy objects.png bin\objects.png
if not exist bin\info3ds.ini @copy info3ds.ini bin\info3ds.ini
if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png
if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp
@fasm.exe -m 16384 info3ds.asm bin\info3ds.kex
@kpack bin\info3ds.kex
@fasm.exe -m 16384 info3ds_u.asm bin\info3ds_u.kex

View File

@@ -2,6 +2,9 @@ if not exist bin mkdir bin
@erase lang.inc
@echo lang fix ru_RU >lang.inc
@copy objects.png bin\objects.png
if not exist bin\info3ds.ini @copy info3ds.ini bin\info3ds.ini
if not exist bin\toolbar.png @copy toolbar.png bin\toolbar.png
if not exist bin\font8x9.bmp @copy ..\..\fs\kfar\trunk\font8x9.bmp bin\font8x9.bmp
@fasm.exe -m 16384 info3ds.asm bin\info3ds.kex
@kpack bin\info3ds.kex
@fasm.exe -m 16384 info3ds_u.asm bin\info3ds_u.kex

View File

@@ -1,10 +1,6 @@
; SPDX-License-Identifier: GPL-2.0-only
; Info3ds - is a program for viewing the structure of *.3ds files
; Copyright (C) 2011-2025 KolibriOS team
use32
org 0
db 'MENUET01'
db 'MENUET01' ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><E1AFAE><EFBFBD><EFA5AC><EFBFBD><><E4A0A9> <20><EFBFBD><E1A5A3> 8 <20><><EFBFBD><EFBFBD>
dd 1, start, i_end, mem, stacktop, file_name, sys_path
version_edit equ 1
@@ -16,7 +12,6 @@ include '../../develop/libraries/libs-dev/libimg/libimg.inc'
include '../../load_img.inc'
include '../../load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../develop/libraries/TinyGL/asm_fork/kosgl.inc'
include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc'
include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US.
include 'info_fun_float.inc'
@@ -26,34 +21,36 @@ include 'convert_stl_3ds.inc'
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
ID_ICON_CHUNK_MAIN equ 0 ;main block icon
ID_ICON_CHUNK_NOT_FOUND equ 1 ;unknown block icon
ID_ICON_DATA equ 2 ;icon for block data, undefined structure
ID_ICON_CHUNK_MAIN equ 0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
ID_ICON_CHUNK_NOT_FOUND equ 1 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2ADAE> <20><><EFBFBD><EFBFBD><EFBFBD>
ID_ICON_DATA equ 2 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ID_ICON_POINT equ 8
ID_ICON_POINT_SEL equ 9
FILE_ERROR_CHUNK_SIZE equ -3 ;block size error
FILE_ERROR_CHUNK_SIZE equ -3 ;<EFBFBD><EFBFBD><EFBFBD> <20><><E0A0A7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
include 'info_o3d.inc'
main_wnd_height equ 460 ;height of the main program window
main_wnd_height equ 460 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
align 4
fl255 dd 255.0
open_file_data dd 0 ;pointer to memory for opening 3ds files
open_file_size dd 0
open_file_data dd 0 ;<EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E4A0A9><EFBFBD> 3ds
open_file_size dd 0 ;ࠧ<><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E4A0A9>
image_data_toolbar dd 0
icon_tl_sys dd 0 ;pointer to memory for storing system icons
icon_toolbar dd 0 ;pointer to memory for storing object icons
level_stack dd 0
offs_last_timer dd 0 ;last shift shown in timer function
icon_tl_sys dd 0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><EFBFBD><E0A0AD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E2A5AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
icon_toolbar dd 0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><EFBFBD><E0A0AD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ꥪ⮢
fn_toolbar db 'toolbar.png',0
align 4
file_3ds: ;variables used when opening a file
.offs: dd 0 ;+0 pointer to the beginning of the block
.size: dd 0 ;+4 block size (for 1st parameter = 3ds file size)
level_stack dd 0
offs_last_timer dd 0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A4A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>㭪樨 ⠩<><E2A0A9><EFBFBD><EFBFBD>
align 4
file_3ds: ;<3B><><EFBFBD><E0A5AC><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><E3A5AC> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>⨨ 䠩<><E4A0A9>
.offs: dd 0 ;+0 㪠<><E3AAA0><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
.size: dd 0 ;+4 ࠧ<><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD> 1-<2D><> <20><><EFBFBD><E0A0AC><EFBFBD><EFBFBD> = ࠧ<><E0A0A7><EFBFBD><><E4A0A9> 3ds)
rb 8*MAX_FILE_LEVEL
size_one_list equ 42
@@ -83,7 +80,7 @@ start:
stosd
load_libraries l_libs_start,l_libs_end
;checking how successfully the libraries were loaded
;<EFBFBD><EFBFBD><20><><>쪮 㤠筮 <20><><EFBFBD><EFBFBD><E3A7A8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov ebp,lib_0
.test_lib_open:
cmp dword [ebp+ll_struc_size-4],0
@@ -96,7 +93,7 @@ start:
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
mcall SF_SET_EVENTS_MASK,0xC0000027
stdcall [OpenDialog_Init],OpenDialog_data ;preparation of dialogue
stdcall [OpenDialog_Init],OpenDialog_data ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
;kmenu initialisation
stdcall [kmenu_init],sc
@@ -145,68 +142,70 @@ start:
stdcall [tl_data_init], tree1
;<3B><><EFBFBD><EFBFBD><E2A5AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 16*16 <20><><EFBFBD> tree_list
include_image_file 'tl_sys_16.png', icon_tl_sys
mov eax,[icon_tl_sys]
mov [tree1.data_img_sys],eax
;<3B><20><><EFBFBD><EFBFBD><EFBFBD><E0A0A6><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EBABAE>, <20><> <20> icon_tl_sys <20><><EFBFBD><EFBFBD><EFBFBD>
;<3B><> <20><><EFBFBD><EFBFBD><E6A8A0><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><EFBFBD><E8A8A1> <20><> <20><EFBFBD>, <20>. <20>. <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E3A6AD><EFBFBD><><E0A0A7><EFBFBD><EFBFBD>
mov eax,dword[icon_tl_sys]
mov dword[tree1.data_img_sys],eax
include_image_file 'objects.png', icon_toolbar
mov eax,[icon_toolbar]
mov [tree1.data_img],eax
load_image_file 'objects.png', icon_toolbar
mov eax,dword[icon_toolbar]
mov dword[tree1.data_img],eax
stdcall [buf2d_create], buf_0 ;ᮧ<><E1AEA7><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
include_image_file '../../fs/kfar/trunk/font8x9.bmp', image_data_toolbar
load_image_file 'font8x9.bmp', image_data_toolbar
stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;ᮧ<><E1AEA7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
stdcall mem.Free,[image_data_toolbar] ;<3B><EFBFBD><E1A2AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
stdcall [buf2d_conv_24_to_8], buf_1,1 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0AEA7><EFBFBD><E7ADAE><EFBFBD> 8 <20><><EFBFBD>
stdcall [buf2d_convert_text_matrix], buf_1
include_image_file 'toolbar.png', image_data_toolbar
load_image_file fn_toolbar, image_data_toolbar
;ࠡ<><E0A0A1><EFBFBD> <20><><E4A0A9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
copy_path ini_name,sys_path,file_name,0
mov dword[def_dr_mode],0
stdcall [ini_get_int],file_name,ini_sec_w3d,key_dv,1
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dv,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_vertexes
@@:
stdcall [ini_get_int],file_name,ini_sec_w3d,key_df,1
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_df,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_faces
@@:
stdcall [ini_get_int],file_name,ini_sec_w3d,key_dff,1
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dff,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_faces_fill
@@:
stdcall [ini_get_int],file_name,ini_sec_w3d,key_dl,1
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_dl,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_light
@@:
stdcall [ini_get_int],file_name,ini_sec_w3d,key_ds,1
stdcall dword[ini_get_int],file_name,ini_sec_w3d,key_ds,1
or eax,eax
jz @f
or dword[def_dr_mode], 1 shl bit_smooth
@@:
stdcall [ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_ox,0x0000ff
mov [color_ox],eax
stdcall [ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oy,0xff0000
mov [color_oy],eax
stdcall [ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_oz,0x00ff00
mov [color_oz],eax
stdcall [ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_bk,0x000000
mov [color_bk],eax
shr eax,8
mov [color_bk+4],eax
shr eax,8
mov [color_bk+8],eax
stdcall [ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_vert,0xffffff
mov [color_vert],eax
stdcall [ini_get_color],file_name,ini_sec_w3d,key_face,0x808080
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_face,0x808080
mov [color_face],eax
stdcall [ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00
stdcall dword[ini_get_color],file_name,ini_sec_w3d,key_select,0xffff00
mov [color_select],eax
finit
fild dword[color_bk+8]
@@ -236,7 +235,7 @@ start:
call [gluNewQuadric]
mov [qObj],eax
mov eax,[ctx1.gl_context]
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax
@@ -262,19 +261,19 @@ still:
or eax,eax
jz timer_funct
cmp al,EV_REDRAW
cmp al,1
jne @f
call draw_window
jmp still
@@:
cmp al,EV_KEY
cmp al,2
jz key
cmp al,EV_BUTTON
cmp al,3
jz button
cmp al,EV_MOUSE
cmp al,6
jne @f
mcall SF_THREAD_INFO,procinfo,-1
cmp ax,word[procinfo.window_stack_position]
cmp ax,word[procinfo+4]
jne @f ;<3B><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><E2A8A2>
call mouse
@@:
@@ -282,7 +281,7 @@ still:
align 4
mouse:
stdcall [tl_mouse], tree1
stdcall [tl_mouse], dword tree1
ret
align 4
@@ -385,7 +384,7 @@ pushad
mcall , (20 shl 16)+560, (20 shl 16)+main_wnd_height
mcall SF_THREAD_INFO,procinfo,-1
mov eax,[procinfo.box.height]
mov eax,dword[procinfo.box.height]
cmp eax,250
jge @f
mov eax,250
@@ -399,7 +398,7 @@ pushad
mov dword[offs_last_timer],0 ;<3B><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><E2A0A9><EFBFBD><EFBFBD>
@@:
mov eax,[procinfo.box.width]
mov eax,dword[procinfo.box.width]
cmp eax,400
jge @f
mov eax,400
@@ -457,7 +456,7 @@ popad
align 4
key:
mcall SF_GET_KEY
stdcall [tl_key], tree1
stdcall [tl_key], dword tree1
jmp still
@@ -1083,10 +1082,57 @@ 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_tinygl
lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl
lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini
l_libs_end:
align 4
import_libimg:
dd alib_init1
img_is_img dd aimg_is_img
img_info dd aimg_info
img_from_file dd aimg_from_file
img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
img_encode dd aimg_encode
img_create dd aimg_create
img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count
img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw
dd 0,0
alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;<3B><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A4A5><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0A0A6><EFBFBD><EFBFBD>
aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;<3B><EFBFBD><EFBFBD><E0A0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0A0A6><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;<3B><><EFBFBD><E2AEAC><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
aimg_encode db 'img_encode',0
aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0
align 4
import_proclib:
OpenDialog_Init dd aOpenDialog_Init
@@ -1099,9 +1145,122 @@ dd 0,0
aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0
aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0
include '../../develop/libraries/libs-dev/libimg/import.inc'
include '../../develop/libraries/box_lib/import.inc'
include '../../develop/libraries/buf2d/import.inc'
align 4
import_buf2d:
dd sz_init0
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
buf2d_resize dd sz_buf2d_resize
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0
sz_init0 db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_resize db 'buf2d_resize',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
align 4
import_box_lib:
dd sz_init1
edit_box_draw dd sz_edit_box_draw
edit_box_key dd sz_edit_box_key
edit_box_mouse dd sz_edit_box_mouse
edit_box_set_text dd sz_edit_box_set_text
scrollbar_ver_draw dd sz_scrollbar_ver_draw
scrollbar_hor_draw dd sz_scrollbar_hor_draw
tl_data_init dd sz_tl_data_init
tl_data_clear dd sz_tl_data_clear
tl_info_clear dd sz_tl_info_clear
tl_key dd sz_tl_key
tl_mouse dd sz_tl_mouse
tl_draw dd sz_tl_draw
tl_info_undo dd sz_tl_info_undo
tl_info_redo dd sz_tl_info_redo
tl_node_add dd sz_tl_node_add
tl_node_set_data dd sz_tl_node_set_data
tl_node_get_data dd sz_tl_node_get_data
tl_node_delete dd sz_tl_node_delete
tl_node_move_up dd sz_tl_node_move_up
tl_node_move_down dd sz_tl_node_move_down
tl_cur_beg dd sz_tl_cur_beg
tl_cur_next dd sz_tl_cur_next
tl_cur_perv dd sz_tl_cur_perv
tl_node_close_open dd sz_tl_node_close_open
tl_node_lev_inc dd sz_tl_node_lev_inc
tl_node_lev_dec dd sz_tl_node_lev_dec
tl_node_poi_get_info dd sz_tl_node_poi_get_info
tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info
tl_node_poi_get_data dd sz_tl_node_poi_get_data
dd 0,0
sz_init1 db 'lib_init',0
sz_edit_box_draw db 'edit_box_draw',0
sz_edit_box_key db 'edit_box_key',0
sz_edit_box_mouse db 'edit_box_mouse',0
sz_edit_box_set_text db 'edit_box_set_text',0
sz_scrollbar_ver_draw db 'scrollbar_v_draw',0
sz_scrollbar_hor_draw db 'scrollbar_h_draw',0
sz_tl_data_init db 'tl_data_init',0
sz_tl_data_clear db 'tl_data_clear',0
sz_tl_info_clear db 'tl_info_clear',0
sz_tl_key db 'tl_key',0
sz_tl_mouse db 'tl_mouse',0
sz_tl_draw db 'tl_draw',0
sz_tl_info_undo db 'tl_info_undo',0
sz_tl_info_redo db 'tl_info_redo',0
sz_tl_node_add db 'tl_node_add',0
sz_tl_node_set_data db 'tl_node_set_data',0
sz_tl_node_get_data db 'tl_node_get_data',0
sz_tl_node_delete db 'tl_node_delete',0
sz_tl_node_move_up db 'tl_node_move_up',0
sz_tl_node_move_down db 'tl_node_move_down',0
sz_tl_cur_beg db 'tl_cur_beg',0
sz_tl_cur_next db 'tl_cur_next',0
sz_tl_cur_perv db 'tl_cur_perv',0
sz_tl_node_close_open db 'tl_node_close_open',0
sz_tl_node_lev_inc db 'tl_node_lev_inc',0
sz_tl_node_lev_dec db 'tl_node_lev_dec',0
sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0
sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0
sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0
align 4
import_libkmenu:
@@ -1127,7 +1286,19 @@ dd 0,0
akmenuitem_delete db 'kmenuitem_delete',0
akmenuitem_draw db 'kmenuitem_draw',0
include '../../develop/libraries/TinyGL/asm_fork/import.inc'
align 4
import_lib_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'
align 4
import_libini:
@@ -1172,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,0x10400040, 5,35,195-16,250, 16,list_offs_text,0,\
16,16, 0xffffff,0xb0d0ff,0x400040, 5,35,195-16,250, 16,list_offs_text,0,\
el_focus,w_scr_t1,0
align 4
@@ -1191,14 +1362,14 @@ 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> 14.07.25',0
capt db 'info 3ds <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 29.09.20',0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
else ; Default to en_US
capt db 'info 3ds version 14.07.25',0 ;window caption
capt db 'info 3ds version 29.09.20',0 ;window caption
end if
align 16
i_end:
ctx1 TinyGLContext
ctx1 rb 28 ;sizeof.TinyGLContext = 28
procinfo process_information
run_file_70 FileInfoBlock
sc system_colors

View File

@@ -1,7 +1,3 @@
; SPDX-License-Identifier: GPL-2.0-only
; Info3ds_u - is a program for viewing the structure of *.3ds files
; Copyright (C) 2015-2025 KolibriOS team
use32
org 0
db 'MENUET01' ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><E1AFAE><EFBFBD><EFA5AC><EFBFBD><><E4A0A9> <20><EFBFBD><E1A5A3> 8 <20><><EFBFBD><EFBFBD>
@@ -16,7 +12,6 @@ include '../../develop/libraries/libs-dev/libimg/libimg.inc'
include '../../load_img.inc'
include '../../load_lib.mac'
include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../develop/libraries/TinyGL/asm_fork/kosgl.inc'
include '../../develop/libraries/TinyGL/asm_fork/opengl_const.inc'
include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US.
include 'info_fun_float.inc'
@@ -26,8 +21,8 @@ include 'convert_stl_3ds.inc'
3d_wnd_l equ 205 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> tinygl <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1ABA5>
3d_wnd_t equ 47 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> tinygl <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A2A5><EFBFBD>
3d_wnd_w equ 345
3d_wnd_h equ 384
3d_wnd_w equ 344
3d_wnd_h equ 312
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
@@ -48,13 +43,13 @@ list_offs_text equ 14+sizeof.obj_3d ;ᤢ
include 'info_o3d.inc'
align 4
fl180 dd 180.0
fl255 dd 255.0
open_file_data dd 0 ;㪠<><E3AAA0><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E4A0A9><EFBFBD> 3ds
open_file_size dd 0 ;ࠧ<><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E4A0A9>
;
main_wnd_height equ 460 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>
fn_toolbar db 'toolbar.png',0
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
image_data_toolbar dd 0
;
@@ -145,17 +140,17 @@ start:
mov eax,dword[icon_tl_sys]
mov dword[tree1.data_img_sys],eax
include_image_file 'objects.png', icon_toolbar
load_image_file 'objects.png', icon_toolbar
mov eax,dword[icon_toolbar]
mov dword[tree1.data_img],eax
include_image_file '../../fs/kfar/trunk/font8x9.bmp', image_data_toolbar
load_image_file 'font8x9.bmp', image_data_toolbar
stdcall [buf2d_create_f_img], buf_1,[image_data_toolbar] ;ᮧ<><E1AEA7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
stdcall mem.Free,[image_data_toolbar] ;<3B><EFBFBD><E1A2AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
stdcall [buf2d_conv_24_to_8], buf_1,1 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0AEA7><EFBFBD><E7ADAE><EFBFBD> 8 <20><><EFBFBD>
stdcall [buf2d_convert_text_matrix], buf_1
include_image_file 'toolbar.png', image_data_toolbar
load_image_file fn_toolbar, image_data_toolbar
;ࠡ<><E0A0A1><EFBFBD> <20><><E4A0A9><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
copy_path ini_name,sys_path,file_name,0
@@ -228,7 +223,7 @@ start:
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
mov [last_time],eax
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,[buf_ogl.w],[buf_ogl.h],ctx1
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,3d_wnd_w,3d_wnd_h,ctx1
stdcall [glEnable], GL_DEPTH_TEST
stdcall [glEnable], GL_NORMALIZE ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0ACA0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>䠪⮢
stdcall [glClearColor], [color_bk+8],[color_bk+4],[color_bk],0.0
@@ -236,7 +231,7 @@ start:
call [gluNewQuadric]
mov [qObj],eax
mov eax,[ctx1.gl_context]
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax
@@ -262,20 +257,20 @@ still:
or eax,eax
jz timer_funct
cmp al,EV_REDRAW
cmp al,1
jne @f
call draw_window
jmp still
@@:
cmp al,EV_KEY
cmp al,2
jz key
cmp al,EV_BUTTON
cmp al,3
jz button
cmp al,EV_MOUSE
cmp al,6
jne @f
mcall SF_THREAD_INFO,procinfo,-1
cmp ax,word[procinfo.window_stack_position]
jne @f ;window is not active
cmp ax,word[procinfo+4]
jne @f ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><E2A8A2>
call mouse
@@:
jmp still
@@ -306,9 +301,9 @@ mouse:
mov ebx,3d_wnd_l
@@:
sub ebx,3d_wnd_l
cmp ebx,[buf_ogl.w]
cmp ebx,3d_wnd_w
jle @f
mov ebx,[buf_ogl.w]
mov ebx,3d_wnd_w
@@:
movsx eax,ax ;mouse.y
cmp eax,3d_wnd_t
@@ -316,9 +311,9 @@ mouse:
mov eax,3d_wnd_t
@@:
sub eax,3d_wnd_t
cmp eax,[buf_ogl.h]
cmp eax,3d_wnd_h
jle @f
mov eax,[buf_ogl.h]
mov eax,3d_wnd_h
@@:
finit
fild dword[mouse_y]
@@ -356,13 +351,13 @@ mouse:
cmp ebx,3d_wnd_l
jl .end_d
sub ebx,3d_wnd_l
cmp ebx,[buf_ogl.w]
cmp ebx,3d_wnd_w
jg .end_d
movsx eax,ax ;mouse.y
cmp eax,3d_wnd_t
jl .end_d
sub eax,3d_wnd_t
cmp eax,[buf_ogl.h]
cmp eax,3d_wnd_h
jg .end_d
mov dword[mouse_drag],1
mov dword[mouse_x],ebx
@@ -445,7 +440,16 @@ pushad
or edx,0x33000000
mcall SF_CREATE_WINDOW, (20 shl 16)+560, (20 shl 16)+main_wnd_height,,, capt
call OnResize
mcall SF_THREAD_INFO,procinfo,-1
mov eax,dword[procinfo.box.height]
cmp eax,250
jge @f
mov eax,250
@@:
sub eax,30
sub eax,[tree1.box_top]
mov [tree1.box_height],eax
mov word[w_scr_t1.y_size],ax ;<3B><><EFBFBD><EFBFBD><EFBFBD><><E0A0A7><EFBFBD><EFBFBD> <20><><EFBFBD><E0AEAB><EFBFBD><EFBFBD><EFBFBD>
stdcall [kmainmenu_draw], [main_menu]
@@ -489,62 +493,6 @@ pushad
popad
ret
align 4
OnResize:
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
push eax
mcall SF_THREAD_INFO,procinfo,-1
mov eax,[procinfo.box.height]
cmp eax,250
jge @f
mov eax,250
@@:
sub eax,[esp]
sub eax,5
sub eax,[tree1.box_top]
mov [tree1.box_height],eax
mov word[w_scr_t1.y_size],ax ;new scroll sizes
cmp [buf_ogl.h],eax
je @f
mov [buf_ogl.h],eax
mov dword[buf_ogl.w],0 ;reset width
@@:
pop eax
movzx eax,word[w_scr_t1.x_size]
add eax,[tree1.box_left]
add eax,[tree1.box_width]
add eax,15 ;5 px * 3 borders
sub eax,[procinfo.box.width]
neg eax
cmp eax,64
jge @f
mov eax,64
@@:
cmp [buf_ogl.w],eax
je .end
mov [buf_ogl.w],eax
fild dword[buf_ogl.w]
fld st0
fdiv dword[fl180]
fstp dword[angle_dxm]
fidiv dword[buf_ogl.h]
fstp dword[ratio]
stdcall [glViewport], 0,0, [buf_ogl.w], [buf_ogl.h]
mov eax,[ctx1.gl_context]
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax
stdcall [tl_node_get_data],tree1
or eax,eax
jz .end
add eax,list_offs_obj3d
stdcall draw_3d, eax
.end:
ret
align 4
key:
mcall SF_GET_KEY
@@ -1204,10 +1152,57 @@ 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_tinygl
lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl
lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini
l_libs_end:
align 4
import_libimg:
dd alib_init1
img_is_img dd aimg_is_img
img_info dd aimg_info
img_from_file dd aimg_from_file
img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
img_encode dd aimg_encode
img_create dd aimg_create
img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count
img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw
dd 0,0
alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;<3B><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A4A5><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0A0A6><EFBFBD><EFBFBD>
aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;<3B><EFBFBD><EFBFBD><E0A0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0A0A6><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ;<3B><><EFBFBD><E2AEAC><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><E0A5A4><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
aimg_encode db 'img_encode',0
aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0
align 4
import_proclib:
OpenDialog_Init dd aOpenDialog_Init
@@ -1220,9 +1215,122 @@ dd 0,0
aOpenDialog_Set_file_name db 'OpenDialog_set_file_name',0
aOpenDialog_Set_file_ext db 'OpenDialog_set_file_ext',0
include '../../develop/libraries/libs-dev/libimg/import.inc'
include '../../develop/libraries/box_lib/import.inc'
include '../../develop/libraries/buf2d/import.inc'
align 4
import_buf2d:
dd sz_init0
buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete
buf2d_resize dd sz_buf2d_resize
buf2d_line dd sz_buf2d_line
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0
sz_init0 db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_resize db 'buf2d_resize',0
sz_buf2d_line db 'buf2d_line',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0
align 4
import_box_lib:
dd sz_init1
edit_box_draw dd sz_edit_box_draw
edit_box_key dd sz_edit_box_key
edit_box_mouse dd sz_edit_box_mouse
edit_box_set_text dd sz_edit_box_set_text
scrollbar_ver_draw dd sz_scrollbar_ver_draw
scrollbar_hor_draw dd sz_scrollbar_hor_draw
tl_data_init dd sz_tl_data_init
tl_data_clear dd sz_tl_data_clear
tl_info_clear dd sz_tl_info_clear
tl_key dd sz_tl_key
tl_mouse dd sz_tl_mouse
tl_draw dd sz_tl_draw
tl_info_undo dd sz_tl_info_undo
tl_info_redo dd sz_tl_info_redo
tl_node_add dd sz_tl_node_add
tl_node_set_data dd sz_tl_node_set_data
tl_node_get_data dd sz_tl_node_get_data
tl_node_delete dd sz_tl_node_delete
tl_node_move_up dd sz_tl_node_move_up
tl_node_move_down dd sz_tl_node_move_down
tl_cur_beg dd sz_tl_cur_beg
tl_cur_next dd sz_tl_cur_next
tl_cur_perv dd sz_tl_cur_perv
tl_node_close_open dd sz_tl_node_close_open
tl_node_lev_inc dd sz_tl_node_lev_inc
tl_node_lev_dec dd sz_tl_node_lev_dec
tl_node_poi_get_info dd sz_tl_node_poi_get_info
tl_node_poi_get_next_info dd sz_tl_node_poi_get_next_info
tl_node_poi_get_data dd sz_tl_node_poi_get_data
dd 0,0
sz_init1 db 'lib_init',0
sz_edit_box_draw db 'edit_box_draw',0
sz_edit_box_key db 'edit_box_key',0
sz_edit_box_mouse db 'edit_box_mouse',0
sz_edit_box_set_text db 'edit_box_set_text',0
sz_scrollbar_ver_draw db 'scrollbar_v_draw',0
sz_scrollbar_hor_draw db 'scrollbar_h_draw',0
sz_tl_data_init db 'tl_data_init',0
sz_tl_data_clear db 'tl_data_clear',0
sz_tl_info_clear db 'tl_info_clear',0
sz_tl_key db 'tl_key',0
sz_tl_mouse db 'tl_mouse',0
sz_tl_draw db 'tl_draw',0
sz_tl_info_undo db 'tl_info_undo',0
sz_tl_info_redo db 'tl_info_redo',0
sz_tl_node_add db 'tl_node_add',0
sz_tl_node_set_data db 'tl_node_set_data',0
sz_tl_node_get_data db 'tl_node_get_data',0
sz_tl_node_delete db 'tl_node_delete',0
sz_tl_node_move_up db 'tl_node_move_up',0
sz_tl_node_move_down db 'tl_node_move_down',0
sz_tl_cur_beg db 'tl_cur_beg',0
sz_tl_cur_next db 'tl_cur_next',0
sz_tl_cur_perv db 'tl_cur_perv',0
sz_tl_node_close_open db 'tl_node_close_open',0
sz_tl_node_lev_inc db 'tl_node_lev_inc',0
sz_tl_node_lev_dec db 'tl_node_lev_dec',0
sz_tl_node_poi_get_info db 'tl_node_poi_get_info',0
sz_tl_node_poi_get_next_info db 'tl_node_poi_get_next_info',0
sz_tl_node_poi_get_data db 'tl_node_poi_get_data',0
align 4
import_libkmenu:
@@ -1248,7 +1356,19 @@ dd 0,0
akmenuitem_delete db 'kmenuitem_delete',0
akmenuitem_draw db 'kmenuitem_draw',0
include '../../develop/libraries/TinyGL/asm_fork/import.inc'
align 4
import_lib_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'
align 4
import_libini:
@@ -1288,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,0x10400040, 5,47,195-16,250, 16,list_offs_text,0, el_focus,\
16,16, 0xffffff,0xb0d0ff,0x400040, 5,47,195-16,250, 16,list_offs_text,0, el_focus,\
w_scr_t1,0
align 4
@@ -1307,14 +1427,14 @@ 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> 14.07.25',0 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
capt db 'info 3ds [user] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 29.09.20',0 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
else ; Default to en_US
capt db 'info 3ds [user] version 14.07.25',0 ; Window caption
capt db 'info 3ds [user] version 29.09.20',0 ; Window caption
end if
align 16
i_end:
ctx1 TinyGLContext
ctx1 rb 28 ;sizeof.TinyGLContext = 28
procinfo process_information
run_file_70 FileInfoBlock
sc system_colors

View File

@@ -306,7 +306,7 @@ align 4
faddp
fild dword[rad_c]
fdivp ;radius=(size.x+size.y)/rad_c
fstp qword[sph_radius]
fstp dword[sph_radius]
;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> x <EFBFBD> y, <EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
fld dword[edi+obj_3d.y_scale]
@@ -812,8 +812,9 @@ 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,1.4 ;correct for z
stdcall [glScalef], 1.0,1.0,0.7 ;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
@@ -975,10 +976,7 @@ if version_edit eq 1
stdcall [glColor3ub],[color_select+2],[color_select+1],[color_select]
call [glPushMatrix]
stdcall [glTranslatef], [eax],[eax+4],[eax+8]
push 8
push 8
glpush sph_radius
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], [sph_radius], 8,8
call [glPopMatrix]
@@:
@@ -999,10 +997,7 @@ align 4
mov eax,[eax]
call [glPushMatrix]
stdcall [glTranslatef], [eax],[eax+4],[eax+8]
push 4
push 4
glpush sph_radius
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], [sph_radius], 4,4
call [glPopMatrix]
dec ecx
jz .end_select
@@ -1350,5 +1345,5 @@ delt_size dd 3.0 ;
mouse_drag dd 0 ;<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mouse_x dd 0
mouse_y dd 0
sph_radius dq 0 ;radius of the sphere for selecting the active point
sph_radius dd 0 ;<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>

View File

@@ -1,19 +1,18 @@
;
; This file contains functions needed to create
; and operate a window with vertex coordinates
; <EFBFBD> <EFBFBD> <EFBFBD><EFBFBD> ᮡ࠭<EFBFBD> <EFBFBD>㭪樨 <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>
; <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>
;
3d_wnd_l equ 5 ;tinygl buffer left indent
3d_wnd_t equ 23 ;tinygl buffer top indent
3d_wnd_w equ 396
prop_wnd_width equ 340 ;<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
prop_wnd_height equ 460 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
3d_wnd_l equ 5 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> tinygl <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
3d_wnd_t equ 23 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> tinygl <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>
3d_wnd_w equ 320
3d_wnd_h equ 240
SIZE_ONE_FLOAT equ 14
MAX_OBJECT_SIZE equ (4+SIZE_ONE_FLOAT*3+1)
align 4
fl180 dd 180.0
prop_wnd_run db 0 ;variable that ensures that no more than 1 window with properties is launched at the same time
prop_wnd_run db 0 ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>-<EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1-<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
txt_q db '?',0
txt_space:
@@ -174,23 +173,20 @@ prop_still:
jmp .end
@@:
cmp al,EV_REDRAW
cmp al,1 ;<EFBFBD><EFBFBD><EFBFBD>. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
jne @f
call prop_red_win
jmp .end
@@:
cmp al,EV_KEY
cmp al,2
jne @f
call prop_key
jmp .end
@@:
cmp al,EV_BUTTON
cmp al,3
jz prop_button
cmp al,EV_MOUSE
cmp al,6
jne @f
mcall SF_THREAD_INFO,procinfo,-1
cmp ax,word[procinfo.window_stack_position]
jne @f ;window is not active
call prop_mouse
@@:
.end:
@@ -202,65 +198,20 @@ prop_red_win:
pushad
mcall SF_REDRAW,SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
push eax
mcall SF_THREAD_INFO,procinfo,-1
cmp dword[procinfo.box.height],0
je .resize_end
mov eax,[procinfo.box.height]
sub eax,[esp]
sub eax,[tree3.box_top]
sub eax,5
cmp eax,48
jge @f
mov eax,48 ;min size
@@:
mov dword[tree3.box_height],eax
mov word[w_scr_t3.y_size],ax
mov ebx,[procinfo.box.width]
sub ebx,37
cmp ebx,240
jge @f
mov ebx,240
@@:
mov [tree3.box_width],ebx
add ebx,[tree3.box_left]
mov word[w_scr_t3.x_pos],bx
;todo: resize scroll slider
mov eax,[tree3.box_width]
add eax,16
cmp [buf_ogl.w],eax
je .resize_end
mov [buf_ogl.w],eax
fild dword[buf_ogl.w]
fld st0
fdiv dword[fl180]
fstp dword[angle_dxm]
fidiv dword[buf_ogl.h]
fstp dword[ratio]
stdcall [glViewport], 0,0, [buf_ogl.w], 3d_wnd_h
stdcall obj_set_sizes, o3d
.resize_end:
xor eax,eax
mov edi,dword[capt_p] ;children window caption
mov bx,word[procinfo.box.left]
add bx,word[buf_0.l]
add bx,5 ;side frame width
add bx,5 ;<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
shl ebx,16
mov bx,word[tree3.box_width]
add bx,37
mov bx,prop_wnd_width
mov cx,word[procinfo.box.top]
add cx,word[buf_0.t]
shl ecx,16
pop eax
add eax,[tree3.box_height]
add eax,[tree3.box_top]
add eax,5
mov cx,ax
mov cx,prop_wnd_height
mov edx,[sc.work]
or edx,0x33000000
mcall SF_CREATE_WINDOW
int 0x40
mov esi,[sc.work_button]
mcall SF_DEFINE_BUTTON, (5 shl 16)+20, (266 shl 16)+20, 0x40000003
@@ -275,7 +226,7 @@ pushad
int 0x40
mov dword[w_scr_t3.all_redraw],1
stdcall [scrollbar_v_draw], w_scr_t3
stdcall [scrollbar_ver_draw],dword w_scr_t3
stdcall [tl_draw], tree3
stdcall [edit_box_draw], edit1
stdcall [edit_box_draw], edit2
@@ -365,9 +316,9 @@ prop_mouse:
mov ebx,3d_wnd_l
@@:
sub ebx,3d_wnd_l
cmp ebx,[buf_ogl.w]
cmp ebx,3d_wnd_w
jle @f
mov ebx,[buf_ogl.w]
mov ebx,3d_wnd_w
@@:
and eax,0xffff ;mouse.y
cmp eax,3d_wnd_t
@@ -383,14 +334,14 @@ prop_mouse:
fild dword[mouse_y]
mov [mouse_y],eax
fisub dword[mouse_y]
fdiv dword[angle_dym] ;if the cursor moves along the y axis
fdiv dword[angle_dxm] ;<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> y (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> x
fadd dword[angle_x]
fstp dword[angle_x]
fild dword[mouse_x]
mov [mouse_x],ebx
fisub dword[mouse_x]
fdiv dword[angle_dxm] ;if the cursor moves along the x axis
fdiv dword[angle_dym] ;<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> x (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> y
fadd dword[angle_y]
fstp dword[angle_y]
@@ -412,7 +363,7 @@ prop_mouse:
cmp ebx,3d_wnd_l
jl .end_d
sub ebx,3d_wnd_l
cmp ebx,[buf_ogl.w]
cmp ebx,3d_wnd_w
jg .end_d
and eax,0xffff ;mouse.y
cmp eax,3d_wnd_t
@@ -860,7 +811,7 @@ capt_p dd 0
;<EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <EFBFBD><EFBFBD>ꥪ⠬<EFBFBD> <EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
tree3 tree_list MAX_OBJECT_SIZE,3, tl_key_no_edit+tl_list_box_mode,\
16,16, 0xffffff,0xb0d0ff,0x10400040, 5,290,380,140, 16, 4,0, el_focus,\
16,16, 0xffffff,0xb0d0ff,0x400040, 5,290,303,140, 16, 4,0, el_focus,\
w_scr_t3,get_point_coords
edit1 edit_box 80, 76, 269, 0xffd0d0, 0xff, 0x80ff, 0, 0x8000, 32, string1, mouse_dd, 0

View File

@@ -951,12 +951,13 @@ endl
endp
align 4
proc glClearDepth uses eax, depth:qword
proc glClearDepth uses eax, depth:dword
locals
p rd 2
endl
mov dword[p],OP_ClearDepth
fld qword[depth]
mov eax,[depth]
fld qword[eax]
fstp dword[p+4]
lea eax,[ebp-8] ;=sizeof(dd)*2

View File

@@ -23,7 +23,8 @@ endl
imul ecx,ebx
shl ecx,2
add ecx,[eax+GLContext.color_array] ;ecx = &context.color_array[i]
lea ebx,[ebp-20] ;=sizeof(dd)*5
mov ebx,ebp
sub ebx,20 ;=sizeof(dd)*5
mov edx,[ecx]
mov [ebx+4],edx
mov edx,[ecx+4]
@@ -47,7 +48,8 @@ endl
imul esi,ebx
shl esi,2
add esi,[eax+GLContext.normal_array] ;esi = &normal_array[ebx * (3 + c->normal_array_stride)]
lea edi,[eax+GLContext.current_normal]
mov edi,eax
add edi,GLContext.current_normal
mov ecx,3
rep movsd
mov dword[edi],0.0
@@ -90,7 +92,8 @@ endl
imul ecx,ebx
shl ecx,2
add ecx,[eax+GLContext.vertex_array] ;ecx = &context.vertex_array[i]
lea ebx,[ebp-20] ;=sizeof(dd)*5
mov ebx,ebp
sub ebx,20 ;=sizeof(dd)*5
mov edx,[ecx]
mov [ebx+4],edx
mov edx,[ecx+4]
@@ -127,7 +130,8 @@ endl
mov eax,[i]
mov dword[p+4],eax
lea eax,[ebp-8] ;=sizeof(dd)*2
mov eax,ebp
sub eax,8 ;=sizeof(dd)*2
stdcall gl_add_op,eax
ret
endp
@@ -135,9 +139,10 @@ endp
align 4
proc glopDrawArrays, context:dword, param:dword
locals
vi dd ?
idx dd ?
states dd ?
a_size dd ?
size dd ?
p rd 8 ;функция glopColor требует 8 параметров, другие функции требуют меньше, берем по максимуму что-бы не портить стек
endl
pushad
@@ -150,19 +155,132 @@ pushad
mov [idx],eax ;param[2].i
mov eax,[ebx+4]
mov [p+4],eax ;p[1].i = param[1].i
lea eax,[ebp-32] ;=sizeof(dd)*8
mov eax,ebp
sub eax,32 ;=sizeof(dd)*8
stdcall glopBegin, edx,eax
cmp ecx,1
jl @f
mov dword[vi],0
align 4
.cycle_0: ;for (int vi=0; vi<count; vi++)
call CopyArrayElementByIndex
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
@@:
inc dword[idx]
loop .cycle_0
@@:
inc dword[vi]
jmp .cycle_0
.cycle_0_end:
lea eax,[ebp-32] ;=sizeof(dd)*8
;mov eax,ebp
;sub eax,32 ;=sizeof(dd)*8
stdcall glopEnd, edx,eax
popad
ret
@@ -181,7 +299,8 @@ endl
mov eax,[count]
mov dword[p+12],eax
lea eax,[ebp-16] ;=sizeof(dd)*4
mov eax,ebp
sub eax,16 ;=sizeof(dd)*4
stdcall gl_add_op,eax
ret
endp
@@ -189,12 +308,12 @@ endp
align 4
proc glopDrawElements, context:dword, param:dword
locals
type dd ?
indices dd ? ;указатель на 16 или 32 битные индексы
ii dd ?
idx dd ?
states dd ?
a_size dd ?
type dd ?
size dd ?
indices dd ? ;указатель на 16 или 32 битные индексы
p rd 8
endl
pushad
@@ -209,7 +328,8 @@ pushad
mov [type],eax ;type = param[3].i
mov eax,[ebx+16]
mov [indices],eax ;*indices = param[4].p
lea eax,[ebp-32] ;=sizeof(dd)*8
mov eax,ebp
sub eax,32 ;=sizeof(dd)*8
stdcall glopBegin, edx,eax
mov dword[ii],0
@@ -231,133 +351,127 @@ align 4
.end_0:
mov [idx],esi
call CopyArrayElementByIndex
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
@@:
inc dword[ii]
jmp .cycle_0
.cycle_0_end:
lea eax,[ebp-32] ;=sizeof(dd)*8
mov eax,ebp
sub eax,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
@@ -374,7 +488,8 @@ endl
mov eax,[indices]
mov dword[p+16],eax
lea eax,[ebp-20] ;=sizeof(dd)*5
mov eax,ebp
sub eax,20 ;=sizeof(dd)*5
stdcall gl_add_op,eax
ret
endp
@@ -418,7 +533,8 @@ endl
;assert(0);
.end_f:
lea eax,[ebp-8] ;=sizeof(dd)*2
mov eax,ebp
sub eax,8 ;=sizeof(dd)*2
stdcall gl_add_op,eax
ret
endp
@@ -462,7 +578,8 @@ endl
;assert(0);
.end_f:
lea eax,[ebp-8] ;=sizeof(dd)*2
mov eax,ebp
sub eax,8 ;=sizeof(dd)*2
stdcall gl_add_op,eax
ret
endp
@@ -495,7 +612,8 @@ endl
mov eax,[pointer]
mov dword[p+12],eax
lea eax,[ebp-16] ;=sizeof(dd)*4
mov eax,ebp
sub eax,16 ;=sizeof(dd)*4
stdcall gl_add_op,eax
ret
endp
@@ -528,7 +646,8 @@ endl
mov eax,[pointer]
mov dword[p+12],eax
lea eax,[ebp-16] ;=sizeof(dd)*4
mov eax,ebp
sub eax,16 ;=sizeof(dd)*4
stdcall gl_add_op,eax
ret
endp
@@ -557,7 +676,8 @@ endl
mov eax,[pointer]
mov dword[p+8],eax
lea eax,[ebp-12] ;=sizeof(dd)*3
mov eax,ebp
sub eax,12 ;=sizeof(dd)*3
stdcall gl_add_op,eax
ret
endp
@@ -590,7 +710,8 @@ endl
mov eax,[pointer]
mov dword[p+12],eax
lea eax,[ebp-16] ;=sizeof(dd)*4
mov eax,ebp
sub eax,16 ;=sizeof(dd)*4
stdcall gl_add_op,eax
ret
endp

View File

@@ -21,7 +21,7 @@ proc gl_transform_to_viewport uses eax ebx ecx, context:dword,v:dword
fmul st0,st1
fmul dword[eax+GLContext.viewport+GLViewport.scale+offs_X]
fadd dword[eax+GLContext.viewport+GLViewport.trans+offs_X]
fistp dword[ebx+GLVertex.zp+ZBufferPoint.x] ;v.zp.x = st0, st0 = st1
fistp dword[ebx+GLVertex.zp] ;v.zp.x = st0, st0 = st1
fld dword[ebx+GLVertex.pc+offs_Y] ;st0 = v.pc.Y
fmul st0,st1
@@ -62,14 +62,14 @@ align 4
je @f
mov eax,[eax+GLContext.current_texture] ;eax = &context.current_texture
mov eax,[eax] ;eax = context.current_texture
;[eax+GLTexture.images] = im = &context.current_texture.images[0]
;[eax+offs_text_images] = im = &context.current_texture.images[0]
fild dword[eax+GLTexture.images+GLImage.s_bound]
fild dword[eax+offs_text_images+offs_imag_s_bound]
fmul dword[ebx+GLVertex.tex_coord+offs_X]
fistp dword[ebx+GLVertex.zp+ZBufferPoint.s]
;v.zp.s=(int)(v.tex_coord.X * im.s_bound)
fild dword[eax+GLTexture.images+GLImage.t_bound]
fild dword[eax+offs_text_images+offs_imag_t_bound]
fmul dword[ebx+GLVertex.tex_coord+offs_Y]
fistp dword[ebx+GLVertex.zp+ZBufferPoint.t]
;v.zp.t=(int)(v.tex_coord.Y * im.t_bound)
@@ -138,12 +138,12 @@ macro interpolate q, p0, p1, t
{
fld dword[t]
; interpolation by coordinates
fld dword[p1+GLVertex.pc+offs_X]
fsub dword[p0+GLVertex.pc+offs_X]
; интерполяция по координатам
fld dword[p1+GLVertex.pc]
fsub dword[p0+GLVertex.pc]
fmul st0,st1
fadd dword[p0+GLVertex.pc+offs_X]
fstp dword[q+GLVertex.pc+offs_X] ;q.pc.X = p0.pc.X + (p1.pc.X - p0.pc.X) * t
fadd dword[p0+GLVertex.pc]
fstp dword[q+GLVertex.pc] ;q.pc.X = p0.pc.X + (p1.pc.X - p0.pc.X) * t
fld dword[p1+GLVertex.pc+offs_Y]
fsub dword[p0+GLVertex.pc+offs_Y]
@@ -163,7 +163,7 @@ macro interpolate q, p0, p1, t
fadd dword[p0+GLVertex.pc+offs_W]
fstp dword[q+GLVertex.pc+offs_W]
; color interpolation
; интерполяция по цвету
fld dword[p1+GLVertex.color]
fsub dword[p0+GLVertex.color]
fmul st0,st1
@@ -228,7 +228,7 @@ align 4
fstsw ax
sahf
jae .r1_f1
fstp dword[ebx] ;if (t<*tmax) *tmax=t
fstp dword[ebx] ;if (t<*tmin) *tmax=t
jmp .r1
align 4
.els_1: ;else if (num>0)
@@ -1028,11 +1028,9 @@ if PROFILE eq 1
end if
mov eax,[edx+GLContext.current_texture]
mov eax,[eax] ;переход по указателю
stdcall ZB_setTexture, [edx+GLContext.zb],\
[eax+GLTexture.images+GLImage.pixmap],\
[eax+GLTexture.images+GLImage.s_bound],\
[eax+GLTexture.images+GLImage.t_bound],\
[eax+GLTexture.images+GLImage.xsize_log2]
;так как offs_text_images+offs_imag_pixmap = 0 то context.current_texture.images[0].pixmap = [eax]
stdcall ZB_setTexture, [edx+GLContext.zb], [eax],\
[eax+offs_imag_s_bound],[eax+offs_imag_t_bound],[eax+offs_imag_xsize_log2]
mov eax,[p0]
add eax,GLVertex.zp
push ecx

View File

@@ -1,7 +1,3 @@
; SPDX-License-Identifier: GPL-2.0-only
; Gears - 3D gear wheels
; Copyright (C) 2014-2025 KolibriOS team
use32
org 0
db 'MENUET01'
@@ -12,7 +8,6 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc'
include '../../../../../load_lib.mac'
include '../../../../../dll.inc'
include '../kosgl.inc'
include '../opengl_const.inc'
include 'fps.inc'
@@ -23,7 +18,7 @@ macro matr_cell c_funct,c_param,funct,param, dia
dia dword[esp-4*(c_param*(c_funct-funct)+(1+c_param-param))]
}
;Macro for double type parameters (8 bytes)
;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
@@ -88,7 +83,8 @@ red_win:
mov ebx,200
@@:
sub ebx,10
stdcall reshape, ebx,eax
stdcall reshape, ebx,eax
.end0:
align 16
still:
@@ -169,7 +165,8 @@ draw_window:
;Title
mcall SF_DRAW_TEXT,(338 shl 16)+4,0xc0c0c0,fps, fps.end-fps
mcall SF_DRAW_TEXT,(8 shl 16)+4,0xc0c0c0,title2,title2.end-title2
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
@@ -250,7 +247,9 @@ button:
align 4
title1: db 'TinyGL in KolibriOS'
.end: db 0
title2: db 'ESC - exit, Arrow keys - rotate, +/- zoom, P - pause'
;title2: db 'F full screen'
;.end: db 0
title3: db 'ESC - exit, Arrow keys - rotate, +/- zoom, P - pause'
.end: db 0
fps: db 'FPS:'
.end: db 0
@@ -923,7 +922,8 @@ name_tgl db 'tinygl.obj',0
align 16
i_end:
ctx1 TinyGLContext
ctx1 db 28 dup (0) ;TinyGLContext or KOSGLContext
;sizeof.TinyGLContext = 28
procinfo process_information
cur_dir_path rb 4096
library_path rb 4096

View File

@@ -12,15 +12,6 @@ include '../opengl_const.inc'
@use_library
;Constants describing the house.3ds file (obtained using the info_3ds program)
VERTICES_OFFSET = 0x33 ;offset along which the coordinates of the vertices go
FACES_COUNT = 0x162 ;number of faces
FACES_OFFSET = 0x96b ;offset along which information about the edges goes
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
@@ -29,20 +20,20 @@ start:
mcall SF_SET_EVENTS_MASK,0x27
;we fill the array of indices from the house.3ds file (which is embedded inside this program)
;заполняем массив индексов из файла house.3ds (который вшит внутрь данной программы)
mov esi,house_3ds
add esi,FACES_OFFSET
add esi,0x1798 ;смещение по которому идет информация о гранях в файле 3ds (получено с использованием программы info_3ds)
mov edi,Indices
mov eax,FACES_COUNT
mov eax,0x1a6 ;число граней в файле 3ds (получено с использованием программы info_3ds)
@@:
movsd
movsw
add esi,2 ;skip face properties
add esi,2 ;пропускаем свойства грани
dec eax
or eax,eax
jnz @b
;tinygl initial context settings
;первоначальные настройки контекста tinygl
stdcall [kosglMakeCurrent], 10,10,400,350,ctx1
stdcall [glEnable], GL_DEPTH_TEST
stdcall [glClearColor], 0.0,0.0,0.0,0.0
@@ -57,13 +48,13 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
align 4
draw_window:
@@ -149,34 +140,29 @@ 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 ;clear the color and depth buffer
mov eax,house_3ds.end-house_3ds
cmp eax,HOUSE_FILE_SIZE
je @f
notify_window_run txt_error_file_size
ret
@@:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
call [glPushMatrix]
;scale and rotations
;масштаб и повороты
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
stdcall [glRotatef], [angle_x],1.0,0.0,0.0
;drawing via index array
mov eax,house_3ds ;start of embedded 3ds file
add eax,VERTICES_OFFSET
stdcall [glVertexPointer], 3, GL_FLOAT, 0, eax ;we set an array for the vertices, 3 is the number of coordinates for one vertex
stdcall [glEnableClientState], GL_VERTEX_ARRAY ;turn on the vertex drawing mode
stdcall [glDrawElements], GL_TRIANGLES, FACES_COUNT*3, GL_UNSIGNED_SHORT, Indices ;mode, count, type, *indices
stdcall [glDisableClientState], GL_VERTEX_ARRAY ;disable vertex drawing mode
;рисование через индексный массив
mov eax,house_3ds ;начало внедренного файла 3ds
add eax,0xeb ;смещение по которому идут координаты вершин (получено с использованием программы info_3ds)
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 [glDisableClientState], GL_VERTEX_ARRAY ;отключаем режим рисования вершин
call [glPopMatrix]
ret
align 4
scale dd 0.07 ;initial scale (ideally should be calculated)
scale dd 0.0065 ;начальный масштаб (в идеальном случае должен вычислятся, но для даного примера подобран в ручную на глаз)
delt_sc dd 0.0005
angle_z dd 90.0
angle_y dd 90.0
@@ -184,11 +170,10 @@ angle_x dd 0.0
delt_size dd 3.0
align 4
house_3ds: ;we embed the file inside the program (ideally it should open through a dialog box)
house_3ds: ;внедряем файл внутрь программы (в идеальном случае должен открыватся через окно диалога, но для облегчения примера вшит внутрь)
file '../../../../../demos/view3ds/3ds_objects/House.3ds'
.end:
align 4
Indices rb FACES_COUNT*6 ;3 points per edge, point index 2 bytes
Indices rb 0x1a6*6 ;0x1a6 - число граней, на каждую грань по 3 точки, индекс точки 2 байта
;--------------------------------------------------
align 4

View File

@@ -1,7 +1,3 @@
; SPDX-License-Identifier: GPL-2.0-only
; Test glu0 - gluSphere functionality testing
; Copyright (C) 2014-2025 KolibriOS team
use32
org 0
db 'MENUET01'
@@ -12,7 +8,6 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc'
include '../../../../../load_lib.mac'
include '../../../../../dll.inc'
include '../kosgl.inc'
include '../opengl_const.inc'
@use_library
@@ -41,13 +36,13 @@ red_win:
align 16
still:
mcall SF_WAIT_EVENT
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
align 4
draw_window:
@@ -136,6 +131,9 @@ button:
mcall SF_TERMINATE_PROCESS
align 4
caption db 'Test gluSphere, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
@@ -143,37 +141,25 @@ 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
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
push 16
push 16
glpush rad1
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], 1.0, 16,16
stdcall [glColor3f], 1.0, 0.0, 0.0
stdcall [glTranslatef], -1.6,0.0,0.0
push 8
push 8
glpush rad2
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], 0.55, 8,8
stdcall [glColor3f], 0.0, 0.0, 1.0
stdcall [glTranslatef], 3.2,0.0,0.0
push 8
push 8
glpush rad2
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], 0.55, 8,8
call [glPopMatrix]
ret
align 4
caption db 'Test gluSphere, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
rad1 dq 1.0
rad2 dq 0.55
qObj dd 0
scale dd 0.4
delt_sc dd 0.05
@@ -187,17 +173,13 @@ import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../export.inc'
@@ -208,8 +190,7 @@ name_tgl db 'tinygl.obj',0
align 16
i_end:
ctx1 TinyGLContext
qObj dd 0
ctx1 rb 28 ;sizeof.TinyGLContext = 28
cur_dir_path rb 4096
library_path rb 4096
rb 2048

View File

@@ -1,7 +1,3 @@
; SPDX-License-Identifier: GPL-2.0-only
; Test glu1 - gluCylinder and gluDisk functionality testing
; Copyright (C) 2014-2025 KolibriOS team
use32
org 0
db 'MENUET01'
@@ -12,24 +8,24 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc'
include '../../../../../load_img.inc'
include '../../../../../load_lib.mac'
include '../kosgl.inc'
include '../opengl_const.inc'
include '../zbuffer.inc'
include '../../../../../develop/info3ds/info_fun_float.inc'
3d_wnd_l equ 0 ;tinygl buffer left indent
3d_wnd_t equ 30 ;tinygl buffer top indent
3d_wnd_w equ 500
3d_wnd_h equ 400
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
align 4
start:
load_libraries l_libs_start,l_libs_end
;checking how successfully the libraries were loaded
;проверка на сколько удачно загузились библиотеки
mov ebp,lib_0
.test_lib_open:
cmp dword [ebp+ll_struc_size-4],0
@@ -43,24 +39,16 @@ load_libraries l_libs_start,l_libs_end
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
mcall SF_SET_EVENTS_MASK,0x27
finit
fild dword[buf_ogl.w]
fdiv dword[fl_180]
fstp dword[angle_dzm]
fild dword[buf_ogl.h]
fdiv dword[fl_180]
fstp dword[angle_dym]
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,[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_NORMALIZE ;normals of the same size to avoid artifacts
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
call [gluNewQuadric]
mov [qObj],eax
stdcall [glClearColor], 0.25,0.25,0.25,0.0
stdcall [glShadeModel], GL_SMOOTH
mov eax,[ctx1.gl_context]
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax
@@ -72,15 +60,6 @@ load_libraries l_libs_start,l_libs_end
stdcall [buf2d_convert_text_matrix], buf_1
load_image_file 'toolb_1.png', image_data_toolbar
fld dword[scale]
stdcall update_number, txt_scale.v
fld dword[angle_y]
stdcall update_number, txt_angle_y.v
fld dword[angle_z]
stdcall update_number, txt_angle_z.v
call SetLight
call draw_3d
align 4
@@ -90,30 +69,19 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
cmp al,EV_MOUSE
jne still
call mouse
jmp still
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
align 4
draw_window:
pushad
mcall SF_REDRAW,SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
mov ebx,[buf_ogl.w]
add ebx,(50 shl 16)+9
mov ecx,[buf_ogl.h]
add ecx,(30 shl 16)+4
add ecx,eax
add cx,[buf_ogl.t]
mcall SF_CREATE_WINDOW,,,0x33ffffff,,caption
mcall SF_CREATE_WINDOW,(50 shl 16)+420,(30 shl 16)+410,0x33ffffff,,caption
mov esi,[sc.work_button]
mcall SF_DEFINE_BUTTON,(6 shl 16)+19,(6 shl 16)+19,3+0x40000000 ;вершины вкл.
@@ -160,7 +128,11 @@ key:
fld dword[angle_y]
fadd dword[delt_size]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
call [kosglSwapBuffers]
jmp still
@@ -171,7 +143,11 @@ key:
fld dword[angle_y]
fsub dword[delt_size]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
call [kosglSwapBuffers]
jmp still
@@ -182,7 +158,11 @@ key:
fld dword[angle_z]
fadd dword[delt_size]
fst dword[angle_z]
stdcall update_number, txt_angle_z.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d
call [kosglSwapBuffers]
jmp still
@@ -193,7 +173,11 @@ key:
fld dword[angle_z]
fsub dword[delt_size]
fst dword[angle_z]
stdcall update_number, txt_angle_z.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d
call [kosglSwapBuffers]
;jmp still
@@ -236,104 +220,6 @@ button:
stdcall mem.Free,[image_data_toolbar]
mcall SF_TERMINATE_PROCESS
align 4
mouse:
push eax ebx
mcall SF_MOUSE_GET,SSF_BUTTON_EXT
bt eax,0
jnc .end_m
;mouse l. but. move
cmp dword[mouse_drag],1
jne .end_m
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov ebx,eax
sar ebx,16 ;mouse.x
cmp ebx,3d_wnd_l
jg @f
mov ebx,3d_wnd_l
@@:
sub ebx,3d_wnd_l
cmp ebx,3d_wnd_w
jle @f
mov ebx,3d_wnd_w
@@:
movsx eax,ax ;mouse.y
cmp eax,3d_wnd_t
jg @f
mov eax,3d_wnd_t
@@:
sub eax,3d_wnd_t
cmp eax,3d_wnd_h
jle @f
mov eax,3d_wnd_h
@@:
finit
fild dword[mouse_y]
mov [mouse_y],eax
fisub dword[mouse_y]
fdiv dword[angle_dzm] ;if the cursor moves along the y-axis (up or down)
fadd dword[angle_z]
fst dword[angle_z]
stdcall update_number, txt_angle_z.v
fild dword[mouse_x]
mov [mouse_x],ebx
fisub dword[mouse_x]
fdiv dword[angle_dym] ;if the cursor moves along the z-axis (left or right)
fadd dword[angle_y]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
call draw_3d
call [kosglSwapBuffers]
jmp .end_d
.end_m:
bt eax,16
jnc @f
;mouse l. but. up
mov dword[mouse_drag],0
jmp .end_d
@@:
bt eax,8
jnc .end_d
;mouse l. but. press
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov ebx,eax
sar ebx,16 ;mouse.x
cmp ebx,3d_wnd_l
jl .end_d
sub ebx,3d_wnd_l
cmp ebx,3d_wnd_w
jg .end_d
movsx eax,ax ;mouse.y
cmp eax,3d_wnd_t
jl .end_d
sub eax,3d_wnd_t
cmp eax,3d_wnd_h
jg .end_d
mov dword[mouse_drag],1
mov dword[mouse_x],ebx
mov dword[mouse_y],eax
.end_d:
pop ebx eax
ret
;input:
; st0 - number
; txt_addr - pointer to text buffer
align 4
proc update_number uses eax, txt_addr:dword
mov word[NumberSymbolsAD],3
fstp qword[Data_Double]
call DoubleFloat_to_String
mov eax,[txt_addr]
mov byte[eax],0
stdcall str_cat, eax,Data_String
ret
endp
align 4
but_st_point:
stdcall [gluQuadricDrawStyle], [qObj],GLU_POINT
@@ -369,7 +255,11 @@ but_zoom_p:
fld dword[sc_max]
@@:
fst dword[scale]
stdcall update_number, txt_scale.v
mov word[NumberSymbolsAD],3
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String
call draw_3d
call [kosglSwapBuffers]
ret
@@ -388,54 +278,50 @@ but_zoom_m:
fld dword[sc_min]
@@:
fst dword[scale]
stdcall update_number, txt_scale.v
mov word[NumberSymbolsAD],3
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String
call draw_3d
call [kosglSwapBuffers]
ret
align 4
caption db 'Test gluCylinder, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
rad1 dq 1.0
rad2 dq 0.55
rad3 dq 0.15
hei1 dq 2.0 ;высота цилиндра
hei2 dq 1.25
align 4
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
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
stdcall [glTranslatef], 0.0,0.0,-1.0 ;опускаем цилинды вниз
push 8
push 32
glpush hei1
glpush rad1
glpush rad1
stdcall [gluCylinder], [qObj]
stdcall [glTranslatef], 0.0,0.0,2.0
push 4
push 32
glpush rad1
glpush rad3
stdcall [gluDisk], [qObj]
stdcall [gluCylinder], [qObj], rad1,rad1,hei1, 32,8
stdcall [glColor3f], 1.0, 0.0, 0.0
stdcall [glTranslatef], -1.6,0.0,-2.0
push 8
push 16
glpush hei2
glpush rad3
glpush rad2
stdcall [gluCylinder], [qObj]
stdcall [glTranslatef], -1.6,0.0,0.0
stdcall [gluCylinder], [qObj], rad2,rad3,hei2, 16,8
stdcall [glColor3f], 0.0, 0.0, 1.0
stdcall [glTranslatef], 3.2,0.0,0.0
push 8
push 16
glpush hei2
glpush rad3
glpush rad2
stdcall [gluCylinder], [qObj]
stdcall [gluCylinder], [qObj], rad2,rad3,hei2, 16,8
call [glPopMatrix]
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00
@@ -461,22 +347,10 @@ SetLight:
stdcall [glEnable],GL_LIGHT0
ret
align 4
caption db 'Test gluCylinder and gluDisk, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
rad1 dq 1.0
rad2 dq 0.55
rad3 dq 0.15
hei1 dq 2.0 ;высота цилиндра
hei2 dq 1.25
fl_180 dd 180.0
scale dd 0.4 ;initial scale
sc_delt dd 0.05 ;zoom on click
sc_min dd 0.1 ;minimum scale
sc_max dd 1.1 ;maximum scale
scale dd 0.4 ;начальный масштаб
sc_delt dd 0.05 ;изменение масштаба при нажатии
sc_min dd 0.1 ;минимальный масштаб
sc_max dd 1.1 ;максимальный масштаб
angle_z dd -45.0
angle_y dd -150.0
delt_size dd 3.0
@@ -495,17 +369,13 @@ import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../export.inc'
@@ -623,23 +493,28 @@ lib_name_2 db 'libimg.obj',0
txt_scale:
db 'Scale: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_z:
db 'Rotate z: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_y:
db 'Rotate y: '
.v: rb 11
.v:
db 0
rb 10
align 4
buf_ogl:
dd 0 ;указатель на буфер изображения
dw 3d_wnd_l ;+4 left
.t: dw 3d_wnd_t ;+6 top
.w: dd 3d_wnd_w
.h: dd 3d_wnd_h
dw 10,10 ;+4 left,top
.w: dd 400
.h: dd 350
dd 0,24 ;+16 color,bit in pixel
align 4
@@ -658,14 +533,9 @@ l_libs_end:
align 4
i_end:
ctx1 TinyGLContext
ctx1 rb 28 ;sizeof.TinyGLContext = 28
image_data_toolbar dd 0
qObj dd 0
mouse_drag dd 0 ;scene rotation mode based on mouse cursor movement
mouse_x dd 0
mouse_y dd 0
angle_dzm dd 0 ;~ 3d_wnd_w/180 - adding scene rotation angles when rotating the mouse
angle_dym dd 0 ;~ 3d_wnd_h/180
run_file_70 FileInfoBlock
sc system_colors
align 16

View File

@@ -1,7 +1,3 @@
; SPDX-License-Identifier: GPL-2.0-only
; Test glu2 - gluSphere functionality testing
; Copyright (C) 2015-2025 KolibriOS team
use32
org 0
db 'MENUET01'
@@ -12,24 +8,24 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc'
include '../../../../../load_img.inc'
include '../../../../../load_lib.mac'
include '../kosgl.inc'
include '../opengl_const.inc'
include '../zbuffer.inc'
include '../../../../../develop/info3ds/info_fun_float.inc'
3d_wnd_l equ 0 ;tinygl buffer left indent
3d_wnd_t equ 30 ;tinygl buffer top indent
3d_wnd_w equ 500
3d_wnd_h equ 400
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
align 4
start:
load_libraries l_libs_start,l_libs_end
;checking how successfully the libraries were loaded
;проверка на сколько удачно загузились библиотеки
mov ebp,lib_0
.test_lib_open:
cmp dword [ebp+ll_struc_size-4],0
@@ -43,24 +39,16 @@ load_libraries l_libs_start,l_libs_end
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
mcall SF_SET_EVENTS_MASK,0x27
finit
fild dword[buf_ogl.w]
fdiv dword[fl_180]
fstp dword[angle_dzm]
fild dword[buf_ogl.h]
fdiv dword[fl_180]
fstp dword[angle_dym]
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,[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_NORMALIZE ;normals of the same size to avoid artifacts
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
call [gluNewQuadric]
mov [qObj],eax
stdcall [glClearColor], 0.25,0.25,0.25,0.0
stdcall [glShadeModel], GL_SMOOTH
mov eax,[ctx1.gl_context]
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax
@@ -72,15 +60,6 @@ load_libraries l_libs_start,l_libs_end
stdcall [buf2d_convert_text_matrix], buf_1
load_image_file 'toolb_1.png', image_data_toolbar
fld dword[scale]
stdcall update_number, txt_scale.v
fld dword[angle_y]
stdcall update_number, txt_angle_y.v
fld dword[angle_z]
stdcall update_number, txt_angle_z.v
call SetLight
call draw_3d
align 4
@@ -90,30 +69,19 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
cmp al,EV_MOUSE
jne still
call mouse
jmp still
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
align 4
draw_window:
pushad
mcall SF_REDRAW,SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
mov ebx,[buf_ogl.w]
add ebx,(50 shl 16)+9
mov ecx,[buf_ogl.h]
add ecx,(30 shl 16)+4
add ecx,eax
add cx,[buf_ogl.t]
mcall SF_CREATE_WINDOW,,,0x33ffffff,,caption
mcall SF_CREATE_WINDOW,(50 shl 16)+420,(30 shl 16)+410,0x33ffffff,,caption
mov esi,[sc.work_button]
mcall SF_DEFINE_BUTTON,(6 shl 16)+19,(6 shl 16)+19,3+0x40000000 ;вершины вкл.
@@ -160,7 +128,11 @@ key:
fld dword[angle_y]
fadd dword[delt_size]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
call [kosglSwapBuffers]
jmp still
@@ -171,7 +143,11 @@ key:
fld dword[angle_y]
fsub dword[delt_size]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
call [kosglSwapBuffers]
jmp still
@@ -182,7 +158,11 @@ key:
fld dword[angle_z]
fadd dword[delt_size]
fst dword[angle_z]
stdcall update_number, txt_angle_z.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d
call [kosglSwapBuffers]
jmp still
@@ -193,7 +173,11 @@ key:
fld dword[angle_z]
fsub dword[delt_size]
fst dword[angle_z]
stdcall update_number, txt_angle_z.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d
call [kosglSwapBuffers]
;jmp still
@@ -236,104 +220,6 @@ button:
stdcall mem.Free,[image_data_toolbar]
mcall SF_TERMINATE_PROCESS
align 4
mouse:
push eax ebx
mcall SF_MOUSE_GET,SSF_BUTTON_EXT
bt eax,0
jnc .end_m
;mouse l. but. move
cmp dword[mouse_drag],1
jne .end_m
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov ebx,eax
sar ebx,16 ;mouse.x
cmp ebx,3d_wnd_l
jg @f
mov ebx,3d_wnd_l
@@:
sub ebx,3d_wnd_l
cmp ebx,3d_wnd_w
jle @f
mov ebx,3d_wnd_w
@@:
movsx eax,ax ;mouse.y
cmp eax,3d_wnd_t
jg @f
mov eax,3d_wnd_t
@@:
sub eax,3d_wnd_t
cmp eax,3d_wnd_h
jle @f
mov eax,3d_wnd_h
@@:
finit
fild dword[mouse_y]
mov [mouse_y],eax
fisub dword[mouse_y]
fdiv dword[angle_dzm] ;if the cursor moves along the y-axis (up or down)
fadd dword[angle_z]
fst dword[angle_z]
stdcall update_number, txt_angle_z.v
fild dword[mouse_x]
mov [mouse_x],ebx
fisub dword[mouse_x]
fdiv dword[angle_dym] ;if the cursor moves along the z-axis (left or right)
fadd dword[angle_y]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
call draw_3d
call [kosglSwapBuffers]
jmp .end_d
.end_m:
bt eax,16
jnc @f
;mouse l. but. up
mov dword[mouse_drag],0
jmp .end_d
@@:
bt eax,8
jnc .end_d
;mouse l. but. press
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
mov ebx,eax
sar ebx,16 ;mouse.x
cmp ebx,3d_wnd_l
jl .end_d
sub ebx,3d_wnd_l
cmp ebx,3d_wnd_w
jg .end_d
movsx eax,ax ;mouse.y
cmp eax,3d_wnd_t
jl .end_d
sub eax,3d_wnd_t
cmp eax,3d_wnd_h
jg .end_d
mov dword[mouse_drag],1
mov dword[mouse_x],ebx
mov dword[mouse_y],eax
.end_d:
pop ebx eax
ret
;input:
; st0 - number
; txt_addr - pointer to text buffer
align 4
proc update_number uses eax, txt_addr:dword
mov word[NumberSymbolsAD],3
fstp qword[Data_Double]
call DoubleFloat_to_String
mov eax,[txt_addr]
mov byte[eax],0
stdcall str_cat, eax,Data_String
ret
endp
align 4
but_st_point:
stdcall [gluQuadricDrawStyle], [qObj],GLU_POINT
@@ -369,7 +255,11 @@ but_zoom_p:
fld dword[sc_max]
@@:
fst dword[scale]
stdcall update_number, txt_scale.v
mov word[NumberSymbolsAD],3
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String
call draw_3d
call [kosglSwapBuffers]
ret
@@ -388,40 +278,41 @@ but_zoom_m:
fld dword[sc_min]
@@:
fst dword[scale]
stdcall update_number, txt_scale.v
mov word[NumberSymbolsAD],3
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_scale.v],0
stdcall str_cat, txt_scale.v,Data_String
call draw_3d
call [kosglSwapBuffers]
ret
align 4
caption db 'Test gluSphere, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
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
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
push 32
push 32
glpush rad1
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], 1.0, 32,32
stdcall [glColor3f], 1.0, 0.0, 0.0
stdcall [glTranslatef], -1.6,0.0,0.0
push 16
push 16
glpush rad2
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], 0.55, 16,16
stdcall [glColor3f], 0.0, 0.0, 1.0
stdcall [glTranslatef], 3.2,0.0,0.0
push 16
push 16
glpush rad2
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], 0.55, 16,16
call [glPopMatrix]
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00
@@ -447,19 +338,10 @@ SetLight:
stdcall [glEnable],GL_LIGHT0
ret
align 4
caption db 'Test gluSphere, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
rad1 dq 1.0
rad2 dq 0.55
fl_180 dd 180.0
scale dd 0.4 ;initial scale
sc_delt dd 0.05 ;zoom on click
sc_min dd 0.1 ;minimum scale
sc_max dd 1.1 ;maximum scale
scale dd 0.4 ;начальный масштаб
sc_delt dd 0.05 ;изменение масштаба при нажатии
sc_min dd 0.1 ;минимальный масштаб
sc_max dd 1.1 ;максимальный масштаб
angle_z dd 0.0
angle_y dd 0.0
delt_size dd 3.0
@@ -478,17 +360,13 @@ import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../export.inc'
@@ -606,23 +484,28 @@ lib_name_2 db 'libimg.obj',0
txt_scale:
db 'Scale: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_z:
db 'Rotate z: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_y:
db 'Rotate y: '
.v: rb 11
.v:
db 0
rb 10
align 4
buf_ogl:
dd 0 ;указатель на буфер изображения
dw 3d_wnd_l ;+4 left
.t: dw 3d_wnd_t ;+6 top
.w: dd 3d_wnd_w
.h: dd 3d_wnd_h
dw 10,10 ;+4 left,top
.w: dd 400
.h: dd 350
dd 0,24 ;+16 color,bit in pixel
align 4
@@ -641,14 +524,9 @@ l_libs_end:
align 4
i_end:
ctx1 TinyGLContext
ctx1 rb 28 ;sizeof.TinyGLContext = 28
image_data_toolbar dd 0
qObj dd 0
mouse_drag dd 0 ;scene rotation mode based on mouse cursor movement
mouse_x dd 0
mouse_y dd 0
angle_dzm dd 0 ;~ 3d_wnd_w/180 - adding scene rotation angles when rotating the mouse
angle_dym dd 0 ;~ 3d_wnd_h/180
run_file_70 FileInfoBlock
sc system_colors
align 16

View File

@@ -1,7 +1,3 @@
; SPDX-License-Identifier: GPL-2.0-only
; Textures0 - example of texture mapping on a sphere and cube
; Copyright (C) 2015-2025 KolibriOS team
use32
org 0
db 'MENUET01'
@@ -12,24 +8,24 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc'
include '../../../../../load_img.inc'
include '../../../../../load_lib.mac'
include '../kosgl.inc'
include '../opengl_const.inc'
include '../zbuffer.inc'
include '../../../../../develop/info3ds/info_fun_float.inc'
3d_wnd_l equ 0 ;tinygl buffer left indent
3d_wnd_t equ 30 ;tinygl buffer top indent
3d_wnd_w equ 500
3d_wnd_h equ 400
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
align 4
start:
load_libraries l_libs_start,l_libs_end
;checking how successfully the libraries were loaded
;проверка на сколько удачно загузились библиотеки
mov ebp,lib_0
.test_lib_open:
cmp dword [ebp+ll_struc_size-4],0
@@ -43,9 +39,9 @@ load_libraries l_libs_start,l_libs_end
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
mcall SF_SET_EVENTS_MASK,0x27
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,[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_NORMALIZE ;normals of the same size to avoid artifacts
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
call [gluNewQuadric]
mov [qObj],eax
stdcall [gluQuadricTexture], eax,GL_TRUE
@@ -53,7 +49,7 @@ load_libraries l_libs_start,l_libs_end
stdcall [glClearColor], 0.25,0.25,0.25,0.0
stdcall [glShadeModel], GL_SMOOTH
mov eax,[ctx1.gl_context]
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax
@@ -67,11 +63,6 @@ load_libraries l_libs_start,l_libs_end
load_image_file 'toolb_1.png', image_data_toolbar
load_image_file 'text_1.png', texture, text_w,text_h ;открытие файла текстуры
fld dword[angle_y]
stdcall update_number, txt_angle_y.v
fld dword[angle_z]
stdcall update_number, txt_angle_z.v
;* Setup texturing *
stdcall [glTexEnvi], GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL
@@ -97,27 +88,19 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
align 4
draw_window:
pushad
mcall SF_REDRAW,SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
mov ebx,[buf_ogl.w]
add ebx,(50 shl 16)+9
mov ecx,[buf_ogl.h]
add ecx,(30 shl 16)+4
add ecx,eax
add cx,[buf_ogl.t]
mcall SF_CREATE_WINDOW,,,0x33ffffff,,caption
mcall SF_CREATE_WINDOW,(50 shl 16)+420,(30 shl 16)+410,0x33ffffff,,caption
mov esi,[sc.work_button]
mcall SF_DEFINE_BUTTON,(6 shl 16)+19,(6 shl 16)+19,3+0x40000000 ;сферы
@@ -161,7 +144,11 @@ key:
fld dword[angle_y]
fadd dword[delt_size]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -171,7 +158,11 @@ key:
fld dword[angle_y]
fsub dword[delt_size]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -181,7 +172,11 @@ key:
fld dword[angle_z]
fadd dword[delt_size]
fst dword[angle_z]
stdcall update_number, txt_angle_z.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -191,7 +186,11 @@ key:
fld dword[angle_z]
fsub dword[delt_size]
fst dword[angle_z]
stdcall update_number, txt_angle_z.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_z.v],0
stdcall str_cat, txt_angle_z.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -228,20 +227,6 @@ button:
stdcall mem.Free,[image_data_toolbar]
mcall SF_TERMINATE_PROCESS
;input:
; st0 - number
; txt_addr - pointer to text buffer
align 4
proc update_number uses eax, txt_addr:dword
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov eax,[txt_addr]
mov byte[eax],0
stdcall str_cat, eax,Data_String
ret
endp
align 4
but_dr_0:
mov dword[dr_figure],0
@@ -302,12 +287,15 @@ but_zoom_m:
call [kosglSwapBuffers]
ret
align 4
caption db 'Test textures, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
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
@@ -316,24 +304,15 @@ cmp dword[dr_figure],0
jne @f
; рисование сфер
stdcall [glColor3f], 1.0, 1.0, 0.0
push 32
push 32
glpush rad1
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], 1.0, 32,32
stdcall [glColor3f], 1.0, 0.0, 0.0
stdcall [glTranslatef], -1.6,0.0,0.0
push 16
push 16
glpush rad2
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], 0.55, 16,16
stdcall [glColor3f], 0.0, 0.0, 1.0
stdcall [glTranslatef], 3.2,0.0,0.0
push 16
push 16
glpush rad2
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], 0.55, 16,16
@@:
cmp dword[dr_figure],1
jne @f
@@ -409,13 +388,6 @@ call [glPopMatrix]
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_y,5,25,0xffff00
ret
align 4
caption db 'Test textures, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
rad1 dq 1.0
rad2 dq 0.55
scale dd 0.4 ;начальный масштаб
sc_delt dd 0.05 ;изменение масштаба при нажатии
sc_min dd 0.1 ;минимальный масштаб
@@ -438,17 +410,13 @@ import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../export.inc'
@@ -566,23 +534,28 @@ lib_name_2 db 'libimg.obj',0
txt_scale:
db 'Scale: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_z:
db 'Rotate z: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_y:
db 'Rotate y: '
.v: rb 11
.v:
db 0
rb 10
align 4
buf_ogl:
dd 0 ;указатель на буфер изображения
dw 3d_wnd_l ;+4 left
.t: dw 3d_wnd_t ;+6 top
.w: dd 3d_wnd_w
.h: dd 3d_wnd_h
dw 10,10 ;+4 left,top
.w: dd 400
.h: dd 350
dd 0,24 ;+16 color,bit in pixel
align 4
@@ -601,7 +574,7 @@ l_libs_end:
align 4
i_end:
ctx1 TinyGLContext
ctx1 rb 28 ;sizeof.TinyGLContext = 28
image_data_toolbar dd 0
dr_figure dd 0
qObj dd 0

View File

@@ -1,8 +1,3 @@
; SPDX-License-Identifier: GPL-2.0-only
; Textures1 - drawing the earth with and without meridians.
; Texture size 1024*512 pixels is used.
; Copyright (C) 2015-2025 KolibriOS team
use32
org 0
db 'MENUET01'
@@ -13,24 +8,24 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc'
include '../../../../../load_img.inc'
include '../../../../../load_lib.mac'
include '../kosgl.inc'
include '../opengl_const.inc'
include '../zbuffer.inc'
include '../../../../../develop/info3ds/info_fun_float.inc'
3d_wnd_l equ 0 ;tinygl buffer left indent
3d_wnd_t equ 30 ;tinygl buffer top indent
3d_wnd_w equ 450
3d_wnd_h equ 400
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
align 4
start:
load_libraries l_libs_start,l_libs_end
;checking how successfully the libraries were loaded
;проверка на сколько удачно загузились библиотеки
mov ebp,lib_0
.test_lib_open:
cmp dword [ebp+ll_struc_size-4],0
@@ -44,9 +39,9 @@ load_libraries l_libs_start,l_libs_end
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
mcall SF_SET_EVENTS_MASK,0x27
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,[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_NORMALIZE ;normals of the same size to avoid artifacts
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
call [gluNewQuadric]
mov [qObj],eax
stdcall [gluQuadricTexture], eax,GL_TRUE
@@ -54,7 +49,7 @@ load_libraries l_libs_start,l_libs_end
stdcall [glClearColor], 0.0,0.0,0.0,0.0
stdcall [glShadeModel], GL_SMOOTH
mov eax,[ctx1.gl_context]
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax
@@ -68,11 +63,6 @@ load_libraries l_libs_start,l_libs_end
load_image_file 'toolb_1.png', image_data_toolbar
load_image_file 'text_2.png', texture, text_w,text_h ;открытие файла текстуры
fld dword[angle_x]
stdcall update_number, txt_angle_x.v
fld dword[angle_y]
stdcall update_number, txt_angle_y.v
;* Setup texturing *
stdcall [glTexEnvi], GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL
@@ -98,27 +88,19 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
align 4
draw_window:
pushad
mcall SF_REDRAW,SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
mov ebx,[buf_ogl.w]
add ebx,(50 shl 16)+9
mov ecx,[buf_ogl.h]
add ecx,(30 shl 16)+4
add ecx,eax
add cx,[buf_ogl.t]
mcall SF_CREATE_WINDOW,,,0x33ffffff,,caption
mcall SF_CREATE_WINDOW,(50 shl 16)+420,(30 shl 16)+410,0x33ffffff,,caption
mov esi,[sc.work_button]
mcall SF_DEFINE_BUTTON,(6 shl 16)+19,(6 shl 16)+19,3+0x40000000 ;земля с меридиан.
@@ -164,7 +146,11 @@ key:
fld dword[angle_y]
fadd dword[delt_size]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -174,7 +160,11 @@ key:
fld dword[angle_y]
fsub dword[delt_size]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -184,7 +174,11 @@ key:
fld dword[angle_x]
fadd dword[delt_size]
fst dword[angle_x]
stdcall update_number, txt_angle_x.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_x.v],0
stdcall str_cat, txt_angle_x.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -194,7 +188,11 @@ key:
fld dword[angle_x]
fsub dword[delt_size]
fst dword[angle_x]
stdcall update_number, txt_angle_x.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_x.v],0
stdcall str_cat, txt_angle_x.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -231,20 +229,6 @@ button:
stdcall mem.Free,[image_data_toolbar]
mcall SF_TERMINATE_PROCESS
;input:
; st0 - number
; txt_addr - pointer to text buffer
align 4
proc update_number uses eax, txt_addr:dword
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov eax,[txt_addr]
mov byte[eax],0
stdcall str_cat, eax,Data_String
ret
endp
align 4
but_dr_0:
mov dword[dr_figure],0
@@ -305,40 +289,34 @@ but_zoom_m:
call [kosglSwapBuffers]
ret
align 4
caption db 'Test textures, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
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.2 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
stdcall [glScalef], 1.0, 1.0, 0.1 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
stdcall [glRotatef], [angle_x],1.0,0.0,0.0
cmp dword[dr_figure],0
jne @f
; drawing earth with meridians
; рисование земли с меридианами
stdcall [glColor3f], 0.0, 0.0, 1.0
stdcall [gluQuadricDrawStyle], [qObj],GLU_LINE
push 18
push 24
glpush rad1
stdcall [gluSphere], [qObj] ;meridians
stdcall [gluSphere], [qObj], 1.0, 24,18 ;меридианы
stdcall [gluQuadricDrawStyle], [qObj],GLU_FILL
push 24
push 18
glpush rad2
stdcall [gluSphere], [qObj] ;Earth
stdcall [gluSphere], [qObj], 0.995, 24,18 ;земля
@@:
cmp dword[dr_figure],1
jne @f
; drawing the earth
; рисование земли
stdcall [gluQuadricDrawStyle], [qObj],GLU_FILL
push 64
push 64
glpush rad1
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], 1.0, 64,64
@@:
call [glPopMatrix]
@@ -347,13 +325,6 @@ call [glPopMatrix]
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_x,5,25,0xffff00
ret
align 4
caption db 'Test textures, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
rad1 dq 1.0
rad2 dq 0.995
scale dd 0.95 ;начальный масштаб
sc_delt dd 0.05 ;изменение масштаба при нажатии
sc_min dd 0.1 ;минимальный масштаб
@@ -369,17 +340,13 @@ import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../export.inc'
@@ -497,27 +464,34 @@ lib_name_2 db 'libimg.obj',0
txt_scale:
db 'Scale: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_z:
db 'Rotate z: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_x:
db 'Rotate x: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_y:
db 'Rotate y: '
.v: rb 11
.v:
db 0
rb 10
align 4
buf_ogl:
dd 0 ;указатель на буфер изображения
dw 3d_wnd_l ;+4 left
.t: dw 3d_wnd_t ;+6 top
.w: dd 3d_wnd_w
.h: dd 3d_wnd_h
dw 10,10 ;+4 left,top
.w: dd 400
.h: dd 350
dd 0,24 ;+16 color,bit in pixel
align 4
@@ -536,7 +510,7 @@ l_libs_end:
align 4
i_end:
ctx1 TinyGLContext
ctx1 rb 28 ;sizeof.TinyGLContext = 28
image_data_toolbar dd 0
dr_figure dd 0
qObj dd 0

View File

@@ -1,7 +1,3 @@
; SPDX-License-Identifier: GPL-2.0-only
; Textures2 - example of creating a spherical panorama using texture
; Copyright (C) 2015-2025 KolibriOS team
use32
org 0
db 'MENUET01'
@@ -12,24 +8,24 @@ include '../../../../../macros.inc'
include '../../../../../KOSfuncs.inc'
include '../../../../../load_img.inc'
include '../../../../../load_lib.mac'
include '../kosgl.inc'
include '../opengl_const.inc'
include '../zbuffer.inc'
include '../../../../../develop/info3ds/info_fun_float.inc'
3d_wnd_l equ 0 ;tinygl buffer left indent
3d_wnd_t equ 30 ;tinygl buffer top indent
3d_wnd_w equ 450
3d_wnd_h equ 400
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
;Макрос для параметров типа double (8 байт)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
IMAGE_TOOLBAR_ICON_SIZE equ 21*21*3
align 4
start:
load_libraries l_libs_start,l_libs_end
;checking how successfully the libraries were loaded
;проверка на сколько удачно загузились библиотеки
mov ebp,lib_0
.test_lib_open:
cmp dword [ebp+ll_struc_size-4],0
@@ -43,9 +39,9 @@ load_libraries l_libs_start,l_libs_end
mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
mcall SF_SET_EVENTS_MASK,0x27
stdcall [kosglMakeCurrent], 3d_wnd_l,3d_wnd_t,[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_NORMALIZE ;normals of the same size to avoid artifacts
stdcall [glEnable], GL_NORMALIZE ;делам нормали одинаковой величины во избежание артефактов
call [gluNewQuadric]
mov [qObj],eax
stdcall [gluQuadricDrawStyle], eax,GLU_FILL
@@ -54,7 +50,7 @@ load_libraries l_libs_start,l_libs_end
stdcall [glClearColor], 0.0,0.0,0.0,0.0
stdcall [glShadeModel], GL_SMOOTH
mov eax,[ctx1.gl_context]
mov eax,dword[ctx1] ;eax -> TinyGLContext.GLContext
mov eax,[eax] ;eax -> ZBuffer
mov eax,[eax+ZBuffer.pbuf]
mov dword[buf_ogl],eax
@@ -68,11 +64,6 @@ load_libraries l_libs_start,l_libs_end
load_image_file 'toolb_1.png', image_data_toolbar
load_image_file 'text_3.png', texture, text_w,text_h ;открытие файла текстуры
fld dword[angle_x]
stdcall update_number, txt_angle_x.v
fld dword[angle_y]
stdcall update_number, txt_angle_y.v
;* Setup texturing *
stdcall [glTexEnvi], GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL
@@ -98,27 +89,19 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
align 4
draw_window:
pushad
mcall SF_REDRAW,SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS,SSF_GET_SKIN_HEIGHT
mov ebx,[buf_ogl.w]
add ebx,(50 shl 16)+9
mov ecx,[buf_ogl.h]
add ecx,(30 shl 16)+4
add ecx,eax
add cx,[buf_ogl.t]
mcall SF_CREATE_WINDOW,,,0x33ffffff,,caption
mcall SF_CREATE_WINDOW,(50 shl 16)+420,(30 shl 16)+410,0x33ffffff,,caption
mov esi,[sc.work_button]
mcall SF_DEFINE_BUTTON,(6 shl 16)+19,(6 shl 16)+19,3+0x40000000 ;масштаб +
@@ -158,7 +141,11 @@ key:
fld dword[angle_y]
fadd dword[delt_size]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -168,7 +155,11 @@ key:
fld dword[angle_y]
fsub dword[delt_size]
fst dword[angle_y]
stdcall update_number, txt_angle_y.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_y.v],0
stdcall str_cat, txt_angle_y.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -178,7 +169,11 @@ key:
fld dword[angle_x]
fadd dword[delt_size]
fst dword[angle_x]
stdcall update_number, txt_angle_x.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_x.v],0
stdcall str_cat, txt_angle_x.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -188,7 +183,11 @@ key:
fld dword[angle_x]
fsub dword[delt_size]
fst dword[angle_x]
stdcall update_number, txt_angle_x.v
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov byte[txt_angle_x.v],0
stdcall str_cat, txt_angle_x.v,Data_String
call draw_3d
call [kosglSwapBuffers]
@@:
@@ -215,20 +214,6 @@ button:
stdcall mem.Free,[image_data_toolbar]
mcall SF_TERMINATE_PROCESS
;input:
; st0 - number
; txt_addr - pointer to text buffer
align 4
proc update_number uses eax, txt_addr:dword
mov word[NumberSymbolsAD],2
fstp qword[Data_Double]
call DoubleFloat_to_String
mov eax,[txt_addr]
mov byte[eax],0
stdcall str_cat, eax,Data_String
ret
endp
align 4
but_zoom_p:
finit
@@ -275,25 +260,21 @@ but_zoom_m:
call [kosglSwapBuffers]
ret
align 4
caption db 'Test textures, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
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.2 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
stdcall [glScalef], 1.0, 1.0, 0.1 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
stdcall [glRotatef], [angle_x],1.0,0.0,0.0
; рисование панорамы
push 64
push 64
add esp,-8
fld1
fstp qword[esp]
stdcall [gluSphere], [qObj]
stdcall [gluSphere], [qObj], 1.0, 64,64
call [glPopMatrix]
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_scale,5,5,0xffff00
@@ -301,10 +282,6 @@ call [glPopMatrix]
stdcall [buf2d_draw_text], buf_ogl, buf_1,txt_angle_x,5,25,0xffff00
ret
align 4
caption db 'Test textures, [Esc] - exit, [<-],[->],[Up],[Down] - rotate',0
align 4
scale dd 1.5 ;начальный масштаб
sc_delt dd 0.05 ;изменение масштаба при нажатии
sc_min dd 0.95 ;минимальный масштаб
@@ -320,17 +297,13 @@ import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include '../export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include '../export.inc'
@@ -448,27 +421,34 @@ lib_name_2 db 'libimg.obj',0
txt_scale:
db 'Scale: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_z:
db 'Rotate z: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_x:
db 'Rotate x: '
.v: rb 11
.v:
db 0
rb 10
txt_angle_y:
db 'Rotate y: '
.v: rb 11
.v:
db 0
rb 10
align 4
buf_ogl:
dd 0 ;указатель на буфер изображения
dw 3d_wnd_l ;+4 left
.t: dw 3d_wnd_t ;+6 top
.w: dd 3d_wnd_w
.h: dd 3d_wnd_h
dw 10,10 ;+4 left,top
.w: dd 400
.h: dd 350
dd 0,24 ;+16 color,bit in pixel
align 4
@@ -487,7 +467,7 @@ l_libs_end:
align 4
i_end:
ctx1 TinyGLContext
ctx1 rb 28 ;sizeof.TinyGLContext = 28
image_data_toolbar dd 0
qObj dd 0
TexObj dd 0 ;массив указателей на текстуры (в данном случае 1 шт.)

View File

@@ -168,8 +168,7 @@ E_LIB gluQuadricDrawStyle
E_LIB gluQuadricOrientation
E_LIB gluQuadricTexture
E_LIB gluCylinder ;(GLUquadricObj, double, double, double, int, int)
E_LIB gluDisk ;(GLUquadricObj, double, double, int, int)
E_LIB gluSphere ;(GLUquadricObj, double, int, int)
E_LIB gluSphere ;(GLUquadricObj, float, int, int)
;
; KolibriOS functions

View File

@@ -6,9 +6,29 @@ struct GLUquadricObj
ErrorFunc dd ? ; Error handler callback function
ends
offs_qobj_DrawStyle equ 0
offs_qobj_Orientation equ 4
offs_qobj_TextureFlag equ 8
offs_qobj_Normals equ 12
offs_qobj_ErrorFunc equ 16
;Так как некоторые извращенческие функции OpenGL воспринимают только параметры
;типа double (8 байт) то придется пихать их в стек макросом glpush
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
;void drawTorus(float rc, int numc, float rt, int numt)
;{
;}
;static void normal3f(GLfloat x, GLfloat y, GLfloat z )
;{
;}
align 4
fl_0_5 dd 0.5
fl_360 dd 360.0
an360f dd 360.0
align 16
proc gluPerspective, fovy:qword, aspect:qword, zNear:qword, zFar:qword
@@ -20,7 +40,7 @@ locals
endl
fldpi
fmul qword[fovy]
fdiv dword[fl_360]
fdiv dword[an360f]
fptan
ffree st0 ;выкидываем 1.0 которая осталось после вычисления тангенса
fincstp
@@ -56,11 +76,11 @@ gluNewQuadric:
stdcall gl_malloc, sizeof.GLUquadricObj
or eax,eax
jz @f
mov dword[eax+GLUquadricObj.DrawStyle],GLU_FILL
mov dword[eax+GLUquadricObj.Orientation],GLU_OUTSIDE
mov dword[eax+GLUquadricObj.TextureFlag],GL_FALSE
mov dword[eax+GLUquadricObj.Normals],GLU_SMOOTH
mov dword[eax+GLUquadricObj.ErrorFunc],0 ;NULL
mov dword[eax+offs_qobj_DrawStyle],GLU_FILL
mov dword[eax+offs_qobj_Orientation],GLU_OUTSIDE
mov dword[eax+offs_qobj_TextureFlag],GL_FALSE
mov dword[eax+offs_qobj_Normals],GLU_SMOOTH
mov dword[eax+offs_qobj_ErrorFunc],0 ;NULL
@@:
ret
@@ -94,7 +114,7 @@ proc gluQuadricDrawStyle uses eax ebx, qobj:dword, drawStyle:dword
jmp .err_q
align 4
@@:
mov dword[eax+GLUquadricObj.DrawStyle],ebx
mov dword[eax+offs_qobj_DrawStyle],ebx
jmp @f
align 4
.err_q:
@@ -119,7 +139,7 @@ proc gluQuadricOrientation uses eax ebx, qobj:dword, orientation:dword
jmp .err_q
align 4
@@:
mov dword[eax+GLUquadricObj.Orientation],ebx
mov dword[eax+offs_qobj_Orientation],ebx
jmp @f
align 4
.err_q:
@@ -139,7 +159,7 @@ proc gluQuadricTexture uses eax ebx, qobj:dword, texture:dword
cmp ebx,GL_FALSE
je @f
@@:
mov dword[eax+GLUquadricObj.TextureFlag],ebx
mov dword[eax+offs_qobj_TextureFlag],ebx
jmp @f
align 4
.err_q:
@@ -149,7 +169,7 @@ align 4
endp
align 16
proc gluCylinder qobj:dword, baseRadius:qword, topRadius:qword, height:qword,\
proc gluCylinder qobj:dword, baseRadius:dword, topRadius:dword, height:dword,\
slices:dword, stacks:dword
locals
da dq ? ;double
@@ -173,7 +193,7 @@ endl
pushad
mov edx,[qobj]
fld1
cmp dword[edx+GLUquadricObj.Orientation],GLU_INSIDE
cmp dword[edx+offs_qobj_Orientation],GLU_INSIDE
jne @f
fchs
@@:
@@ -183,12 +203,14 @@ pushad
fadd st0,st0
fidiv dword[slices]
fstp qword[da] ;da = 2.0*M_PI / slices
fld qword[topRadius]
fsub qword[baseRadius]
mov ebx,[topRadius]
fld qword[ebx]
mov ecx,[baseRadius]
fsub qword[ecx]
fld st0 ;copy: topRadius-baseRadius
fidiv dword[stacks]
fstp qword[dr] ;dr = (topRadius-baseRadius) / stacks
lea eax,[height]
mov eax,[height]
fld qword[eax]
fidiv dword[stacks]
fstp qword[dz] ;dz = height / stacks
@@ -196,7 +218,7 @@ pushad
fdiv qword[eax]
fstp dword[nz] ;nz = (baseRadius-topRadius) / height ; Z component of normal vectors
cmp dword[edx+GLUquadricObj.DrawStyle],GLU_POINT
cmp dword[edx+offs_qobj_DrawStyle],GLU_POINT
jne .else0
stdcall glBegin,GL_POINTS
mov ebx,[slices]
@@ -223,7 +245,8 @@ align 4
call glNormal3f ;x*nsign, y*nsign, nz*nsign
mov dword[z],0.0
fld qword[baseRadius]
mov ecx,[baseRadius]
fld qword[ecx]
fstp qword[r] ;r = baseRadius
mov ecx,[stacks]
inc ecx
@@ -254,15 +277,16 @@ align 4
call glEnd
jmp .end_f
.else0:
cmp dword[edx+GLUquadricObj.DrawStyle],GLU_LINE
cmp dword[edx+offs_qobj_DrawStyle],GLU_LINE
je @f
cmp dword[edx+GLUquadricObj.DrawStyle],GLU_SILHOUETTE
cmp dword[edx+offs_qobj_DrawStyle],GLU_SILHOUETTE
je .else2
jmp .else1
@@:
; Draw rings
mov dword[z],0.0
fld qword[baseRadius]
mov ecx,[baseRadius]
fld qword[ecx]
fstp qword[r] ;r = baseRadius
mov ecx,[stacks]
inc ecx
@@ -318,100 +342,28 @@ align 4
align 4
.else2:
; draw one ring at each end
lea ecx,[baseRadius]
fld qword[ecx]
ftst
fnstsw ax
ffree st0
fincstp
sahf
je .rad_b0
; if (baseRadius!=0.0) {
stdcall glBegin,GL_LINE_LOOP
mov ebx,[slices]
mov dword[i],0
align 4
.cycle_4: ;for (i=0;i<slices;i++)
cmp [i],ebx
jge .cycle_4_end
fild dword[i]
fmul qword[da]
fld st0
fcos
fstp dword[x] ;x = cos(i*da)
fsin
fstp dword[y] ;y = sin(i*da)
fld dword[nsign]
fmul dword[nz]
fstp dword[esp-4]
fld dword[nsign]
fmul dword[y]
fstp dword[esp-8]
fld dword[nsign]
fmul dword[x]
fstp dword[esp-12]
add esp,-12
call glNormal3f ;x*nsign, y*nsign, nz*nsign
push 0.0
fld qword[ecx]
fmul dword[y]
fstp dword[esp-4]
fld qword[ecx]
fmul dword[x]
fstp dword[esp-8]
add esp,-8
call glVertex3f ;x*baseRadius, y*baseRadius, 0.0
inc dword[i]
jmp .cycle_4
.cycle_4_end:
; {
; x = cos(i*da);
; y = sin(i*da);
; normal3f( x*nsign, y*nsign, nz*nsign );
; glVertex3f( x*baseRadius, y*baseRadius, 0.0 );
; }
call glEnd
.rad_b0:
lea ecx,[topRadius]
fld qword[ecx]
ftst
fnstsw ax
ffree st0
fincstp
sahf
je .else2_end
stdcall glBegin,GL_LINE_LOOP
mov ebx,[slices]
mov dword[i],0
align 4
.cycle_5: ;for (i=0;i<slices;i++)
cmp [i],ebx
jge .cycle_5_end
fild dword[i]
fmul qword[da]
fld st0
fcos
fstp dword[x] ;x = cos(i*da)
fsin
fstp dword[y] ;y = sin(i*da)
fld dword[nsign]
fmul dword[nz]
fstp dword[esp-4]
fld dword[nsign]
fmul dword[y]
fstp dword[esp-8]
fld dword[nsign]
fmul dword[x]
fstp dword[esp-12]
add esp,-12
call glNormal3f ;x*nsign, y*nsign, nz*nsign
fld qword[height]
fstp dword[esp-4]
fld qword[ecx]
fmul dword[y]
fstp dword[esp-8]
fld qword[ecx]
fmul dword[x]
fstp dword[esp-12]
add esp,-12
call glVertex3f ;x*topRadius, y*topRadius, height
inc dword[i]
jmp .cycle_5
.cycle_5_end:
; {
; x = cos(i*da);
; y = sin(i*da);
; normal3f( x*nsign, y*nsign, nz*nsign );
; glVertex3f( x*topRadius, y*topRadius, height );
; }
call glEnd
; }
.else2_end:
; draw length lines
stdcall glBegin,GL_LINES
@@ -438,7 +390,8 @@ align 4
sub esp,12
call glNormal3f ;x*nsign, y*nsign, nz*nsign
mov dword[esp-4],0.0
fld qword[baseRadius]
mov ecx,[baseRadius]
fld qword[ecx]
fld st0
fmul dword[y]
fstp dword[esp-8]
@@ -446,9 +399,11 @@ align 4
fstp dword[esp-12]
sub esp,12
call glVertex3f ;x*baseRadius, y*baseRadius, 0.0
fld qword[height]
mov eax,[height]
fld qword[eax]
fstp dword[esp-4]
fld qword[topRadius]
mov ecx,[topRadius]
fld qword[ecx]
fld st0
fmul dword[y]
fstp dword[esp-8]
@@ -464,7 +419,7 @@ align 4
jmp .end_f
align 4
.else1:
cmp dword[edx+GLUquadricObj.DrawStyle],GLU_FILL
cmp dword[edx+offs_qobj_DrawStyle],GLU_FILL
jne .end_f
fld1
fidiv dword[slices]
@@ -498,7 +453,8 @@ align 4
fchs
fstp dword[x2] ;x2 = -sin((i+1)*da)
mov dword[z],0.0
fld qword[baseRadius]
mov ecx,[baseRadius]
fld qword[ecx]
fstp qword[r] ;r = baseRadius
mov dword[tcy],0.0
stdcall glBegin,GL_QUAD_STRIP
@@ -523,7 +479,7 @@ align 4
fstp dword[esp-12]
sub esp,12
call glNormal3f ;x1*nsign, y1*nsign, nz*nsign
cmp dword[edx+GLUquadricObj.TextureFlag],0 ;if (qobj.TextureFlag)
cmp dword[edx+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
je @f
stdcall glTexCoord2f, [tcx],[tcy]
@@:
@@ -548,7 +504,7 @@ align 4
fstp dword[esp-12]
sub esp,12
call glNormal3f ;x2*nsign, y2*nsign, nz*nsign
cmp dword[edx+GLUquadricObj.TextureFlag],0 ;if (qobj.TextureFlag)
cmp dword[edx+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
je @f
push dword[tcy]
fld dword[tcx]
@@ -579,7 +535,7 @@ align 4
fstp dword[esp-12]
sub esp,12
call glNormal3f ;x2*nsign, y2*nsign, nz*nsign
cmp dword[edx+GLUquadricObj.TextureFlag],0 ;if (qobj.TextureFlag)
cmp dword[edx+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
je @f
stdcall glTexCoord2f, [tcx],[tcy]
@@:
@@ -604,7 +560,7 @@ align 4
fstp dword[esp-12]
sub esp,12
call glNormal3f ;x1*nsign, y1*nsign, nz*nsign
cmp dword[edx+GLUquadricObj.TextureFlag],0 ;if (qobj.TextureFlag)
cmp dword[edx+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
je @f
push dword[tcy]
fld dword[tcx]
@@ -649,164 +605,18 @@ endp
; Disk (adapted from Mesa)
align 16
proc gluDisk uses eax ebx ecx edx esi, qobj:dword,\
innerRadius:qword, outerRadius:qword, slices:dword, loops:dword
locals
a dq ?
da dq ?
dr dd ?
r1 dd ?
r2 dd ?
dtc dd ?
s dd ? ;int
sa dd ?
ca dd ?
endl
;ebx = s
;ecx = l
;esi = slices
mov ecx,[loops]
cmp ecx,1
jl .end_f
mov esi,[slices]
cmp esi,1
jl .end_f
mov edx,[qobj]
cmp dword[edx+GLUquadricObj.DrawStyle],GLU_FILL
jne .no_fill
fld1
cmp dword[edx+GLUquadricObj.Orientation],GLU_OUTSIDE
je @f
fchs
@@:
add esp,-4
fstp dword[esp]
stdcall glNormal3f,0.0,0.0
fldpi
fadd st0,st0
fidiv dword[slices]
fstp qword[da] ;da = 2.0*M_PI / slices
fld qword[outerRadius]
fsub qword[innerRadius]
fild dword[loops]
fdivp st1,st
fstp dword[dr] ;dr = (outerRadius-innerRadius) / loops
; texture of a gluDisk is a cut out of the texture unit square
; x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] (linear mapping)
fld1
fadd st0,st0
fmul qword[outerRadius]
fstp dword[dtc] ;dtc = 2.0*outerRadius
fld qword[innerRadius]
fstp dword[r1]
align 4
.cycle_0: ;for (l=loops;l>0;l--)
fld dword[r1]
fadd dword[dr]
fstp dword[r2] ;r2 = r1 + dr
stdcall glBegin,GL_QUAD_STRIP
xor ebx,ebx
.cycle_1: ;for (s=0;s<=slices;s++)
cmp esi,ebx
jne .u1
fldz
fstp qword[a]
jmp .u2
align 4
.u1:
mov [s],ebx
fild dword[s]
fmul qword[da]
fstp qword[a]
.u2:
fld qword[a]
fld st0
fsin
fstp dword[sa] ;sa = sin(a)
fcos
fstp dword[ca] ;ca = cos(a)
cmp dword[edx+GLUquadricObj.TextureFlag],0
je @f
fld dword[ca]
fmul dword[r2]
fdiv dword[dtc]
fadd dword[fl_0_5]
fstp dword[esp-4]
fld dword[sa]
fmul dword[r2]
fdiv dword[dtc]
fadd dword[fl_0_5]
add esp,-8
fstp dword[esp]
call glTexCoord2f ;0.5+sa*r2/dtc,0.5+ca*r2/dtc
@@:
fld dword[r2]
fmul dword[ca]
fstp dword[esp-4]
fld dword[r2]
fmul dword[sa]
add esp,-8
fstp dword[esp]
call glVertex2f ;r2*sa, r2*ca
cmp dword[edx+GLUquadricObj.TextureFlag],0
je @f
fld dword[ca]
fmul dword[r1]
fdiv dword[dtc]
fadd dword[fl_0_5]
fstp dword[esp-4]
fld dword[sa]
fmul dword[r1]
fdiv dword[dtc]
fadd dword[fl_0_5]
add esp,-8
fstp dword[esp]
call glTexCoord2f ;0.5+sa*r1/dtc,0.5+ca*r1/dtc
@@:
fld dword[r1]
fmul dword[ca]
fstp dword[esp-4]
fld dword[r1]
fmul dword[sa]
add esp,-8
fstp dword[esp]
call glVertex2f ;r1*sa, r1*ca
inc ebx
cmp esi,ebx
jge .cycle_1
.cycle_1_end:
call glEnd
mov eax,[r2]
mov [r1],eax
dec ecx
jnz .cycle_0
jmp .end_f
align 4
.no_fill:
push [loops]
push [slices]
sub esp,8
fldz
fstp qword[esp]
glpush innerRadius
glpush outerRadius
stdcall gluCylinder, [qobj]
.end_f:
ret
endp
;void gluDisk(GLUquadricObj *qobj, GLdouble innerRadius, GLdouble outerRadius, GLint slices, GLint loops )
;{
;}
;
; Sphere (adapted from Mesa)
;
;input:
; double radius, int slices, int stacks
; float radius, int slices, int stacks
align 16
proc gluSphere qobj:dword, radius:qword, slices:dword, stacks:dword
proc gluSphere qobj:dword, radius:dword, slices:dword, stacks:dword
locals
rho dd ? ;float
drho dd ?
@@ -828,7 +638,7 @@ endl
pushad
mov eax,[qobj]
cmp dword[eax+GLUquadricObj.Normals],GLU_NONE ;if (qobj.Normals==GLU_NONE)
cmp dword[eax+offs_qobj_Normals],GLU_NONE ;if (qobj.Normals==GLU_NONE)
jne .els_0
mov dword[normals],GL_FALSE
jmp @f
@@ -836,7 +646,7 @@ align 4
.els_0:
mov dword[normals],GL_TRUE
@@:
cmp dword[eax+GLUquadricObj.Orientation],GLU_INSIDE ;if (qobj.Orientation==GLU_INSIDE)
cmp dword[eax+offs_qobj_Orientation],GLU_INSIDE ;if (qobj.Orientation==GLU_INSIDE)
jne .els_1
mov dword[nsign],-1.0
jmp @f
@@ -856,7 +666,7 @@ align 4
ffree st0
fincstp
cmp dword[eax+GLUquadricObj.DrawStyle],GLU_FILL ;if (qobj.DrawStyle==GLU_FILL)
cmp dword[eax+offs_qobj_DrawStyle],GLU_FILL ;if (qobj.DrawStyle==GLU_FILL)
jne .if_glu_line
; draw +Z end as a triangle fan
@@ -865,13 +675,13 @@ align 4
jne @f
stdcall glNormal3f, 0.0, 0.0, 1.0
@@:
cmp dword[eax+GLUquadricObj.TextureFlag],0 ;if (qobj.TextureFlag)
cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
je @f
stdcall glTexCoord2f, 0.5,1.0
@@:
sub esp,4
fld dword[nsign]
fmul qword[radius]
fmul dword[radius]
fstp dword[esp]
stdcall glVertex3f, 0.0, 0.0 ;, nsign * radius
fld dword[drho]
@@ -918,7 +728,7 @@ align 4
sub esp,12
stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
@@:
fld qword[radius]
fld dword[radius]
fld dword[z]
fmul st0,st1
fstp dword[esp-4]
@@ -944,7 +754,7 @@ align 4
fstp dword[d_t] ;1.0 / stacks
mov dword[t],1.0 ; because loop now runs from 0
mov ebx,[stacks]
cmp dword[eax+GLUquadricObj.TextureFlag],0 ;if (qobj.TextureFlag)
cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
je .els_2
mov dword[i],0
mov [imax],ebx
@@ -1010,11 +820,11 @@ align 4
sub esp,12
stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
@@:
cmp dword[eax+GLUquadricObj.TextureFlag],0 ;if (qobj.TextureFlag)
cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
je @f
stdcall glTexCoord2f, [s],[t]
@@:
fld qword[radius]
fld dword[radius]
fld dword[z]
fmul st0,st1
fstp dword[esp-4]
@@ -1058,7 +868,7 @@ align 4
sub esp,12
stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
@@:
cmp dword[eax+GLUquadricObj.TextureFlag],0 ;if (qobj.TextureFlag)
cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
je @f
fld dword[t]
fsub dword[d_t]
@@ -1069,7 +879,7 @@ align 4
fadd dword[d_s]
fstp dword[s]
@@:
fld qword[radius]
fld dword[radius]
fld dword[z]
fmul st0,st1
fstp dword[esp-4]
@@ -1100,7 +910,7 @@ align 4
jne @f
stdcall glNormal3f, 0.0, 0.0, -1.0
@@:
cmp dword[eax+GLUquadricObj.TextureFlag],0 ;if (qobj.TextureFlag)
cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
je @f
stdcall glTexCoord2f, 0.5,0.0
mov dword[s],1.0
@@ -1108,7 +918,7 @@ align 4
mov [t],ebx
@@:
sub esp,4
fld qword[radius]
fld dword[radius]
fchs
fmul dword[nsign]
fstp dword[esp]
@@ -1160,14 +970,14 @@ align 4
fincstp
stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
@@:
cmp dword[eax+GLUquadricObj.TextureFlag],0 ;if (qobj.TextureFlag)
cmp dword[eax+offs_qobj_TextureFlag],0 ;if (qobj.TextureFlag)
je @f
stdcall glTexCoord2f, [s],[t]
fld dword[s]
fsub dword[d_s]
fstp dword[s]
@@:
fld qword[radius]
fld dword[radius]
fld dword[z]
fmul st0,st1
fstp dword[esp-4]
@@ -1188,9 +998,9 @@ align 4
align 4
.if_glu_line:
cmp dword[eax+GLUquadricObj.DrawStyle],GLU_LINE ;if (qobj.DrawStyle==GLU_LINE)
cmp dword[eax+offs_qobj_DrawStyle],GLU_LINE ;if (qobj.DrawStyle==GLU_LINE)
je @f
cmp dword[eax+GLUquadricObj.DrawStyle],GLU_SILHOUETTE ;if (qobj.DrawStyle==GLU_SILHOUETTE)
cmp dword[eax+offs_qobj_DrawStyle],GLU_SILHOUETTE ;if (qobj.DrawStyle==GLU_SILHOUETTE)
je @f
jmp .if_glu_point
align 4
@@ -1246,7 +1056,7 @@ align 4
sub esp,12
stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
@@:
fld qword[radius]
fld dword[radius]
fld dword[z]
fmul st0,st1
fstp dword[esp-4]
@@ -1313,7 +1123,7 @@ align 4
sub esp,12
stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
@@:
fld qword[radius]
fld dword[radius]
fld dword[z]
fmul st0,st1
fstp dword[esp-4]
@@ -1338,7 +1148,7 @@ align 4
align 4
.if_glu_point:
cmp dword[eax+GLUquadricObj.DrawStyle],GLU_POINT ;if (qobj.DrawStyle==GLU_POINT)
cmp dword[eax+offs_qobj_DrawStyle],GLU_POINT ;if (qobj.DrawStyle==GLU_POINT)
jne .end_f
; top and bottom-most points
@@ -1347,10 +1157,7 @@ align 4
jne @f
stdcall glNormal3f, 0.0,0.0,dword[nsign]
@@:
sub esp,4
fld qword[radius]
fstp dword[esp]
stdcall glVertex3f, 0.0,0.0
stdcall glVertex3f, 0.0,0.0,dword[radius]
cmp dword[normals],GL_TRUE
jne @f
sub esp,4
@@ -1360,7 +1167,7 @@ align 4
stdcall glNormal3f, 0.0,0.0 ;,-nsign
@@:
sub esp,4
fld qword[radius]
fld dword[radius]
fchs
fstp dword[esp]
stdcall glVertex3f, 0.0,0.0 ;,-radius
@@ -1413,7 +1220,7 @@ align 4
sub esp,12
stdcall glNormal3f ;x*nsign, y*nsign, z*nsign
@@:
fld qword[radius]
fld dword[radius]
fld dword[z]
fmul st0,st1
fstp dword[esp-4]

View File

@@ -1,18 +0,0 @@
align 4
import_tinygl:
macro E_LIB n
{
if defined sz_#n
n dd sz_#n
end if
}
include 'export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include 'export.inc'

View File

@@ -1,6 +1,15 @@
; simple gl like driver for TinyGL and KolibriOS - porting iadn
include 'kosgl.inc'
struct TinyGLContext
gl_context dd ?
xsize dd ? ;+4
ysize dd ? ;+8
d_x dd ? ;+12
d_y dd ? ;+16
x dd ? ;+20
y dd ? ;+24
ends
;KOSGLContext kosglCreateContext(KOSGLContext shareList, int flags)
;{

View File

@@ -1,15 +0,0 @@
;Macro for double type parameters (8 bytes)
macro glpush GLDoubleVar {
push dword[GLDoubleVar+4]
push dword[GLDoubleVar]
}
struct TinyGLContext
gl_context dd ?
xsize dd ? ;+4
ysize dd ? ;+8
d_x dd ? ;+12
d_y dd ? ;+16
x dd ? ;+20
y dd ? ;+24
ends

View File

@@ -1,6 +1,5 @@
align 4
fl_128 dd 128.0
fl_1e_3 dd 1.0e-3
sp128f dd 128.0
align 4
proc glopMaterial uses eax ebx ecx edi esi, context:dword, p:dword
@@ -12,7 +11,8 @@ proc glopMaterial uses eax ebx ecx edi esi, context:dword, p:dword
cmp ecx,GL_FRONT_AND_BACK ;if (mode == GL_FRONT_AND_BACK)
jne @f
mov dword[ebx+4],GL_FRONT ;p[1].i=GL_FRONT
stdcall glopMaterial,eax,ebx
lea edi,[ebp+12]
stdcall glopMaterial,eax,edi
mov ecx,GL_BACK
@@:
lea edi,[eax+GLContext.materials]
@@ -58,7 +58,7 @@ align 4
add edi,GLMaterial.shininess
movsd
mov dword[edi],SPECULAR_BUFFER_RESOLUTION
fdiv dword[fl_128]
fdiv dword[sp128f]
fimul dword[edi]
fistp dword[edi] ;m.shininess_i = (v[0]/128.0f)*SPECULAR_BUFFER_RESOLUTION
jmp .end_f
@@ -185,15 +185,15 @@ align 4
cmp ecx,GL_SPOT_EXPONENT
jne @f
mov ecx,[ebx+12]
mov [edx+GLLight.spot_exponent],ecx ;l.spot_exponent=p[3]
mov [edi+GLLight.spot_exponent],ecx ;l.spot_exponent=p[3]
jmp .end_f
align 4
@@:
cmp ecx,GL_SPOT_CUTOFF
jne .end_spot_c
fld dword[ebx+12] ;float a=v.v[0]
fld dword[ebp+12] ;float a=v.v[0]
; assert(a == 180 || (a>=0 && a<=90));
fst dword[edx+GLLight.spot_cutoff] ;l.spot_cutoff=a
fst dword[edi+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[edx+GLLight.cos_spot_cutoff] ;l.cos_spot_cutoff=cos(a * M_PI / 180.0)
fstp dword[edi+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 [edx+GLLight.attenuation],ecx ;l->attenuation[0]=p[3]
mov [edi+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 [edx+GLLight.attenuation+4],ecx ;l->attenuation[1]=p[3]
mov [edi+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 [edx+GLLight.attenuation+8],ecx ;l->attenuation[2]=p[3]
mov [edi+GLLight.attenuation+8],ecx ;l->attenuation[2]=p[3]
jmp .end_f
align 4
@@: ;default:
@@ -356,18 +356,22 @@ align 4
ret
endp
align 4
fl_1e_3 dd 1.0e-3
; non optimized lightening model
align 16
proc gl_shade_vertex, context:dword, v:dword
locals
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
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
lR dd ? ;float ebp-44
lB dd ? ;float ebp-40
lG dd ? ;float ebp-36
@@ -392,7 +396,8 @@ pushad
mov esi,[v]
mov edx,[context]
lea ecx,[edx+GLContext.materials] ;ecx(m) = &context.materials[0]
mov ecx,edx
add ecx,GLContext.materials ;ecx(m) = &context.materials[0]
mov eax,[edx+GLContext.light_model_two_side]
mov [twoside],eax
@@ -405,7 +410,7 @@ pushad
fld dword[edx+GLContext.ambient_light_model]
fmul dword[ecx+GLMaterial.ambient]
fadd dword[ecx+GLMaterial.emission]
fadd dword[ecx] ;GLMaterial.emission=0
fstp dword[R] ;R=m.emission.v[0]+m.ambient.v[0]*context.ambient_light_model.v[0]
fld dword[edx+GLContext.ambient_light_model+4]
fmul dword[ecx+GLMaterial.ambient+4]
@@ -425,7 +430,7 @@ pushad
; ambient
fld dword[ecx+GLMaterial.ambient]
fmul dword[ebx+GLLight.ambient]
fmul dword[ebx] ;GLLight.ambient=0
fstp dword[lR] ;lR=l.ambient.v[0] * m.ambient.v[0]
fld dword[ecx+GLMaterial.ambient+4]
fmul dword[ebx+GLLight.ambient+4]
@@ -442,8 +447,8 @@ pushad
; light at infinity
ffree st0 ;l.position.v[3]
fincstp
mov eax,[ebx+GLLight.norm_position+offs_X]
mov [d+offs_X],eax ;d.X=l.norm_position.v[0]
mov eax,[ebx+GLLight.norm_position]
mov [d],eax ;d.X=l.norm_position.v[0]
mov eax,[ebx+GLLight.norm_position+offs_Y]
mov [d+offs_Y],eax ;d.Y=l.norm_position.v[1]
mov eax,[ebx+GLLight.norm_position+offs_Z]
@@ -455,9 +460,9 @@ align 4
; distance attenuation
ffree st0 ;l.position.v[3]
fincstp
fld dword[ebx+GLLight.position+offs_X]
fsub dword[esi+GLVertex.ec+offs_X]
fstp dword[d+offs_X] ;d.X=l.position.v[0]-v.ec.v[0]
fld dword[ebx+GLLight.position]
fsub dword[esi+GLVertex.ec]
fstp dword[d] ;d.X=l.position.v[0]-v.ec.v[0]
fld dword[ebx+GLLight.position+offs_Y]
fsub dword[esi+GLVertex.ec+offs_Y]
fstp dword[d+offs_Y] ;d.Y=l.position.v[1]-v.ec.v[1]
@@ -479,9 +484,9 @@ align 4
jbe @f ;if (dist>1.0e-3)
fld1
fdiv st0,st1
fld dword[d+offs_X]
fld dword[d]
fmul st0,st1
fstp dword[d+offs_X]
fstp dword[d]
fld dword[d+offs_Y]
fmul st0,st1
fstp dword[d+offs_Y]
@@ -504,8 +509,8 @@ align 4
ffree st0 ;dist
fincstp
.els_0_end:
fld dword[d+offs_X]
fmul dword[n+offs_X]
fld dword[d]
fmul dword[n]
fld dword[d+offs_Y]
fmul dword[n+offs_Y]
faddp
@@ -558,6 +563,7 @@ 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)
@@ -696,7 +702,7 @@ align 4
@@:
shl dword[idx],2
add edi,dword[idx]
fld dword[edi+GLSpecBuf.buf] ;dot_spec = specbuf.buf[idx]
fld dword[edi+offs_spec_buf] ;dot_spec = specbuf.buf[idx]
fld dword[ebx+GLLight.specular]
fmul st0,st1
fmul dword[ecx+GLMaterial.specular]

View File

@@ -57,13 +57,12 @@ proc delete_list uses eax ebx ecx edx, context:dword, list:dword
; free param buffer
mov eax,[edx] ;eax = GLList.first_op_buffer
@@:
or eax,eax
jz .end_w
mov ecx,[eax+GLParamBuffer.next]
cmp eax,0
je .end_w
mov ecx,[eax+offs_gpbu_next]
stdcall gl_free,eax
mov eax,ecx
jmp @b
align 4
.end_w:
stdcall gl_free,edx
@@ -80,10 +79,10 @@ proc alloc_list uses ebx ecx, context:dword, list:dword
mov ecx,eax
stdcall gl_zalloc,sizeof.GLList
mov dword[ecx+GLParamBuffer.next],0 ;ob.next=NULL
mov dword[ecx+offs_gpbu_next],0 ;ob.next=NULL
mov dword[eax],ecx ;l.first_op_buffer=ob
mov dword[ecx+GLParamBuffer.ops],OP_EndList ;ob.ops[0].op=OP_EndList
mov dword[ecx+offs_gpbu_ops],OP_EndList ;ob.ops[0].op=OP_EndList
mov ebx,[context]
mov ebx,[ebx+GLContext.shared_state]
@@ -139,12 +138,12 @@ pushad
jle @f
mov edi,eax
stdcall gl_zalloc,sizeof.GLParamBuffer
mov dword[eax+GLParamBuffer.next],0 ;=NULL
mov dword[eax+offs_gpbu_next],0 ;=NULL
mov dword[edi+GLParamBuffer.next],eax
mov dword[edi+offs_gpbu_next],eax
lea esi,[edi+4*ebx]
mov dword[esi+GLParamBuffer.ops],OP_NextBuffer
mov dword[esi+GLParamBuffer.ops+4],eax
mov dword[esi+offs_gpbu_ops],OP_NextBuffer
mov dword[esi+offs_gpbu_ops+4],eax
mov dword[edx+GLContext.current_op_buffer],eax
xor ebx,ebx
@@ -169,8 +168,8 @@ push edi esi
mov ebx,[ebx]
lea eax,[op_table_str]
@@:
or ebx,ebx
jz @f
cmp ebx,0
je @f
cmp byte[eax],0
jne .no_dec
dec ebx
@@ -198,24 +197,21 @@ push edi esi
add ebx,4
inc esi
cmp byte[esi],'f' ;float
cmp byte[esi],'f'
jne @f
fld dword[ebx]
fstp qword[Data_Double]
call DoubleFloat_to_String
stdcall str_cat, edi,Data_String
@@:
cmp byte[esi],'C' ;const
je @f
cmp byte[esi],'d' ;integer
je @f
jmp .no_param
@@:
cmp byte[esi],'d'
jne @f
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
@@ -311,8 +307,8 @@ proc glNewList uses eax ebx, list:dword, mode:dword
; assert(ebx->compile_flag == 0);
stdcall find_list,ebx,[list]
or eax,eax
jz @f
cmp eax,0
je @f
stdcall delete_list,ebx,[list]
@@:
stdcall alloc_list,ebx,[list]
@@ -351,8 +347,8 @@ align 4
proc glIsList, list:dword
call gl_get_context
stdcall find_list, eax,[list]
or eax,eax ;NULL
jz @f
cmp eax,0 ;NULL
je @f
mov eax,1
@@:
ret

View File

@@ -1,5 +1,5 @@
;
; functions for calculating specular color (glare)
; функции для вычисления зеркального цвета (блики)
;
align 4
@@ -10,41 +10,49 @@ locals
endl
mov dword[f_inc],SPECULAR_BUFFER_SIZE
mov ebx,[buf]
add ebx,GLSpecBuf.buf
add ebx,offs_spec_buf
mov dword[ebx],0.0 ;buf.buf[0] = 0.0
xor ecx,ecx
inc ecx
fld dword[shininess] ;сначала берем y
fld1
fidiv dword[f_inc]
fstp dword[f_inc] ;f_inc = 1.0f/SPECULAR_BUFFER_SIZE
mov dword[val],0.0
fst dword[f_inc] ;f_inc = 1.0f/SPECULAR_BUFFER_SIZE
fst dword[val]
align 4
.cycle_0: ;for (i = 1; i < SPECULAR_BUFFER_SIZE; i++)
inc ecx
.cycle_0: ;for (i = 1; i <= SPECULAR_BUFFER_SIZE; i++)
cmp ecx,SPECULAR_BUFFER_SIZE
jge @f
fld dword[shininess]
fld dword[val]
fadd dword[f_inc]
fst dword[val] ;val += f_inc
;need to calculate pow(val, shininess)
jg @f
;Вычисляем x^y
fyl2x ;the FPU stack now contains: st0=z=y*log2(x):
;now we count 2**z:
fld st0 ;copy z
frndint
fyl2x ;Стек FPU теперь содержит: st0=z=y*log2(x):
;Теперь считаем 2**z:
fld st0 ;Создаем еще одну копию z
frndint ;Округляем
fsubr st0,st1 ;st1=z, st0=z-trunc(z)
f2xm1 ;st1=z, st0=2**(z-trunc(z))-1
fld1
faddp ;st1=z, st0=2**(z-trunc(z))
fscale ;st1=z, st0=(2**trunc(z))*(2**(z-trunc(z)))=2**t
fxch st1
fstp st ;the result remains on the top of the stack st0
fstp st ;Результат остается на вершине стека st0
add ebx,4
fstp dword[ebx] ;buf.buf[i] = pow(val, shininess)
ffree st0 ;испорченный shininess
fincstp
fld dword[shininess] ;сначала берем y
fld dword[val]
fadd dword[f_inc]
fst dword[val] ;val += f_inc
inc ecx
jmp .cycle_0
@@:
mov dword[ebx+4],1.0
ffree st0 ;val
fincstp
ffree st0 ;shininess
fincstp
ret
endp
@@ -62,22 +70,22 @@ endl
.cycle_0:
or eax,eax ;while (found)
jz @f
cmp [eax+GLSpecBuf.shininess_i],ebx ;while (found.shininess_i != shininess_i)
cmp [eax+offs_spec_shininess_i],ebx ;while (found.shininess_i != shininess_i)
je @f
mov ecx,[oldest]
mov ecx,[ecx+GLSpecBuf.last_used]
cmp [eax+GLSpecBuf.last_used],ecx ;if (found.last_used < oldest.last_used)
mov ecx,[ecx+offs_spec_last_used]
cmp [eax+offs_spec_last_used],ecx ;if (found.last_used < oldest.last_used)
jge .end_0
mov [oldest],eax ;oldest = found
.end_0:
mov eax,[eax+GLSpecBuf.next] ;found = found.next
mov eax,[eax+offs_spec_next] ;found = found.next
jmp .cycle_0
@@:
cmp dword[found],0 ;if (found) /* hey, found one! */
je @f
mov eax,[found]
mov ecx,[edx+GLContext.specbuf_used_counter]
mov [eax+GLSpecBuf.last_used],ecx ;found.last_used = context.specbuf_used_counter
mov [eax+offs_spec_last_used],ecx ;found.last_used = context.specbuf_used_counter
inc dword[edx+GLContext.specbuf_used_counter]
jmp .end_f ;return found
@@:
@@ -94,21 +102,21 @@ endl
@@:
inc dword[edx+GLContext.specbuf_num_buffers]
mov ecx,[edx+GLContext.specbuf_first]
mov [eax+GLSpecBuf.next],ecx
mov [eax+offs_spec_next],ecx
mov [edx+GLContext.specbuf_first],eax
mov ecx,[edx+GLContext.specbuf_used_counter]
mov [eax+GLSpecBuf.last_used],ecx
mov [eax+offs_spec_last_used],ecx
inc dword[edx+GLContext.specbuf_used_counter]
mov [eax+GLSpecBuf.shininess_i],ebx
mov [eax+offs_spec_shininess_i],ebx
stdcall calc_buf, eax,dword[shininess]
jmp .end_f
.end_1:
; overwrite the lru buffer
;tgl_trace("overwriting spec buffer :(\n");
mov eax,[oldest]
mov [eax+GLSpecBuf.shininess_i],ebx
mov [eax+offs_spec_shininess_i],ebx
mov ecx,[edx+GLContext.specbuf_used_counter]
mov [eax+GLSpecBuf.last_used],ecx
mov [eax+offs_spec_last_used],ecx
inc dword[edx+GLContext.specbuf_used_counter]
stdcall calc_buf, eax,dword[shininess]
.end_f:

View File

@@ -17,9 +17,9 @@ proc find_texture uses ebx ecx, context:dword, h:dword
cmp dword[eax],0
je .no_found
mov ebx,[eax]
cmp dword[ebx+GLTexture.handle],ecx
cmp dword[ebx+offs_text_handle],ecx
je .found
mov eax,[ebx+GLTexture.next]
mov eax,[ebx+offs_text_next]
jmp @b
.no_found:
xor eax,eax ;ret NULL
@@ -32,36 +32,36 @@ proc free_texture uses eax ebx ecx edx, context:dword, h:dword
mov edx,[context]
stdcall find_texture,edx,[h] ;t=find_texture(context,h)
cmp dword[eax+GLTexture.prev],0 ;if (t.prev==NULL)
cmp dword[eax+offs_text_prev],0 ;if (t.prev==NULL)
jne .else
mov edx,[edx+GLContext.shared_state+4] ;edx = &context.shared_state.texture_hash_table[0]
mov ebx,[eax+GLTexture.handle]
mov ebx,[eax+offs_text_handle]
and ebx,0xff
shl ebx,2
add edx,ebx ;edx = &context.shared_state.texture_hash_table[t.handle % TEXTURE_HASH_TABLE_SIZE]
mov ebx,[eax+GLTexture.next]
mov ebx,[eax+offs_text_next]
mov [edx],ebx ;*ht=t.next
jmp @f
.else:
mov ebx,[eax+GLTexture.prev]
mov ecx,[eax+GLTexture.next]
mov [ebx+GLTexture.next],ecx ;t.prev.next=t.next
mov ebx,[eax+offs_text_prev]
mov ecx,[eax+offs_text_next]
mov [ebx+offs_text_next],ecx ;t.prev.next=t.next
@@:
cmp dword[eax+GLTexture.next],0 ;if (t.next!=NULL)
cmp dword[eax+offs_text_next],0 ;if (t.next!=NULL)
je @f
mov ebx,[eax+GLTexture.next]
mov ecx,[eax+GLTexture.prev]
mov [ebx+GLTexture.prev],ecx ;t.next.prev=t.prev
mov ebx,[eax+offs_text_next]
mov ecx,[eax+offs_text_prev]
mov [ebx+offs_text_prev],ecx ;t.next.prev=t.prev
@@:
xor ebx,ebx
mov ecx,[eax+GLTexture.images] ;im=&t.images[0]
mov ecx,[eax+offs_text_images] ;im=&t.images[0]
.cycle_0: ;for(i=0;i<MAX_TEXTURE_LEVELS;i++)
cmp ebx,MAX_TEXTURE_LEVELS
jge .cycle_0_end
cmp dword[ecx+GLImage.pixmap],0 ;if (im.pixmap != NULL)
cmp dword[ecx+offs_imag_pixmap],0 ;if (im.pixmap != NULL)
je @f
stdcall gl_free,[ecx+GLImage.pixmap]
stdcall gl_free,[ecx+offs_imag_pixmap]
@@:
add ecx,sizeof.GLImage
inc ebx
@@ -87,16 +87,16 @@ proc alloc_texture uses ebx ecx, context:dword, h:dword
add ecx,ebx ;ecx = &context.shared_state.texture_hash_table[h % TEXTURE_HASH_TABLE_SIZE]
mov ebx,[ecx]
mov [eax+GLTexture.next],ebx
mov dword[eax+GLTexture.prev],0 ;NULL
cmp dword[eax+GLTexture.next],0 ;NULL
mov [eax+offs_text_next],ebx
mov dword[eax+offs_text_prev],0 ;NULL
cmp dword[eax+offs_text_next],0 ;NULL
je @f
mov [eax+GLTexture.prev],eax
mov [eax+offs_text_prev],eax
@@:
mov [ecx],eax
mov ebx,[h]
mov [eax+GLTexture.handle],ebx
mov [eax+offs_text_handle],ebx
ret
endp
@@ -129,11 +129,11 @@ proc glGenTextures uses eax ebx ecx edx esi, n:dword, textures:dword
.cycle_1: ;while (t!=NULL)
or edx,edx
jz .cycle_1_end
cmp [edx+GLTexture.handle],ebx ;if (t.handle>max)
cmp [edx+offs_text_handle],ebx ;if (t.handle>max)
jle @f
mov ebx,[edx+GLTexture.handle] ;max=t.handle
mov ebx,[edx+offs_text_handle] ;max=t.handle
@@:
mov edx,[edx+GLTexture.next] ;t=t.next
mov edx,[edx+offs_text_next] ;t=t.next
jmp .cycle_1
.cycle_1_end:
inc ecx
@@ -266,22 +266,22 @@ align 4
mov ecx,[context]
mov ecx,[ecx+GLContext.current_texture]
add ecx,GLTexture.images
add ecx,offs_text_images
imul ebx,sizeof.GLTexture
add ecx,ebx ;ecx = &context.current_texture.images[level]
mov [ecx+GLImage.xsize],edx ;im.xsize=width
mov [ecx+GLImage.ysize],esi ;im.ysize=height
mov [ecx+offs_imag_xsize],edx ;im.xsize=width
mov [ecx+offs_imag_ysize],esi ;im.ysize=height
mov ebx,edx
dec ebx
shl ebx,ZB_POINT_TEXEL_SIZE
mov [ecx+GLImage.s_bound],ebx ;im.s_bound = (unsigned int)(width-1)
mov [ecx+offs_imag_s_bound],ebx ;im.s_bound = (unsigned int)(width-1)
shr ebx,ZB_POINT_TEXEL_SIZE
mov dword[ecx+GLImage.xsize_log2],ZB_POINT_TEXEL_SIZE
mov dword[ecx+offs_imag_xsize_log2],ZB_POINT_TEXEL_SIZE
or ebx,ebx
jz .set_l2
@@:
dec dword[ecx+GLImage.xsize_log2]
dec dword[ecx+offs_imag_xsize_log2]
shr ebx,1
or ebx,ebx
jnz @b
@@ -289,18 +289,18 @@ align 4
;im.xsize_log2 = ZB_POINT_TEXEL_SIZE-log_2(width)
dec esi
shl esi,ZB_POINT_TEXEL_SIZE
mov [ecx+GLImage.t_bound],esi ;im.t_bound = (unsigned int)(height-1)
mov [ecx+offs_imag_t_bound],esi ;im.t_bound = (unsigned int)(height-1)
shr esi,ZB_POINT_TEXEL_SIZE
inc esi
cmp dword[ecx+GLImage.pixmap],0 ;if (im.pixmap!=NULL)
cmp dword[ecx+offs_imag_pixmap],0 ;if (im.pixmap!=NULL)
je @f
stdcall gl_free, [ecx+GLImage.pixmap]
stdcall gl_free, [ecx+offs_imag_pixmap]
@@:
if TGL_FEATURE_RENDER_BITS eq 24
imul edx,esi
imul edx,3
stdcall gl_malloc,edx
mov [ecx+GLImage.pixmap],eax ;im.pixmap = gl_malloc(width*height*3)
mov [ecx+offs_imag_pixmap],eax ;im.pixmap = gl_malloc(width*height*3)
or eax,eax ;if(im.pixmap)
jz @f
mov edi,eax
@@ -314,7 +314,7 @@ if TGL_FEATURE_RENDER_BITS eq 32
imul edx,esi
shl edx,2
stdcall gl_malloc,edx
mov [ecx+GLImage.pixmap],eax ;im.pixmap = gl_malloc(width*height*4)
mov [ecx+offs_imag_pixmap],eax ;im.pixmap = gl_malloc(width*height*4)
or eax,eax ;if(im.pixmap)
jz @f
;gl_convertRGB_to_8A8R8G8B(eax,[pixels1],ebx,esi)

View File

@@ -86,14 +86,14 @@ endl
fdiv st0,st1 ;st0 = 0.5
fild dword[eax+GLViewport.xsize]
fsub dword[fl_1e_3]
fsub st0,st1
fdiv st0,st2
fst dword[eax+GLViewport.scale+offs_X]
fiadd dword[eax+GLViewport.xmin]
fstp dword[eax+GLViewport.trans+offs_X]
fild dword[eax+GLViewport.ysize]
fsub dword[fl_1e_3]
fsub st0,st1
fdiv st0,st2
fchs
fst dword[eax+GLViewport.scale+offs_Y]
@@ -134,13 +134,21 @@ endl
cmp dword[edx+GLContext.lighting_enabled],0 ;if(context.lighting_enabled)
jne .if_0
cmp dword[edx+GLContext.texture_2d_enabled],0
je @f
cmp dword[eax+GLContext.texture_2d_enabled],0
jne .if_0
jmp @f
align 4
.if_0:
if DEBUG ;context.matrix_stack_ptr[0]
stdcall gl_print_matrix,dword[edx+GLContext.matrix_stack_ptr],4
end if
; precompute inverse modelview
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
stdcall gl_print_matrix,ebx,4
end if
push ebx
lea ebx,[edx+GLContext.matrix_model_view_inv]
stdcall gl_M4_Transpose, ebx
@@ -245,7 +253,8 @@ pushad
cmp dword[eax+GLContext.lighting_enabled],0 ;if (context.lighting_enabled)
jne @f
cmp dword[eax+GLContext.texture_2d_enabled],0
je .els_0
jne @f
jmp .els_0
align 4
@@:
; eye coordinates needed for lighting

View File

@@ -51,11 +51,16 @@ struct GLSpecBuf
next dd ? ;struct GLSpecBuf*
ends
offs_spec_shininess_i equ 0
offs_spec_last_used equ 4
offs_spec_buf equ 8
offs_spec_next equ 8+4*(SPECULAR_BUFFER_SIZE+1)
struct GLLight
ambient V4
diffuse V4
ambient V4
diffuse V4
specular V4
position V4
position V4
spot_direction V3
spot_exponent dd ? ;float
spot_cutoff dd ? ;float
@@ -97,6 +102,9 @@ struct GLParamBuffer
next dd ? ;struct GLParamBuffer*
ends
offs_gpbu_ops equ 0
offs_gpbu_next equ 4*OP_BUFFER_MAX_SIZE
struct GLList
first_op_buffer dd ? ;GLParamBuffer*
; TODO: extensions for an hash table or a better allocating scheme
@@ -125,17 +133,29 @@ struct GLImage
t_bound dd ? ;unsigned int
ends
offs_imag_pixmap equ 0
offs_imag_xsize equ 4
offs_imag_ysize equ 8
offs_imag_xsize_log2 equ 12
offs_imag_s_bound equ 16
offs_imag_t_bound equ 20
; textures
TEXTURE_HASH_TABLE_SIZE equ 256 ;должно быть кратное 2, в коде берется остаток от деления (через and быстрее чем div)
struct GLTexture
images rd (sizeof.GLImage * MAX_TEXTURE_LEVELS)/4 ;GLImage[MAX_TEXTURE_LEVELS]
images rb sizeof.GLImage * MAX_TEXTURE_LEVELS ;GLImage[MAX_TEXTURE_LEVELS]
handle dd ? ;int
next dd ? ;struct GLTexture*
prev dd ? ;struct GLTexture*
ends
offs_text_images equ 0
offs_text_handle equ sizeof.GLImage*MAX_TEXTURE_LEVELS
offs_text_next equ 4+offs_text_handle
offs_text_prev equ 8+offs_text_handle
; shared state
struct GLSharedState

View File

@@ -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]
jb .end_f
jl .end_f
if TGL_FEATURE_RENDER_BITS eq 24
mov eax,[ebx+ZBufferPoint.r]
mov byte[edx],ah

View File

@@ -101,7 +101,7 @@ local .end_0
mov [zz],eax
mov ebx,[pz]
cmp ax,word[ebx]
jb .end_0
jl .end_0
RGBPIXEL
mov eax,dword[zz]
mov ebx,[pz]
@@ -114,7 +114,9 @@ end if
macro DRAWLINE d_x,d_y,inc_1,inc_2
{
local .mz_0
local .mz_1
local .mz_2
mov eax,d_x
mov [n],eax
@@ -122,12 +124,26 @@ if INTERP_Z eq 1
mov ebx,[p1]
mov eax,[p2]
mov eax,[eax+ZBufferPoint.z]
cmp eax,[ebx+ZBufferPoint.z]
jg .mz_0
je .mz_1
;if(p2.z<p1.z)
sub eax,[ebx+ZBufferPoint.z]
neg eax
inc eax
xor edx,edx
div dword[n]
neg eax
inc eax
jmp .mz_2
.mz_0:
sub eax,[ebx+ZBufferPoint.z]
jz .mz_1
;if(p2.z!=p1.z)
cdq
idiv dword[n]
xor edx,edx
div dword[n]
jmp .mz_2
.mz_1:
xor eax,eax
.mz_2:
mov [zinc],eax ;zinc=(p2.z-p1.z)/n
end if
shl dword d_y,1

View File

@@ -102,7 +102,7 @@ local .end_0
mov [zz],eax
mov ebx,[pz]
cmp ax,word[ebx]
jb .end_0
jl .end_0
RGBPIXEL
mov eax,dword[zz]
mov ebx,[pz]
@@ -115,10 +115,18 @@ end if
macro DRAWLINE d_x,d_y,inc_1,inc_2
{
local .mz_0
local .mz_1
local .mz_2
local .mr_0
local .mr_1
local .mr_2
local .mg_0
local .mg_1
local .mg_2
local .mb_0
local .mb_1
local .mb_2
mov eax,d_x
mov [n],eax
@@ -127,44 +135,103 @@ local .mb_1
mov ecx,[p2]
if INTERP_Z eq 1
mov eax,[ecx+ZBufferPoint.z]
cmp eax,[ebx+ZBufferPoint.z]
jg .mz_0
je .mz_1
;if(p2.z<p1.z)
sub eax,[ebx+ZBufferPoint.z]
neg eax
inc eax
xor edx,edx
div dword[n]
neg eax
inc eax
jmp .mz_2
.mz_0:
sub eax,[ebx+ZBufferPoint.z]
jz .mz_1
;if(p2.z!=p1.z)
cdq
idiv dword[n]
xor edx,edx
div dword[n]
jmp .mz_2
.mz_1:
xor eax,eax
.mz_2:
mov [zinc],eax ;zinc=(p2.z-p1.z)/n
end if
;ebx=&p1, ecx=&p2
mov eax,[ecx+ZBufferPoint.r]
sub eax,[ebx+ZBufferPoint.r]
jz .mr_1
;if(p2.r!=p1.r)
cmp eax,[ebx+ZBufferPoint.r]
jg .mr_0
je .mr_1
;if(p2.r<p1.r)
sub eax,[ebx+ZBufferPoint.r]
neg eax
inc eax
shl eax,8
cdq
idiv dword[n]
xor edx,edx
div dword[n]
neg eax
inc eax
jmp .mr_2
.mr_0:
sub eax,[ebx+ZBufferPoint.r]
shl eax,8
xor edx,edx
div dword[n]
jmp .mr_2
.mr_1:
xor eax,eax
.mr_2:
mov [rinc],eax ;rinc=((p2.r-p1.r)<<8)/n
mov eax,[ecx+ZBufferPoint.g]
sub eax,[ebx+ZBufferPoint.g]
jz .mg_1
;if(p2.g!=p1.g)
cmp eax,[ebx+ZBufferPoint.g]
jg .mg_0
je .mg_1
;if(p2.g<p1.g)
sub eax,[ebx+ZBufferPoint.g]
neg eax
inc eax
shl eax,8
cdq
idiv dword[n]
xor edx,edx
div dword[n]
neg eax
inc eax
jmp .mg_2
.mg_0:
sub eax,[ebx+ZBufferPoint.g]
shl eax,8
xor edx,edx
div dword[n]
jmp .mg_2
.mg_1:
xor eax,eax
.mg_2:
mov [ginc],eax ;ginc=((p2.g-p1.g)<<8)/n
mov eax,[ecx+ZBufferPoint.b]
sub eax,[ebx+ZBufferPoint.b]
jz .mb_1
;if(p2.b!=p1.b)
cmp eax,[ebx+ZBufferPoint.b]
jg .mb_0
je .mb_1
;if(p2.b<p1.b)
sub eax,[ebx+ZBufferPoint.b]
neg eax
inc eax
shl eax,8
cdq
idiv dword[n]
xor edx,edx
div dword[n]
neg eax
inc eax
jmp .mb_2
.mb_0:
sub eax,[ebx+ZBufferPoint.b]
shl eax,8
xor edx,edx
div dword[n]
jmp .mb_2
.mb_1:
xor eax,eax
.mb_2:
mov [binc],eax ;binc=((p2.b-p1.b)<<8)/n
shl dword d_y,1

View File

@@ -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])
jb .end_0
jl .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])
jb .end_0
jl .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])
jb .end_0
jl .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])
jb .end_0
jl .end_0
;edi = pp
mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
if TGL_FEATURE_RENDER_BITS eq 24

View File

@@ -393,9 +393,20 @@ align 4
mov [dx1],eax ;dx1 = l2.x - l1.x
cmp edx,0 ;if (dy1 > 0)
jle .els_3
xor edx,edx
cmp eax,0
jl .otr_dx1
shl eax,16
cdq
idiv dword[dy1] ;eax = (dx1 << 16) / dy1
div dword[dy1] ;eax = (dx1 << 16) / dy1
jmp .end_3
align 4
.otr_dx1:
neg eax
inc eax
shl eax,16
div dword[dy1] ;eax = (-dx1 << 16) / dy1
neg eax
inc eax
jmp .end_3
align 4
.els_3:
@@ -494,6 +505,7 @@ end if
.end_upd_l:
; compute values for the right edge
cmp dword[update_right],0 ;if(update_right)
je .end_upd_r
mov ebx,[pr1]
@@ -509,9 +521,20 @@ end if
mov [dy2],edx ;dy2 = pr2.y - pr1.y
cmp edx,0 ;if (dy2 > 0)
jle .els_4
xor edx,edx
cmp eax,0
jl .otr_dx2
shl eax,16
cdq
idiv dword[dy2] ;eax = (dx2 << 16) / dy2
div dword[dy2] ;eax = (dx2 << 16) / dy2
jmp .end_4
align 4
.otr_dx2:
neg eax
inc eax ;dx2 *= -1
shl eax,16
div dword[dy2] ;eax = (-dx2 << 16) / dy2
neg eax
inc eax
jmp .end_4
align 4
.els_4:

View File

@@ -1,117 +0,0 @@
;
; Export functions
;
E_LIB lib_init
E_LIB version
E_LIB edit_box_draw
E_LIB edit_box_key
E_LIB edit_box_key_safe
E_LIB edit_box_mouse
E_LIB edit_box_set_text
E_LIB version_ed
E_LIB init_checkbox, init_checkbox2
E_LIB check_box_draw, check_box_draw2
E_LIB check_box_mouse, check_box_mouse2
E_LIB version_ch, version_ch2
E_LIB option_box_draw
E_LIB option_box_mouse
E_LIB version_op
E_LIB scrollbar_v_draw
E_LIB scrollbar_v_mouse
E_LIB scrollbar_h_draw
E_LIB scrollbar_h_mouse
E_LIB version_scrollbar
E_LIB dbutton_draw
E_LIB dbutton_mouse
E_LIB version_dbutton
E_LIB menu_bar_draw
E_LIB menu_bar_mouse
E_LIB menu_bar_activate
E_LIB version_menu_bar
E_LIB FileBrowser_draw
E_LIB FileBrowser_mouse
E_LIB FileBrowser_key
E_LIB version_FileBrowser
E_LIB tl_data_init
E_LIB tl_data_clear
E_LIB tl_info_clear
E_LIB tl_key
E_LIB tl_mouse
E_LIB tl_draw
E_LIB tl_info_undo
E_LIB tl_info_redo
E_LIB tl_node_add
E_LIB tl_node_set_data
E_LIB tl_node_get_data
E_LIB tl_node_delete
E_LIB tl_cur_beg
E_LIB tl_cur_next
E_LIB tl_cur_perv
E_LIB tl_node_close_open
E_LIB tl_node_lev_inc
E_LIB tl_node_lev_dec
E_LIB tl_node_move_up
E_LIB tl_node_move_down
E_LIB tl_node_poi_get_info
E_LIB tl_node_poi_get_next_info
E_LIB tl_node_poi_get_data
E_LIB tl_save_mem
E_LIB tl_load_mem
E_LIB tl_get_mem_size
E_LIB version_tree_list
E_LIB PathShow_prepare
E_LIB PathShow_draw
E_LIB version_PathShow
E_LIB ted_but_sumb_upper
E_LIB ted_but_sumb_lover
E_LIB ted_but_convert_by_table
E_LIB ted_can_save
E_LIB ted_clear
E_LIB ted_delete
E_LIB ted_draw
E_LIB ted_init
E_LIB ted_init_scroll_bars
E_LIB ted_init_syntax_file
E_LIB ted_is_select
E_LIB ted_key
E_LIB ted_mouse
E_LIB ted_open_file
E_LIB ted_save_file
E_LIB ted_text_add
E_LIB ted_but_select_word
E_LIB ted_but_cut
E_LIB ted_but_copy
E_LIB ted_but_paste
E_LIB ted_but_undo
E_LIB ted_but_redo
E_LIB ted_but_reverse
E_LIB ted_but_find
E_LIB ted_but_replace
E_LIB ted_text_colored
E_LIB ted_go_to_position
E_LIB version_text_edit
E_LIB frame_draw
E_LIB version_frame
E_LIB progressbar_draw
E_LIB progressbar_progress
E_LIB tooltip_init
E_LIB tooltip_delete
E_LIB tooltip_test_show
E_LIB tooltip_mouse
E_LIB get_font_size
purge E_LIB

View File

@@ -1,24 +0,0 @@
align 4
import_box_lib:
macro E_LIB n, lfn
{
if n eq lib_init
dd strz_#n
else if defined sz_#n
n dd sz_#n
end if
}
include 'export.inc'
dd 0,0
macro E_LIB n, lfn
{
if used n
if lfn eq
sz_#n db `n,0
else
sz_#n db `lfn,0
end if
end if
}
include 'export.inc'

View File

@@ -170,7 +170,6 @@ proc tl_key uses ebx ecx edi, tlist:dword
cmp tl_on_press,0
je @f
call tl_on_press
jmp .no_edit
@@:
cmp ah,byte[ecx+1] ;Space
jne @f

View File

@@ -1,48 +0,0 @@
;
; Export functions
;
E_LIB lib_init
E_LIB buf2d_create
E_LIB buf2d_create_f_img
E_LIB buf2d_clear
E_LIB buf2d_draw
E_LIB buf2d_delete
E_LIB buf2d_resize
E_LIB buf2d_rotate
E_LIB buf2d_line
E_LIB buf2d_line_sm
E_LIB buf2d_rect_by_size
E_LIB buf2d_filled_rect_by_size
E_LIB buf2d_circle
E_LIB buf2d_img_hdiv2
E_LIB buf2d_img_wdiv2
E_LIB buf2d_conv_24_to_8
E_LIB buf2d_conv_24_to_32
E_LIB buf2d_bit_blt
E_LIB buf2d_bit_blt_transp
E_LIB buf2d_bit_blt_alpha
E_LIB buf2d_curve_bezier
E_LIB buf2d_convert_text_matrix
E_LIB buf2d_draw_text
E_LIB buf2d_crop_color
E_LIB buf2d_offset_h
E_LIB buf2d_flood_fill
E_LIB buf2d_set_pixel
E_LIB buf2d_get_pixel
E_LIB buf2d_flip_h
E_LIB buf2d_flip_v
E_LIB buf2d_filter_dither
E_LIB buf2d_vox_brush_create
E_LIB buf2d_vox_brush_delete
E_LIB buf2d_vox_obj_get_img_w_3g
E_LIB buf2d_vox_obj_get_img_h_3g
E_LIB buf2d_vox_obj_draw_1g
E_LIB buf2d_vox_obj_draw_3g
E_LIB buf2d_vox_obj_draw_3g_scaled
E_LIB buf2d_vox_obj_draw_pl
E_LIB buf2d_vox_obj_draw_pl_scaled
E_LIB buf2d_vox_obj_draw_3g_shadows
purge E_LIB

View File

@@ -1,20 +0,0 @@
align 4
import_buf2d:
macro E_LIB n
{
if n eq lib_init
dd strz_#n
else if defined sz_#n
n dd sz_#n
end if
}
include 'export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include 'export.inc'

View File

@@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2025. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2004-2020. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; HTTP library for KolibriOS ;;
@@ -2021,15 +2021,15 @@ str_head db 'HEAD ', 0
str_post db 'POST ', 0
bits_must_escape:
; bit 31 <======== ========> bit 0 ; bit 0 ===> bit 31
dd 0xffffffff ;00-1F
dd 11111100_00000000_10011111_11111111b ; !"#$%&'()*+,/:;<=>?
dd 01111000_00000000_00000000_00000001b ;@[\]^
dd 10111000_00000000_00000000_00000001b ;`{|} DEL
dd 0xffffffff ;80-9F
dd 0xffffffff ;A0-BF
dd 0xffffffff ;C0-DF
dd 0xffffffff ;E0-FF
dd 0xffffffff ; 00-1F
dd 1 shl 0 + 1 shl 2 + 1 shl 3 + 1 shl 5 + 1 shl 28 + 1 shl 30 ; "#%<>
dd 1 shl 27 + 1 shl 28 + 1 shl 29 + 1 shl 30 ;[\]^
dd 1 shl 0 + 1 shl 27 + 1 shl 28 + 1 shl 29 + 1 shl 31 ;`{|} DEL
dd 0xffffffff
dd 0xffffffff
dd 0xffffffff
dd 0xffffffff
str_hex:
db '0123456789ABCDEF'

View File

@@ -1,34 +0,0 @@
;
; Export functions
;
E_LIB lib_init
E_LIB version
E_LIB img_is_img
E_LIB img_info
E_LIB img_from_file
E_LIB img_to_file
E_LIB img_from_rgb
E_LIB img_to_rgb
E_LIB img_to_rgb2
E_LIB img_decode
E_LIB img_encode ;supported formats: PNG 24 32, BMP 24 32, PNM 1 8g 24
E_LIB img_create
E_LIB img_destroy
E_LIB img_destroy_layer
E_LIB img_count
E_LIB img_lock_bits
E_LIB img_unlock_bits
E_LIB img_flip
E_LIB img_flip_layer
E_LIB img_rotate
E_LIB img_rotate_layer
E_LIB img_draw
E_LIB img_scale
E_LIB img_get_scaled_size
E_LIB img_convert
E_LIB img_blend
E_LIB img_resize_data
E_LIB img_formats_table
purge E_LIB

View File

@@ -1,20 +0,0 @@
align 4
import_libimg:
macro E_LIB n
{
if n eq lib_init
dd strz_#n
else if defined sz_#n
n dd sz_#n
end if
}
include 'export.inc'
dd 0,0
macro E_LIB n
{
if used n
sz_#n db `n,0
end if
}
include 'export.inc'

View File

@@ -13,7 +13,7 @@ sz app_board ,'/sys/develop/board',0
sz app_tinypad ,'/sys/tinypad',0
sz app_docpak ,'/sys/docpack',0
sz sysfuncs_param,'e',0
sz sysfuncs_param,'f',0
include 'tp-tables.inc'
include 'tp-locale.inc'

View File

@@ -23,9 +23,6 @@ library_fun_memory_free equ mem_free
library_fun_memory_realloc equ mem_realloc
library_fun_dll_load equ dll_load
align 4
strz_lib_init db 'lib_init',0
align 4
arrea_xx dd 0
file_name db '/sys/@notify',0
@@ -217,7 +214,7 @@ end if
jmp i_error
align 4
i_begin:
import_some_library myimport
import_boxlib myimport
test eax,eax
jz i_exit
i_error:
@@ -237,13 +234,13 @@ macro load_library library_name__, library_path__, system_path__, myimport, poin
local i_begin
local i_error
local i_exit
push ebx
if point_dir_name__ eq
copy_path library_name__, [32], library_path__,0
else
;the macros making way /current path a program/ + name system library
copy_path library_name__, [32], library_path__,point_dir_name__
end if
push ebx
mcall SF_SYS_MISC,SSF_LOAD_DLL,library_path__ ; load of alternative
test eax,eax
jnz i_begin
@@ -254,7 +251,7 @@ end if
jmp i_error
align 4
i_begin:
import_some_library myimport
import_boxlib myimport
test eax,eax
jz i_exit
i_error:
@@ -312,7 +309,7 @@ align 4
align 4
end_steep:
mov adr_load_lib,eax ;save adr lib in memory
import_some_library my_import
import_boxlib my_import
test eax,eax
jz cycle0n
or status_lib,2 ; status of code - enable error - import error
@@ -390,7 +387,7 @@ align 4
align 4
end_steep:
mov adr_load_lib,eax ;save adr lib in memory
import_some_library my_import
import_boxlib my_import
test eax,eax
jz cycle0n
or status_lib,2 ; status of code - enable error - import error
@@ -454,7 +451,7 @@ pop ebx eax
;output:
; eax - <20>᫨ 㤠筮 <20><> 0 <20><><EFBFBD><><E3AAA0><EFBFBD> <20><> <20><><EFBFBD> <20>㭪樨 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><><E3A4A0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E3A7A8>
; ebx - ࠧ<><E0A0A7><EFBFBD><E8A0A5><EFBFBD>
macro import_some_library myimport
macro import_boxlib myimport
{
local import_loop
local import_find

View File

@@ -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> 14.04.25',0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
caption db '<27><><EFBFBD><EFBFBD><E1ACAE> <20><><EFBFBD><EFBFBD><E1A5AB> 11.11.20',0 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
else ; Default to en_US
caption db 'Voxel viewer 14.04.25',0
caption db 'Voxel viewer 11.11.20',0
end if
3d_wnd_l equ 5 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> tinygl <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1ABA5>
@@ -750,8 +750,12 @@ 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.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 [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 [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

View File

@@ -105,6 +105,7 @@ console: ;//////////////////////////////////////////////////////////////////////
mov eax, [esp+36]
call write_to_file
@@:
popad
ret 4

View File

@@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2013-2025. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2013-2021. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; ftpc.asm - FTP client for KolibriOS ;;
@@ -36,8 +36,8 @@ use32
dd 1 ; header version
dd start ; entry point
dd i_end ; initialized size
dd mem ; required memory
dd stacktop ; stack pointer
dd mem+0x1000 ; required memory
dd mem+0x1000 ; stack pointer
dd buf_cmd ; parameters
dd path ; path
@@ -83,12 +83,12 @@ start: ;////////////////////////////////////////////////////////////////////////
;< none ;;
;;================================================================================================;;
; initialize heap for using dynamic blocks
mcall SF_SYS_MISC, SSF_HEAP_INIT
mcall 68, 11
test eax, eax
je exit2
; disable all events except network event
mcall SF_SET_EVENTS_MASK, EV_STACK
mcall 40, EV_STACK
; load libraries
stdcall dll.Load, @IMPORT
test eax, eax
@@ -125,16 +125,16 @@ start: ;////////////////////////////////////////////////////////////////////////
mov [acti_port_stop], ax
invoke ini.get_str, path, str_general, str_dir, buf_buffer1, BUFFERSIZE, 0
mcall SF_CURRENT_FOLDER, SSF_SET_CF, buf_buffer1 ; set working directory
mcall 30, 1, buf_buffer1 ; set working directory
; initialize log file
invoke ini.get_str, path, str_general, str_logfile, log_file, 512, 0
mov [filestruct2.subfn], SSF_CREATE_FILE
mov [filestruct2.subfn], 2
mov [filestruct2.offset], 0
mov [filestruct2.size], 0
mov [filestruct2.ptr], 0
mov [filestruct2.name], log_file
mcall SF_FILE, filestruct2
mcall 70, filestruct2
; Usage: ftpc [-cli] [ftp://username:password@server:port/path]
@@ -355,7 +355,7 @@ wait_for_servercommand: ;///////////////////////////////////////////////////////
; receive socket data with timeout
.receive:
mcall SF_SYSTEM_GET, SSF_TIME_COUNT
mcall 26, 9
add eax, TIMEOUT*100
mov [timeout], eax
.again:
@@ -365,11 +365,11 @@ wait_for_servercommand: ;///////////////////////////////////////////////////////
je .closed
cmp ebx, EWOULDBLOCK
jne .sock_err
mcall SF_SYSTEM_GET, SSF_TIME_COUNT
mcall 26, 9
mov ebx, [timeout]
sub ebx, eax
jle .timeout
mcall SF_WAIT_EVENT_TIMEOUT ; Wait for event with timeout
mcall 23 ; Wait for event with timeout
jmp .again
.sock_err:
@@ -524,7 +524,7 @@ transfer_queued:
; Error occured, we reached the end of the buffer before [queued] reached 0
mov [queued], 0
mcall SF_SYS_MISC, SSF_MEM_FREE, [ptr_fname] ; free buffer
mcall 68, 13, [ptr_fname] ; free buffer
test eax, eax
jz error_heap
jmp wait_for_usercommand
@@ -535,7 +535,7 @@ transfer_queued:
dec [queued]
jnz cmd_retr
mcall SF_SYS_MISC, SSF_MEM_FREE, [ptr_fname] ; free buffer
mcall 68, 13, [ptr_fname] ; free buffer
test eax, eax
jz error_heap
jmp cmd_retr
@@ -655,12 +655,12 @@ write_to_file: ;////////////////////////////////////////////////////////////////
mov eax, 0
ret
@@:
mov [filestruct2.subfn], SSF_WRITE_FILE
mov [filestruct2.subfn], 3
m2m [filestruct2.offset], [logfile_offset]
mov [filestruct2.size], ecx
mov [filestruct2.ptr], eax
mov [filestruct2.name], log_file
mcall SF_FILE, filestruct2
mcall 70, filestruct2
test eax, eax
jz @f
mov [logfile_offset], -1 ; disable logging
@@ -754,13 +754,13 @@ wait_for_keypress:
exit:
mcall close, [controlsocket]
exit2:
mcall SF_TERMINATE_PROCESS
mcall -1
; data
str_title db 'FTP client for KolibriOS',0
str_welcome db 'FTP client for KolibriOS v0.18',10
str_welcome db 'FTP client for KolibriOS v0.16',10
db 10,0
str_srv_addr db 'Please enter ftp server address.',10,0
@@ -971,7 +971,6 @@ param_path rb 1024
param_port rb 6
sc system_colors
align 16
rb 4096
stacktop:
rb 1024
mem:

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 640 B

View File

@@ -7,9 +7,6 @@ include '../../load_lib.mac'
icon_tl_sys dd 0
icon_tl_nod dd 0
icon_buttons dd 0
lbl_after_enter dd 0
show_log db 0 ; 0 - hide log, 1 - show log
TLIST_SZ = 325+16 ;=341. 16 is x-size of scroll bar
TLIST1_X = 50
@@ -18,9 +15,6 @@ BT_SZ_X = 40
SYS_COL = 0xe6e6e6
BT_COL = 0xcccccc
STR_COL = 0x595959 ;0x000000
ICON_TOP_B = 2 ; top border
ICON_LEFT_B = 2 ; left border
ICON_SIZE = (18+ICON_LEFT_B)*(18+ICON_TOP_B)*3
; TODO: automatic resizing of GUI elements on window resizing
@@ -51,8 +45,8 @@ gui: ;//////////////////////////////////////////////////////////////////////////
test eax, eax
jnz .exit
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
mcall SF_SET_EVENTS_MASK, 0xC0000027 ; set event mask
mcall 48, 3, sc, sizeof.system_colors
mcall 40, 0xC0000027 ; set event mask
ret
.server_addr:
@@ -79,42 +73,37 @@ gui: ;//////////////////////////////////////////////////////////////////////////
; initialize tree list elements
stdcall [tl_data_init], tree1
stdcall [tl_data_init], tree2
or dword[tree1.style], 8 ;tl_cursor_pos_limited - restrict cursor move to existing nodes
or dword[tree2.style], 8 ;tl_cursor_pos_limited
or dword[tree1.style], 8 ;tl_cursor_pos_limited - restrict cursor move to existing nodes
or dword[tree2.style], 8 ;tl_cursor_pos_limited
; read icons
mcall SF_SYS_MISC, SSF_MEM_OPEN, str_icon_18,, 0
or eax, eax
jz @f
mov esi, eax
mov ecx, ICON_SIZE*11
mcall SF_SYS_MISC, SSF_MEM_ALLOC
mov ecx, eax
mov [icon_tl_sys], eax
stdcall copy_icon, eax,esi,31 ;active cursor
add eax, ICON_SIZE*3 ;skip not used icons
stdcall img_to_gray, ecx, eax, ICON_SIZE/3 ;not active cursor
load_image_file 'ftpc_sys.png', icon_tl_sys
mov [filestruct.ptr], eax
mov [filestruct.subfn], 0
mov [filestruct.offset], 54
mov [filestruct.size], ecx
mcall 70, filestruct
cmp ebx, 0
jl @f
m2m dword[tree1.data_img_sys], dword[icon_tl_sys]
m2m dword[tree2.data_img_sys], dword[icon_tl_sys]
@@:
; read nodes icon file
mov ecx, ICON_SIZE*2
mcall SF_SYS_MISC, SSF_MEM_ALLOC
mov [icon_tl_nod], eax
stdcall copy_icon, eax,esi,2
stdcall copy_icon, eax,esi,0
load_image_file 'ftpc_nod.png', icon_tl_nod
mov [filestruct.ptr], eax
;mov [filestruct.subfn], 0
;mov [filestruct.offset], 54
mov [filestruct.size], ecx
mcall 70, filestruct
cmp ebx, 0
jl @f
m2m dword[tree1.data_img], dword[icon_tl_nod]
m2m dword[tree2.data_img], dword[icon_tl_nod]
; initialize icon buttons
mov ecx, 18*18*4*2
mcall SF_SYS_MISC, SSF_MEM_ALLOC
mov [icon_buttons], eax
stdcall copy_icon_w, eax,esi, 4 ;disconnect
stdcall copy_icon_w, eax,esi,49 ;search
@@:
call .draw
; create initial tree list for root_dir
@@ -128,11 +117,11 @@ gui: ;//////////////////////////////////////////////////////////////////////////
jmp cmd_list
.redraw:
call .draw
call .draw
align 4
.still:
mcall SF_WAIT_EVENT
mcall 10
dec eax
jz .redraw
@@ -157,86 +146,65 @@ gui: ;//////////////////////////////////////////////////////////////////////////
align 4
.draw:
mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall 12, 1
; main window
mcall SF_CREATE_WINDOW, <35,830>, <20,555-160>, 0x34000000+SYS_COL, 0x805080DD, str_title
mcall 0, <35,830>, <20,555>, 0x34000000+SYS_COL, 0x805080DD, str_title
;-------------------------
; textedit components
;-------------------------
mcall SF_THREAD_INFO, procinfo, -1
mcall 9, procinfo, -1
mov edi, tedit0
call EvSize
movzx ebx,word[procinfo.client_box.width]
inc bx
mcall SF_DRAW_RECT, , ted_wnd_t
mcall 13, , ted_wnd_t
stdcall [ted_draw], tedit0
; draw "disconnect" button
mcall SF_DEFINE_BUTTON, <50,114>, <25,25>, 3, BT_COL
; icon
mcall SF_PUT_IMAGE_EXT, [icon_buttons], <18, 18>, <54, 29>, 32,, 0
mcall 8, <50,95>, <25,25>, 3, BT_COL
; string "disconnect"
mcall SF_DRAW_TEXT, <50+18+10,25+5>, 0xb0000000+STR_COL, str_disconnect
; draw "Show|Hide log" button
mcall SF_DEFINE_BUTTON, <50,79>, <326,25>, 10, BT_COL
; string "Show|Hide log"
cmp [show_log],0
je @f
stdcall [ted_draw], tedit0
mov edx, str_hide_log
jmp .end_log_1
@@:
mov edx, str_show_log
.end_log_1:
mcall SF_DRAW_TEXT, <50+5,326+5>, 0xb0000000+STR_COL
cmp [show_log],0
je @f
mcall 4, <50+5,25+5>, 0xb0000000+STR_COL, str_disconnect
; draw "Copy" button
mcall SF_DEFINE_BUTTON, <129+5,40>, <326,25>, 4, BT_COL
mcall 8, <50,40>, <326,25>, 4, BT_COL
; string "copy"
mcall SF_DRAW_TEXT, <129+10,326+5>, 0xb0000000+STR_COL, str_copy
@@:
mcall 4, <50+5,326+5>, 0xb0000000+STR_COL, str_copy
; draw "Search" button
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-25,25>, <20,25>, 5, BT_COL
; icon
mov ebx, [icon_buttons]
add ebx, 18*18*4
mcall SF_PUT_IMAGE_EXT,, <18, 18>, <730, 24>, 32,, 0
mcall 8, <TLIST2_X+TLIST_SZ-55,55>, <20,25>, 5, BT_COL
; string "Search"
;mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-55+5,20+5>, 0xb0000000+STR_COL, str_search
mcall 4, <TLIST2_X+TLIST_SZ-55+5,20+5>, 0xb0000000+STR_COL, str_search
; draw "LIST" button
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15,BT_SZ_X>, <50,25>, 12, BT_COL
mcall 8, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15,BT_SZ_X>, <50,25>, 12, BT_COL
; string "LIST"
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15+5,50+5>, 0xb0000000+STR_COL, str_list
mcall 4, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15+5,50+5>, 0xb0000000+STR_COL, str_list
; draw "DELE" button
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10,BT_SZ_X>, <50,25>, 7, BT_COL
mcall 8, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10,BT_SZ_X>, <50,25>, 7, BT_COL
; string "DELE"
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10+5,50+5>, 0xb0000000+STR_COL, str_dele
mcall 4, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10+5,50+5>, 0xb0000000+STR_COL, str_dele
; draw "RDIR" button
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5,BT_SZ_X>, <50,25>, 8, BT_COL
mcall 8, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5,BT_SZ_X>, <50,25>, 8, BT_COL
; string "RDIR"
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5+5,50+5>, 0xb0000000+STR_COL, str_rdir
mcall 4, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5+5,50+5>, 0xb0000000+STR_COL, str_rdir
; draw "RMD" button
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <50,25>, 9, BT_COL
mcall 8, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <50,25>, 9, BT_COL
; string "RMD"
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,50+5>, 0xb0000000+STR_COL, str_rmd
mcall 4, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,50+5>, 0xb0000000+STR_COL, str_rmd
; draw "mkd" button
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <80,20>, 6, BT_COL
mcall 8, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <80,20>, 6, BT_COL
; string "mkd"
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,80+5>, 0xb0000000+STR_COL, str_mkd
mcall 4, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,80+5>, 0xb0000000+STR_COL, str_mkd
; draw "cancel" button
;mcall SF_DEFINE_BUTTON, <555,55>, <308,25>, 10, BT_COL
;mcall 8, <555,55>, <308,25>, 10, BT_COL
; string "Cancel"
;mcall SF_DRAW_TEXT, <555+5,308+5>, 0xb0000000+STR_COL, str_abort
;mcall 4, <555+5,308+5>, 0xb0000000+STR_COL, str_abort
; draw "change volume" button
mcall SF_DEFINE_BUTTON, <TLIST1_X+TLIST_SZ-55,55>, <100-20,22>, 11, BT_COL
mcall 8, <TLIST1_X+TLIST_SZ-55,55>, <100-20,22>, 11, BT_COL
; string "Change"
mcall SF_DRAW_TEXT, <TLIST1_X+TLIST_SZ-55+5,100-20+5>, 0xb0000000+STR_COL, str_change
mcall 4, <TLIST1_X+TLIST_SZ-55+5,100-20+5>, 0xb0000000+STR_COL, str_change
;--------------------------
; tree list components
@@ -254,12 +222,12 @@ gui: ;//////////////////////////////////////////////////////////////////////////
stdcall [edit_box_draw], edit_volume
stdcall [edit_box_draw], edit_search
mcall SF_REDRAW, SSF_END_DRAW
mcall 12,2
ret
align 16
.mouse:
mcall SF_MOUSE_GET, SSF_WINDOW_POSITION
mcall 37, 1
cmp word[tedit0.wnd.top], ax
jg .no_edit
@@ -267,7 +235,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
cmp word[tedit0.wnd.left], ax
jg .no_edit
mcall SF_MOUSE_GET, SSF_BUTTON_EXT
mcall 37, 3
bt eax, 24
jnc @f
@@ -275,19 +243,12 @@ gui: ;//////////////////////////////////////////////////////////////////////////
jmp .still
@@:
cmp [show_log],0
je .still
stdcall [ted_mouse], tedit0
jmp .still
.no_edit:
mov [lbl_after_enter], 0
stdcall [tl_mouse], tree1
stdcall [tl_mouse], tree2
cmp [lbl_after_enter], 0
jz @f
jmp [lbl_after_enter]
@@:
stdcall [edit_box_mouse], edit_mkd
stdcall [edit_box_mouse], edit_volume
stdcall [edit_box_mouse], edit_search
@@ -295,14 +256,9 @@ gui: ;//////////////////////////////////////////////////////////////////////////
align 16
.key:
mcall SF_GET_KEY
mov [lbl_after_enter], 0
mcall 2
stdcall [tl_key], tree1
stdcall [tl_key], tree2
cmp [lbl_after_enter], 0
jz @f
jmp [lbl_after_enter]
@@:
stdcall [edit_box_key], edit_mkd
stdcall [edit_box_key], edit_volume
stdcall [edit_box_key], edit_search
@@ -310,19 +266,13 @@ gui: ;//////////////////////////////////////////////////////////////////////////
align 16
.button:
mcall SF_GET_BUTTON
mcall 17
cmp ah, 3
jne @f
ijmp eax, interface_addr, interface.server_addr
jmp .still
@@:
cmp ah, 10
jne @f
call show_hide_log
jmp .still
@@:
cmp ah, 4
jne @f
@@ -360,7 +310,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
@@:
cmp ah, 1
je .exit
jmp .still
.print:
@@ -377,15 +327,13 @@ gui: ;//////////////////////////////////////////////////////////////////////////
cmp byte[esi], 0
jne @b
stdcall [ted_text_add], tedit0, tedit_buffer, ecx, ebx
cmp [show_log],0
je .end_log_2
stdcall [ted_draw], tedit0
.end_log_2:
; write to log file
mov eax, [esp+36]
sub ecx, 2 ; 0a0d is not included
call write_to_file
@@:
popad
ret 4
@@ -405,16 +353,13 @@ gui: ;//////////////////////////////////////////////////////////////////////////
;< none ;;
;;================================================================================================;;
cmp eax, 1
jl data_loop
push edx eax
push edx
push eax
; check if any incomplete entry to be parsed
cmp byte[remote_list_buf], 0
je .no_backlog
; find end of remote_list_buf
mov edi, remote_list_buf
mov ecx, 1024 ;buffer size
mov al, 0
repne scasb
; copy rest of the incomplete entry to remote_list_buf
@@ -479,8 +424,6 @@ gui: ;//////////////////////////////////////////////////////////////////////////
mov byte[edi], 0
; add node to tree list
and dword[tree2.style], not 8
stdcall [tl_cur_next], tree2
cmp word[node_entry2], 'fi'
jne @f
stdcall [tl_node_add], tree2, 0, node_entry2
@@ -510,9 +453,9 @@ gui: ;//////////////////////////////////////////////////////////////////////////
.store_last_entry:
; find index of the last incomplete entry
mov ecx, -1
mov eax, [esp]
lea edi, [buf_buffer2+eax-2]
mov ecx, eax
mov al, 0x0a
std
repne scasb
@@ -527,10 +470,9 @@ gui: ;//////////////////////////////////////////////////////////////////////////
jne @b
.done_parsing:
stdcall [tl_cur_beg], tree2
or dword[tree2.style], 8
call .draw ; to update tree list immediately in case of "auto_list"
pop eax edx
pop eax
pop edx
jmp data_loop
; clear tree list and add ".." node before executing "LIST"
@@ -552,7 +494,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
;;================================================================================================;;
; detect abort
mcall SF_GET_BUTTON
mcall 17
cmp ah, 10
je cmd_abor
@@ -636,8 +578,7 @@ fun_on_enter:
cmp byte[esi], 0
jne @b
mov word[edi], 0x000a
mov [lbl_after_enter], cmd_stor
ret
jmp cmd_stor
; Function to call when you press [Enter]
@@ -650,8 +591,7 @@ fun_on_enter2:
cmp dword[esi], 0x2E2E
jne @f
mov [auto_list], 1
mov [lbl_after_enter], cmd_cdup
ret
jmp cmd_cdup
@@:
cmp word[eax], 'fo'
@@ -670,14 +610,12 @@ fun_on_enter2:
; newline in console code
cmp word[eax], 'fo'
je @f
mov [lbl_after_enter], cmd_retr
ret
jmp cmd_retr
@@:
stdcall [tl_info_clear], tree2
mov [auto_list], 1
mov [lbl_after_enter], cmd_cwd
ret
jmp cmd_cwd
;;================================================================================================;;
@@ -703,7 +641,7 @@ populate_local_tree_list: ;/////////////////////////////////////////////////////
jne @f
; removes last file name from filestruct.name
mcall SF_CURRENT_FOLDER, SSF_GET_CF, filestruct.name,1024 ; get absolute path for cwd
mcall 30, 2, filestruct.name,1024 ; get absolute path for cwd
lea edi, [filestruct.name+eax] ; edi = pointer to the tail of file name
mov al, '/'
mov ecx, -1
@@ -714,15 +652,15 @@ populate_local_tree_list: ;/////////////////////////////////////////////////////
mov ecx, filestruct.name
@@:
mcall SF_CURRENT_FOLDER, SSF_SET_CF ; set cwd
mcall SF_CURRENT_FOLDER, SSF_GET_CF, filestruct.name, 1024 ; get absolute path for cwd
mcall 30, 1, ; set cwd
mcall 30, 2, filestruct.name, 1024 ; get absolute path for cwd
; clear all nodes in tree list
stdcall [tl_info_clear], tree1
mov [filestruct.offset], 0
; read 32 blocks
.outer:
mcall SF_FILE, filestruct
mcall 70, filestruct
;int3
test eax, eax
jz @f
@@ -808,16 +746,6 @@ EvSize:
ret
;
show_hide_log:
mov esi, 555
xor [show_log],1
jnz @f
sub esi, 160
@@:
mcall SF_CHANGE_WINDOW, -1, -1, -1
ret
;;================================================================================================;;
filter_remote_list: ;/////////////////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
@@ -933,133 +861,30 @@ search: ;///////////////////////////////////////////////////////////////////////
pop edi esi edx ecx ebx
ret
align 4
proc copy_icon uses ebx ecx esi edi, buf_d:dword, buf_s:dword, ind:dword
;;------------------------------------------------------------------------------------------------;;
;> buf_d = pointer to destination buffer 24-bit
;> buf_s = pointer to source buffer 32-bit (with icons)
;> ind = icon index
;;------------------------------------------------------------------------------------------------;;
;< eax = pointer to destination buffer + icon size
;;------------------------------------------------------------------------------------------------;;
mov edi, [buf_d]
mov ecx, (18+ICON_LEFT_B)*ICON_TOP_B*3
mov al, 0xff
rep stosb ; make top border
; copy icon
mov esi, [ind]
imul esi, 18*18*4
add esi, [buf_s]
mov ebx, 18
.cycle0:
mov ecx, ICON_LEFT_B*3
rep stosb ; make left border
mov ecx, 18
@@:
movsw
movsb
inc esi ; skip transparent byte
loop @b
dec ebx
jnz .cycle0
mov eax, edi
ret
endp
align 4
proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword
;;------------------------------------------------------------------------------------------------;;
; function for generating gray icons
;;------------------------------------------------------------------------------------------------;;
;> buf_rgb - buffer with input 24-bit color image
;> buf_g24 - buffer with output 24-bit gray image
;> pixels - number of pixels in the image
;;------------------------------------------------------------------------------------------------;;
pushad
mov esi, [buf_rgb]
mov edi, [buf_g24]
mov ecx, [pixels]
mov ebx, 3
@@:
movzx eax, byte[esi]
movzx edx, byte[esi+1]
add eax, edx
movzx edx, byte[esi+2]
add eax, edx
xor edx, edx
div ebx
mov ah, al
mov word[edi], ax
mov byte[edi+2], al
add esi, 3
add edi, 3
loop @b
popad
ret
endp
align 4
proc copy_icon_w uses ecx esi edi, buf_d:dword, buf_s:dword, ind:dword
;;------------------------------------------------------------------------------------------------;;
;> buf_d = pointer to destination buffer 32-bit
;> buf_s = pointer to source buffer 32-bit (with icons)
;> ind = icon index
;;------------------------------------------------------------------------------------------------;;
;< eax = pointer to destination buffer + icon size
;;------------------------------------------------------------------------------------------------;;
mov edi, [buf_d]
mov ecx, 18*18
mov esi, [ind]
imul esi, ecx
shl esi, 2
add esi, [buf_s]
rep movsd
mov eax, edi
mov ecx, 18*18
mov edi, [buf_d]
mov esi, [edi] ;copy transparent color
.cycle0:
cmp [edi], esi
jne @f
mov dword[edi], BT_COL
@@:
add edi, 4
loop .cycle0
ret
endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;hed db 'FTP Client for KolibriOS',0
str_change db 'Change',0
str_disconnect db 'Disconnect',0
str_show_log db 'Show log',0
str_hide_log db 'Hide log',0
str_copy db 'Copy',0
str_mkd db 'MKD',0
str_dele db 'DELE',0
str_rdir db 'RDIR',0
str_rmd db 'RMD',0
str_abort db 'Cancel',0
;str_search db 'Search',0
str_search db 'Search',0
str_list db 'LIST',0
str_null db 0
str_icon_18 db 'ICONS18',0
;----------------------
; tree list elements
;----------------------
tree1 tree_list 64, 500, tl_list_box_mode, 18+ICON_LEFT_B, 18+ICON_TOP_B, \
0xffffff, BT_COL, 0x10000000, TLIST1_X, 105, TLIST_SZ-16, 185, 15, 4,\
tree1 tree_list 64, 500, tl_list_box_mode, 16, 16, \
0xffffff, BT_COL, 0x000000, TLIST1_X, 105, TLIST_SZ-16, 185, 14, 4,\
0, el_focus, wScr, fun_on_enter
tree2 tree_list 64, 500, tl_list_box_mode, 18+ICON_LEFT_B, 18+ICON_TOP_B, \
0xffffff, BT_COL, 0x10000000, TLIST2_X, 105, TLIST_SZ-16, 185, 15, 4, \
tree2 tree_list 64, 500, tl_list_box_mode, 16, 16, \
0xffffff, BT_COL, 0x000000, TLIST2_X, 105, TLIST_SZ-16, 185, 14, 4, \
0, el_focus, wScr2, fun_on_enter2
; editbox for mkd
@@ -1071,7 +896,7 @@ edit_volume edit_box TLIST_SZ-60, TLIST1_X, 80, 0xffffff, 0x94AECE, 0, \
0xAABBCC, 0x10000000, 99, root_dir, mouse_dd, 0
; editbox for search
edit_search edit_box TLIST_SZ-30, TLIST2_X, 22, 0xffffff, 0x94AECE, 0, \
edit_search edit_box TLIST_SZ-60, TLIST2_X, 22, 0xffffff, 0x94AECE, 0, \
0xAABBCC, 0x10000000, 99, filter,mouse_dd, 0
; A subsidiary structure for scrolling

View File

@@ -27,7 +27,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
.get_username:
; in case of error when either login_gui.server_addr or
; login_gui.get_username is called, should resize window
mcall SF_CHANGE_WINDOW, WIN_X, WIN_Y, WIN_W, WIN_H ; resize to login gui window size
mcall 67, WIN_X, WIN_Y, WIN_W, WIN_H ; resize to login gui window size
.redraw:
call .draw
@@ -44,22 +44,22 @@ login_gui: ;////////////////////////////////////////////////////////////////////
align 4
.draw:
mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, 40
mcall 12, 1
mcall 48, 3, sc, 40
edit_boxes_set_sys_color edit_usr,editboxes_end,sc
mov edx, 0x34000000
or edx, [sc.work]
mcall SF_CREATE_WINDOW, <WIN_X,WIN_W>, <WIN_Y,WIN_H>, , 0x805080DD, str_title
mcall 0, <WIN_X,WIN_W>, <WIN_Y,WIN_H>, , 0x805080DD, str_title
call .draw_editboxes
; draw "connect" button
mcall SF_DEFINE_BUTTON, <162,65>, <150,25>, 2, [sc.work_button]
mcall 8, <162,65>, <150,25>, 2, [sc.work_button]
; draw strings
mov ecx, 0x90000000
or ecx, [sc.work_text]
mcall SF_DRAW_TEXT, <3, 8>, , gui_str_usr
mcall 4, <3, 8>, , gui_str_usr
mcall , <3,PAD*1+8>, , gui_str_pass
mcall , <3,PAD*2+8>, , gui_str_server
mcall , <3,PAD*3+8>, , gui_str_port
@@ -74,12 +74,12 @@ login_gui: ;////////////////////////////////////////////////////////////////////
mcall
mov [str_error_addr], gui_str_null ; reset error string address
mcall SF_REDRAW, SSF_END_DRAW
mcall 12, 2
ret
align 4
.still:
mcall SF_WAIT_EVENT
mcall 10 ; wait for event
dec eax
jz .redraw
dec eax
@@ -96,7 +96,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
jmp .still
.button:
mcall SF_GET_BUTTON
mcall 17
dec ah
jz .exit
@@ -107,7 +107,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
jmp .still
.key:
mcall SF_GET_KEY
mcall 2
cmp ah,13
je .connect
@@ -122,17 +122,12 @@ login_gui: ;////////////////////////////////////////////////////////////////////
stdcall [edit_box_key], edit_path
jmp .still
.connect:
mov esi, 555
or [show_log],0
jnz @f
sub esi, 160
@@:
mcall SF_CHANGE_WINDOW, 35, 20, 830 ; resize to main gui window's coordinates
mcall 67, 35, 20, 830, 555 ; resize to main gui window's coordinates
cmp [param_server_addr], 0
jne gui.main
jne gui.main
mov [str_error_addr], gui_str_no_srvr
jmp .redraw

View File

@@ -190,11 +190,10 @@ data_loop:
mov [filestruct.ptr], buf_buffer2
mov [filestruct.size], eax
push eax
mcall SF_FILE, filestruct
mcall 70, filestruct
test eax, eax
jz @f
call error_fs
add esp, 4 ; fix stack
jmp close_datacon
@@:
pop eax
@@ -205,7 +204,7 @@ data_loop:
; storing, send all data
.stor:
mcall SF_FILE, filestruct
mcall 70, filestruct
cmp eax, 6 ; end of file
je .last_call
test eax, eax ; error
@@ -245,7 +244,7 @@ data_loop:
mov ecx, eax ; eax is size of buffer received
inc ecx
add ecx, [size_fname] ; added old size to form new required size
mcall SF_SYS_MISC, SSF_MEM_REALLOC, , [ptr_fname]
mcall 68, 20, , [ptr_fname] ; realloc
test eax, eax
je error_heap
mov [ptr_fname], eax ; eax contains the new block now

View File

@@ -82,13 +82,13 @@ cmd_retr:
mov ecx, 256-5
call set_filename
mov [filestruct.subfn], SSF_CREATE_FILE ; create/rewrite file
mov [filestruct.subfn], 2 ; create/rewrite file
mov [filestruct.offset], 0
mov [filestruct.offset+4], 0
mov [filestruct.size], 0
mov [filestruct.ptr], 0
mcall SF_FILE, filestruct
mcall 70, filestruct
test eax, eax
jz @f
call error_fs
@@ -96,7 +96,7 @@ cmd_retr:
@@:
; Prepare to write to the file
mov [filestruct.subfn], SSF_WRITE_FILE
mov [filestruct.subfn], 3 ; write to file
mov [operation], OPERATION_RETR
; Request the file from server
@@ -138,7 +138,7 @@ cmd_stor:
mov [operation], OPERATION_STOR
; get file size
mov [filestruct.subfn], SSF_GET_INFO
mov [filestruct.subfn], 5
mov [filestruct.offset], 0
mov [filestruct.offset+4], 0
mov [filestruct.size], 0
@@ -148,12 +148,12 @@ cmd_stor:
mov ecx, 256-5
call set_filename
mcall SF_FILE, filestruct
mcall 70, filestruct
mov eax, dword[folder_buf+32] ; supports file size upto 4GB
mov [file_size], eax
mov [filestruct.subfn], SSF_READ_FILE
mov [filestruct.subfn], 0 ; read file
; mov [filestruct.offset], 0
; mov [filestruct.offset+4], 0
mov [filestruct.size], BUFFERSIZE
@@ -191,12 +191,12 @@ cmd_lcwd:
mov byte[esi-1], 0
; check whether entered path is valid (folder exists)
mov [filestruct2.subfn], SSF_GET_INFO
mov [filestruct2.subfn], 5
mov [filestruct2.offset], 0
mov [filestruct2.size], 0
mov [filestruct2.ptr], folder_buf
mov [filestruct2.name], buf_cmd+5
mcall SF_FILE, filestruct2
mcall 70, filestruct2
test eax, eax
jz @f
cmp eax, 2
@@ -205,10 +205,10 @@ cmd_lcwd:
jmp wait_for_usercommand
@@:
mcall SF_CURRENT_FOLDER, SSF_SET_CF, buf_cmd+5 ; set working directory
mcall 30, 1, buf_cmd+5 ; set working directory
.print:
mcall SF_CURRENT_FOLDER, SSF_GET_CF, buf_cmd, 256 ; and read it again
mcall 30, 2, buf_cmd, 256 ; and read it again
icall eax, interface_addr, interface.print, str_lcwd, buf_cmd, str_newline
jmp wait_for_usercommand

View File

@@ -1,5 +1,2 @@
if tup.getconfig("NO_FASM") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
tup.rule("calcplus.asm", FASM .. " -dlang=" .. tup.getconfig("LANG") .. " %f %o" .. tup.getconfig("KPACK_CMD"), "%B")
tup.rule("calcplus.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "calcplus")

View File

@@ -0,0 +1,2 @@
@fasm calcplus.asm calc+
@pause

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +0,0 @@
if tup.getconfig("NO_FASM") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
tup.rule("magnify.asm", FASM .. " -dlang=" .. tup.getconfig("LANG") .. " %f %o" .. tup.getconfig("KPACK_CMD"), "%B")

View File

@@ -1,229 +0,0 @@
; SPDX-License-Identifier: GPL-2.0-only
;
; Magnify - Screen Magnifier
; Copyright (C) 2005 MenuetOS
; Copyright (C) 2005-2025 KolibriOS team
;---------------------------------------------------------------------
use32
org 0x0
db 'MENUET01'
dd 1
dd START
dd I_END
dd MEM
dd STACKTOP
dd 0, 0
;---------------------------------------------------------------------
include '../../macros.inc'
include "../../KOSfuncs.inc"
include "../../encoding.inc"
;---------------------------------------------------------------------
START:
mcall SF_SET_EVENTS_MASK, EVM_REDRAW or EVM_BUTTON or EVM_MOUSE
mcall SF_SYS_MISC, SSF_HEAP_INIT
; initializing MAG_H * MAG_W rect of pixels from screen
mcall SF_SYS_MISC, SSF_MEM_ALLOC, MAG_H * MAG_W * 3
mov [screen_rect], eax
call logic_read_screen
still:
mcall SF_WAIT_EVENT_TIMEOUT, DELAY
cmp eax, EV_REDRAW
je redraw
cmp eax, EV_BUTTON
je button
cmp eax, EV_MOUSE
je mouse
jmp redraw
redraw:
call draw_window
call draw_magnify
jmp still
;---------------------------------------------------------------------
button:
; we have only one button, close
or eax, SF_TERMINATE_PROCESS
mcall
mouse:
mcall SF_MOUSE_GET, SSF_BUTTON
test ax, 0x0001
jnz still
call logic_read_screen
call draw_magnify
jmp still
;---------------------------------------------------------------------
; ******* WINDOW DEFINITIONS AND DRAW ********
;---------------------------------------------------------------------
draw_window:
mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
mov ecx, eax
add ecx, WIN.Y shl 16 + WIN.H
mcall SF_CREATE_WINDOW, <WIN.X, WIN.W>, , 0x34181818, , labelt
mcall SF_REDRAW, SSF_END_DRAW
ret
; MAG_H * MAG_W pixels grid
draw_magnify:
mcall SF_THREAD_INFO, procinfo, -1
mov al, byte [procinfo.wnd_state]
test al, 0x04
jne .du_loop_end
mov eax, SF_DRAW_RECT
mov ebx, MAG_S - 1
mov ecx, MAG_S - 1
mov esi, [screen_rect]
mov edi, MAG_W * MAG_H
.du_loop_rect:
mcall , , , dword [esi]
add ebx, MAG_S shl 16
cmp ebx, MAG_S * MAG_W shl 16
jle .du_loop_rect_row
mov ebx, MAG_S - 1
add ecx, MAG_S shl 16
.du_loop_rect_row:
add esi, 3
dec edi
jne .du_loop_rect
.du_loop_end:
ret
;---------------------------------------------------------------------
; LOGIC AREA
;---------------------------------------------------------------------
; read array of pixels from screen by mouse coords
logic_read_screen:
mcall SF_MOUSE_GET, SSF_SCREEN_POSITION
mov edx, eax
; clamping mouse coords to stay within the screen
mcall SF_GET_SCREEN_SIZE
mov ebx, eax
call logic_clamp_pixels
sub edx, (MAG_W / 2) shl 16 + (MAG_H / 2)
mcall SF_GET_IMAGE, [screen_rect], <MAG_W, MAG_H>,
ret
; clamping mouse coords to stay within the screen
logic_clamp_pixels:
mov eax, edx
shr eax, 16
mov cx, ax
mov ax, dx
push ax
push cx
mov ax, bx
mov di, ax
mov eax, ebx
shr eax, 16
mov si, ax
pop cx
pop ax
.check_min_x:
cmp cx, MAG_W / 2
jge .check_min_y
mov cx, MAG_W / 2
.check_min_y:
cmp ax, MAG_H / 2
jge .check_max_x
mov ax, MAG_H / 2
.check_max_x:
mov dx, si
sub dx, MAG_W / 2 - 1
cmp cx, dx
jle .check_max_y
mov cx, dx
.check_max_y:
mov dx, di
sub dx, MAG_H / 2 - 1
cmp ax, dx
jle .combine_coords
mov ax, dx
.combine_coords:
mov dx, cx
shl edx, 16
or dx, ax
ret
;---------------------------------------------------------------------
; DATA AREA
;---------------------------------------------------------------------
DELAY = 5
MAG_W = 40
MAG_H = 30
MAG_S = 8
WIN RECT 100, 100, MAG_W * MAG_S + 8, MAG_H * MAG_S + 3
;---------------------------------------------------------------------
if lang eq ru_RU
labelt cp866 'Magnify - Экранная лупа', 0
else if lang eq es_ES
labelt db 'Magnify - Lupa de Pantalla', 0
else
labelt db 'Magnify - Screen Magnifier', 0
endf
;---------------------------------------------------------------------
screen_rect dd 0x00000000
;---------------------------------------------------------------------
I_END:
rb 512
align 512
STACKTOP:
procinfo process_information
MEM: