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.

0 commit comments

Comments
 (0)