Skip to content

Commit 2408344

Browse files
committed
update to main branch
1 parent 2217e92 commit 2408344

23 files changed

+107
-42
lines changed

builds_raylib_dev.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,11 @@ echo -e "\e[0m"
112112
#echo "#define RAYGUI_IMPLEMENTATION" > raygui.c && echo "#include <extras/raygui.h>" >> raygui.c
113113
#echo "#define PHYSAC_IMPLEMENTATION" > physac.c && echo "#include <extras/physac.h>" >> physac.c
114114

115-
116115
rm -f ../../libs/x86_64-linux/*
117116
rm -f ../../libs/x86_32-linux/*
118117
rm -f ../../libs/x86_64-win64/*
119118
rm -f ../../libs/i386-win32/*
120119

121-
122120
make clean
123121
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_MODULE_RAYGUI=TRUE RAYLIB_MODULE_GIZMO=TRUE #RAYLIB_MODULE_RAYMEDIA=TRUE
124122
cp libraylib.so.5.5.0 ../../libs/x86_64-linux/libraylib.so.550
@@ -224,9 +222,8 @@ make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_MODULE_RAYGUI=TRUE R
224222
#cp libraylibdll.a ../../libs/i386-win32
225223
cp raylib.dll ../../libs/i386-win32/libraylib.dll
226224

227-
228-
make clean
229-
i686-w64-mingw32-windres raylib.rc -o raylib.rc.data
225+
make clean
226+
i686-w64-mingw32-windres raylib.rc -o raylib.rc.data
230227
i686-w64-mingw32-windres raylib.dll.rc -o raylib.dll.rc.data
231228

232229
#echo "#define RAYGUI_IMPLEMENTATION" > raygui.c && echo "#include <extras/raygui.h>" >> raygui.c

headers/raymath.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1468,19 +1468,35 @@ RMAPI int Vector4Equals(Vector4 p, Vector4 q)
14681468
RMAPI float MatrixDeterminant(Matrix mat)
14691469
{
14701470
float result = 0.0f;
1471-
1471+
/*
14721472
// Cache the matrix values (speed optimization)
14731473
float a00 = mat.m0, a01 = mat.m1, a02 = mat.m2, a03 = mat.m3;
14741474
float a10 = mat.m4, a11 = mat.m5, a12 = mat.m6, a13 = mat.m7;
14751475
float a20 = mat.m8, a21 = mat.m9, a22 = mat.m10, a23 = mat.m11;
14761476
float a30 = mat.m12, a31 = mat.m13, a32 = mat.m14, a33 = mat.m15;
14771477
1478+
// NOTE: It takes 72 multiplication to calculate 4x4 matrix determinant
14781479
result = a30*a21*a12*a03 - a20*a31*a12*a03 - a30*a11*a22*a03 + a10*a31*a22*a03 +
14791480
a20*a11*a32*a03 - a10*a21*a32*a03 - a30*a21*a02*a13 + a20*a31*a02*a13 +
14801481
a30*a01*a22*a13 - a00*a31*a22*a13 - a20*a01*a32*a13 + a00*a21*a32*a13 +
14811482
a30*a11*a02*a23 - a10*a31*a02*a23 - a30*a01*a12*a23 + a00*a31*a12*a23 +
14821483
a10*a01*a32*a23 - a00*a11*a32*a23 - a20*a11*a02*a33 + a10*a21*a02*a33 +
14831484
a20*a01*a12*a33 - a00*a21*a12*a33 - a10*a01*a22*a33 + a00*a11*a22*a33;
1485+
*/
1486+
// Using Laplace expansion (https://en.wikipedia.org/wiki/Laplace_expansion),
1487+
// previous operation can be simplified to 40 multiplications, decreasing matrix
1488+
// size from 4x4 to 2x2 using minors
1489+
1490+
// Cache the matrix values (speed optimization)
1491+
float m0 = mat.m0, m1 = mat.m1, m2 = mat.m2, m3 = mat.m3;
1492+
float m4 = mat.m4, m5 = mat.m5, m6 = mat.m6, m7 = mat.m7;
1493+
float m8 = mat.m8, m9 = mat.m9, m10 = mat.m10, m11 = mat.m11;
1494+
float m12 = mat.m12, m13 = mat.m13, m14 = mat.m14, m15 = mat.m15;
1495+
1496+
result = (m0*((m5*(m10*m15 - m11*m14) - m9*(m6*m15 - m7*m14) + m13*(m6*m11 - m7*m10))) -
1497+
m4*((m1*(m10*m15 - m11*m14) - m9*(m2*m15 - m3*m14) + m13*(m2*m11 - m3*m10))) +
1498+
m8*((m1*(m6*m15 - m7*m14) - m5*(m2*m15 - m3*m14) + m13*(m2*m7 - m3*m6))) -
1499+
m12*((m1*(m6*m11 - m7*m10) - m5*(m2*m11 - m3*m10) + m9*(m2*m7 - m3*m6))));
14841500

14851501
return result;
14861502
}

headers/rlgl.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,9 @@ void rlBegin(int mode)
14591459
// NOTE: In all three cases, vertex are accumulated over default internal vertex buffer
14601460
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode != mode)
14611461
{
1462+
// Get current binded texture to preserve it between draw modes change (QUADS <--> TRIANGLES)
1463+
int currentTexture = RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId;
1464+
14621465
if (RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount > 0)
14631466
{
14641467
// Make sure current RLGL.currentBatch->draws[i].vertexCount is aligned a multiple of 4,
@@ -1481,13 +1484,16 @@ void rlBegin(int mode)
14811484

14821485
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].mode = mode;
14831486
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].vertexCount = 0;
1484-
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = RLGL.State.defaultTextureId;
1487+
RLGL.currentBatch->draws[RLGL.currentBatch->drawCounter - 1].textureId = currentTexture; // Preserve active texture
14851488
}
14861489
}
14871490

14881491
// Finish vertex providing
14891492
void rlEnd(void)
14901493
{
1494+
// Reset texture to default
1495+
rlSetTexture(RLGL.State.defaultTextureId);
1496+
14911497
// NOTE: Depth increment is dependant on rlOrtho(): z-near and z-far values,
14921498
// as well as depth buffer bit-depth (16bit or 24bit or 32bit)
14931499
// Correct increment formula would be: depthInc = (zfar - znear)/pow(2, bits)
@@ -2526,11 +2532,11 @@ void rlLoadExtensions(void *loader)
25262532

25272533
// Check depth texture support
25282534
if (strcmp(extList[i], (const char *)"GL_OES_depth_texture") == 0) RLGL.ExtSupported.texDepth = true;
2529-
if (strcmp(extList[i], (const char *)"GL_WEBGL_depth_texture") == 0) RLGL.ExtSupported.texDepthWebGL = true; // WebGL requires unsized internal format
2535+
if (strcmp(extList[i], (const char *)"GL_WEBGL_depth_texture") == 0) RLGL.ExtSupported.texDepthWebGL = true; // WebGL requires unsized internal format
25302536
if (RLGL.ExtSupported.texDepthWebGL) RLGL.ExtSupported.texDepth = true;
25312537

2532-
if (strcmp(extList[i], (const char *)"GL_OES_depth24") == 0) RLGL.ExtSupported.maxDepthBits = 24; // Not available on WebGL
2533-
if (strcmp(extList[i], (const char *)"GL_OES_depth32") == 0) RLGL.ExtSupported.maxDepthBits = 32; // Not available on WebGL
2538+
if (strcmp(extList[i], (const char *)"GL_OES_depth24") == 0) RLGL.ExtSupported.maxDepthBits = 24; // Not available on WebGL
2539+
if (strcmp(extList[i], (const char *)"GL_OES_depth32") == 0) RLGL.ExtSupported.maxDepthBits = 32; // Not available on WebGL
25342540

25352541
// Check texture compression support: DXT
25362542
if ((strcmp(extList[i], (const char *)"GL_EXT_texture_compression_s3tc") == 0) ||
@@ -3055,7 +3061,7 @@ void rlDrawRenderBatch(rlRenderBatch *batch)
30553061

30563062
for (int i = 0, vertexOffset = 0; i < batch->drawCounter; i++)
30573063
{
3058-
// Bind current draw call texture, activated as GL_TEXTURE0 and Bound to sampler2D texture0 by default
3064+
// Bind current draw call texture, activated as GL_TEXTURE0 and bound to sampler2D texture0 by default
30593065
glBindTexture(GL_TEXTURE_2D, batch->draws[i].textureId);
30603066

30613067
if ((batch->draws[i].mode == RL_LINES) || (batch->draws[i].mode == RL_TRIANGLES)) glDrawArrays(batch->draws[i].mode, vertexOffset, batch->draws[i].vertexCount);

libs/i386-win32/libraylib.dll

512 Bytes
Binary file not shown.

libs/i386-win32/libraylibmedia.dll

0 Bytes
Binary file not shown.

libs/x86_32-linux/libraylib.a

288 Bytes
Binary file not shown.

libs/x86_32-linux/libraylib.so.550

0 Bytes
Binary file not shown.

libs/x86_32-linux/libraylibmedia.a

288 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

libs/x86_64-linux/libraylib.a

288 Bytes
Binary file not shown.

libs/x86_64-linux/libraylib.so.550

0 Bytes
Binary file not shown.

libs/x86_64-linux/libraylibmedia.a

288 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

libs/x86_64-win64/libraylib.dll

0 Bytes
Binary file not shown.

libs/x86_64-win64/libraylibmedia.dll

512 Bytes
Binary file not shown.

package/lang/ray4laz_misc.pot

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
msgid ""
22
msgstr "Content-Type: text/plain; charset=UTF-8"
33

4+
#: ray4laz_misc.rscompilepkg
5+
msgid "Compilation package ray4laz"
6+
msgstr ""
7+
48
#: ray4laz_misc.rshelpcheat
59
msgid "Cheatsheet ..."
610
msgstr ""
711

812
#: ray4laz_misc.rsinsertclr
9-
msgid "ColorCreate from dialog"
13+
msgid "Color create from dialog"
1014
msgstr ""
1115

1216
#: ray4laz_misc.rsmnumisc
@@ -17,3 +21,7 @@ msgstr ""
1721
msgid "raylib Wiki"
1822
msgstr ""
1923

24+
#: ray4laz_misc.rsrltools
25+
msgid "ray4laz tools .."
26+
msgstr ""
27+

package/ray4laz.lpk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@
5757
<UnitName Value="raymedia"/>
5858
</Item6>
5959
<Item7>
60-
<Filename Value="../source/raylib.inc"/>
61-
<Type Value="Include"/>
62-
</Item7>
63-
<Item8>
6460
<Filename Value="../source/extras/raygizmo.pas"/>
6561
<UnitName Value="raygizmo"/>
62+
</Item7>
63+
<Item8>
64+
<Filename Value="../source/raylib.inc"/>
65+
<Type Value="Include"/>
6666
</Item8>
6767
</Files>
6868
<CompatibilityMode Value="True"/>

package/ray4laz_designtime.lpk

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,19 @@
5353
<OutDir Value="lang"/>
5454
<EnableI18NForLFM Value="True"/>
5555
</i18n>
56-
<RequiredPkgs Count="3">
56+
<RequiredPkgs Count="4">
5757
<Item1>
58-
<PackageName Value="ray4laz"/>
58+
<PackageName Value="CodeTools"/>
5959
</Item1>
6060
<Item2>
61-
<PackageName Value="IDEIntf"/>
61+
<PackageName Value="ray4laz"/>
6262
</Item2>
6363
<Item3>
64-
<PackageName Value="FCL"/>
64+
<PackageName Value="IDEIntf"/>
6565
</Item3>
66+
<Item4>
67+
<PackageName Value="FCL"/>
68+
</Item4>
6669
</RequiredPkgs>
6770
<UsageOptions>
6871
<CustomOptions Value="-dUseCThreads"/>

package/ray4laz_misc.pas

Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
interface
66

77
uses
8-
Classes, SysUtils, Graphics, LCLIntf, LazFileUtils, PackageIntf, LazIDEIntf,
9-
ProjectIntf, MenuIntf, SrcEditorIntf, Dialogs, Forms;
8+
Classes, SysUtils, Graphics, LCLIntf, LazFileUtils, PackageIntf, LazIDEIntf, contnrs, System.UITypes,
9+
ProjectIntf, MenuIntf, SrcEditorIntf, Dialogs, Forms, IDEMsgIntf, IDEExternToolIntf, CodeToolManager;
1010

1111
type
1212
{ TEventClass }
@@ -20,24 +20,25 @@ procedure Register;
2020

2121
var EventCode : TEventClass;
2222
SectionRay: TIDEMenuSection;
23+
SectionToolMenu: TIDEMenuSection;
2324
SectionRayMenu: TIDEMenuSection;
2425

2526
resourcestring
2627
rsMnuMisc = 'raylib Misc ...';
2728
rsHelpCheat = 'Cheatsheet ...';
28-
rsInsertClr = 'ColorCreate from dialog';
29+
rsInsertClr = 'Color create from dialog';
2930
rsRayWiki = 'raylib Wiki';
31+
rsRlTools = 'ray4laz tools ..';
32+
rsCompilePkg = 'Compilation package ray4laz';
3033

3134
implementation
3235

3336
function RayUsed: boolean;
3437
var
35-
lPkgList: TFPList;
36-
i: Integer;
38+
lPkgList: TFPList; i: Integer;
3739
begin
3840
result:=false;
39-
if (LazarusIDE.ActiveProject = nil) or (PackageEditingInterface.GetPackageCount <= 0 ) then exit;
40-
PackageEditingInterface.GetRequiredPackages(LazarusIDE.ActiveProject, lPkgList, [pirNotRecursive]);
41+
PackageEditingInterface.GetRequiredPackages(LazarusIDE.ActiveProject, lPkgList, [pirNotRecursive]);
4142
if lPkgList = nil then exit;
4243
try
4344
for i := 0 to lPkgList.Count - 1 do
@@ -104,12 +105,47 @@ procedure ShowColorDialog(Sender: TObject);
104105
end;
105106
end;
106107

108+
procedure CompileRay4laz(Sender: TObject);
109+
var Pkg: TIDEPackage; Dir: String;
110+
Prj: TLazProject;
111+
begin
112+
Pkg:=PackageEditingInterface.FindPackageWithName('ray4laz');
113+
if Pkg<>nil then
114+
begin
115+
try
116+
if PackageEditingInterface.DoCompilePackage(Pkg,[pcfCleanCompile], False) <> mrOk then
117+
exit;
118+
finally
119+
Dir:=''; // the empty directory is for new files and has the same settings as the project directory
120+
IDEMessagesWindow.AddCustomMessage(mluNone,
121+
CodeToolBoss.GetUnitPathForDirectory(Dir,false) ,'file.pas',0,0,
122+
Pkg.Filename);
123+
124+
// IDEMessagesWindow.AddCustomMessage();
125+
// IDEMessagesWindow.AddMsg('unit1.pas(30,4) Error: Identifier not found "a"',Dir,0);
126+
//IDEMessagesWindow.EndBlock;
127+
end;
128+
end;
129+
end; // TIDEProjPackBase
107130

108131
procedure Register;
109132
begin
110133
SectionRay:=RegisterIDEMenuSection(SrcEditMenuSectionFirstStatic,'RayTool');
111134
SectionRayMenu:= RegisterIDESubMenu(SectionRay,'RayTool',rsMnuMisc,nil ,nil,'cc_class');
112135

136+
SectionToolMenu:= RegisterIDESubMenu(SectionRayMenu,'rltool',rsRlTools,nil ,nil,'pkg_properties');
137+
RegisterIDEMenuCommand(SectionToolMenu, 'Compile', rsCompilePkg, nil, @CompileRay4laz,nil, 'pkg_compile');
138+
RegisterIDEMenuCommand(SectionToolMenu, 'OpenSetting', 'Open setting', nil, @RayFunction,nil, 'menu_build_file');
139+
RegisterIDEMenuCommand(SectionToolMenu, 'CopyDll', 'Copy to project', nil, @RayFunction,nil, 'pkg_lrs');
140+
141+
RegisterIDEMenuCommand(SectionToolMenu, 'SubSpl0','-',nil,nil);
142+
RegisterIDEMenuCommand(SectionToolMenu, 'ShowCheatsheet', rsHelpCheat , nil, @RayFunction, nil, 'ce_interface');
143+
RegisterIDEMenuCommand(SectionToolMenu, 'ShowWiki', rsRayWiki , nil, @RayFunction, nil, 'menu_information');
144+
145+
146+
RegisterIDEMenuCommand(SectionRayMenu, 'Spl0','-',nil,nil);
147+
RegisterIDEMenuCommand(SectionRayMenu, 'InsertColor', rsInsertClr , nil, @ShowColorDialog, nil, 'tcolordialog');
148+
RegisterIDEMenuCommand(SectionRayMenu, 'Spl1','-',nil,nil);
113149
RegisterIDEMenuCommand(SectionRayMenu, 'Vector2Create', 'Vector2Create', nil, @RayFunction,nil, 'cc_function');
114150
RegisterIDEMenuCommand(SectionRayMenu, 'Vector3Create', 'Vector3Create', nil, @RayFunction,nil, 'cc_function');
115151
RegisterIDEMenuCommand(SectionRayMenu, 'Vector4Create', 'Vector4Create', nil, @RayFunction,nil, 'cc_function');
@@ -118,7 +154,7 @@ procedure Register;
118154
RegisterIDEMenuCommand(SectionRayMenu, 'RectangleCreate', 'RectangleCreate', nil, @RayFunction,nil, 'cc_function');
119155
RegisterIDEMenuCommand(SectionRayMenu, 'BoundingBoxCreate', 'BoundingBoxCreate', nil, @RayFunction,nil, 'cc_function');
120156
RegisterIDEMenuCommand(SectionRayMenu, 'Camera3DCreate', 'Camera3DCreate', nil, @RayFunction,nil, 'cc_function');
121-
157+
RegisterIDEMenuCommand(SectionRayMenu, 'Spl2','-',nil,nil);
122158
RegisterIDEMenuCommand(SectionRayMenu, 'Vector2Set', 'Vector2Set', nil, @RayFunction,nil, 'cc_procedure');
123159
RegisterIDEMenuCommand(SectionRayMenu, 'Vector3Set', 'Vector3Set', nil, @RayFunction,nil, 'cc_procedure');
124160
RegisterIDEMenuCommand(SectionRayMenu, 'Vector4Set', 'Vector4Set', nil, @RayFunction,nil, 'cc_procedure');
@@ -127,13 +163,13 @@ procedure Register;
127163
RegisterIDEMenuCommand(SectionRayMenu, 'RectangleSet', 'RectangleSet', nil, @RayFunction,nil, 'cc_procedure');
128164
RegisterIDEMenuCommand(SectionRayMenu, 'BoundingBoxSet', 'BoundingBoxSet', nil, @RayFunction,nil, 'cc_procedure');
129165
RegisterIDEMenuCommand(SectionRayMenu, 'Camera3DSet', 'Camera3DSet', nil, @RayFunction,nil, 'cc_procedure');
130-
RegisterIDEMenuCommand(SectionRayMenu, 'Spl0','-',nil,nil);
131166

132-
RegisterIDEMenuCommand(SectionRayMenu, 'InsertColor', rsInsertClr , nil, @ShowColorDialog, nil, 'tcolordialog');
133-
RegisterIDEMenuCommand(SectionRayMenu, 'Spl1','-',nil,nil);
134167

135-
RegisterIDEMenuCommand(SectionRayMenu, 'ShowCheatsheet', rsHelpCheat , nil, @RayFunction, nil, 'ce_interface');
136-
RegisterIDEMenuCommand(SectionRayMenu, 'ShowWiki', rsRayWiki , nil, @RayFunction, nil, 'menu_information');
168+
// RegisterIDEMenuCommand(SectionRayMenu, 'InsertColor', rsInsertClr , nil, @ShowColorDialog, nil, 'tcolordialog');
169+
// RegisterIDEMenuCommand(SectionRayMenu, 'Spl2','-',nil,nil);
170+
171+
// RegisterIDEMenuCommand(SectionRayMenu, 'ShowCheatsheet', rsHelpCheat , nil, @RayFunction, nil, 'ce_interface');
172+
// RegisterIDEMenuCommand(SectionRayMenu, 'ShowWiki', rsRayWiki , nil, @RayFunction, nil, 'menu_information');
137173

138174
SectionRay.AddHandlerOnShow(@EventCode.DoSomething,true);
139175
end;

source/extras/raygizmo.pas

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
Copyright (c) 2024 Claudio Z. (@cloudofoz)
44
https://github.com/cloudofoz/raylib-gizmo
55
pascal header translation 2024 gunko vadim
6-
7-
*)
6+
*)
87

98
{$mode objfpc}{$H+}
109
{$packrecords c}

source/extras/raymedia.pas

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
unit raymedia;
2+
(*
3+
Copyright (c) 2025 Claudio Z. (@cloudofoz)
4+
https://github.com/cloudofoz/raylib-media
5+
pascal header translation 2024 gunko vadim
6+
*)
27

38
{$mode objfpc}{$H+}
49
{$packrecords c}

source/raylib.inc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
// Configuration file for raylib
22

3-
// Defines for GNU/Linux
4-
5-
{$DEFINE RAY_MEDIA}
6-
73
{$IFDEF LINUX}
84
{$IFNDEF RAY_DYNAMIC}
95
{$DEFINE RAY_STATIC}
@@ -22,6 +18,8 @@
2218
{$ENDIF}
2319
{$IFEND}
2420

21+
// Use raylib media
22+
{.$DEFINE RAY_MEDIA}
2523

2624
//Use selected OpenGL graphics backend, should be supported by platform
2725
//Those preprocessor defines are only used on rlgl module, if OpenGL version is

source/raylib.pas

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,17 @@ interface
1212

1313
{$IFNDEF RAY_STATIC}
1414
const
15-
1615
cDllName = {$IFNDEF RAY_MEDIA}
1716
{$IFDEF WINDOWS} 'libraylib.dll'; {$IFEND}
1817
{$IFDEF LINUX} 'libraylib.so.550'; {$IFEND}
1918
{$ELSE}
2019
{$IFDEF WINDOWS} 'libraylibmedia.dll'; {$IFEND}
2120
{$IFDEF LINUX} 'libraylibmedia.so.550'; {$IFEND}
2221
{$ENDIF}
23-
2422
{$IFDEF DARWIN} 'libraylib.dylib'; {$IFEND}
2523
{$IFDEF HAIKU} 'libraylib.so'; {$IFEND}
2624
{$ENDIF}
2725

28-
2926
const
3027
DEG2RAD = (PI / 180.0);
3128
RAD2DEG = (180.0 / PI);

0 commit comments

Comments
 (0)