8 Commits

Author SHA1 Message Date
Ray
070c7894c6 REVIEWED: Some flags for window/context creation attributes 2025-09-26 23:35:28 +02:00
Ray
e79603d501 REDESIGNED: rcore_desktop_win32 platform backend
Now it works! but there is still work to do to support all required features...

I really enjoyed reviewing and redesigning this platform backend!
2025-09-26 23:17:37 +02:00
Ray
06cfda6ff9 Update raymath.h 2025-09-26 23:03:10 +02:00
Ray
87f758f9b4 Review latest PRs formatting 2025-09-26 22:26:19 +02:00
Ray
f6c07099af Merge branch 'master' of https://github.com/raysan5/raylib 2025-09-26 22:22:57 +02:00
Ray
2724f07c9a Update rexm.c 2025-09-26 22:22:43 +02:00
fe8c83b57d Update palette_switch.fs (#5205)
Removed unnecessary `a` in palette_switch.fs `note` comment
2025-09-26 20:56:54 +02:00
15d234b79d GLTF anim correctly inherits world transform (#5206) 2025-09-26 20:56:37 +02:00
8 changed files with 1105 additions and 1266 deletions

View File

@ -17,7 +17,7 @@ out vec4 finalColor;
void main()
{
// Texel color fetching from texture sampler
// NOTE: The texel is actually the a GRAYSCALE index color
// NOTE: The texel is actually the GRAYSCALE index color
vec4 texelColor = texture(texture0, fragTexCoord)*fragColor;
// Convert the (normalized) texel color RED component (GB would work, too)

View File

@ -504,6 +504,20 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\src\platforms\rcore_desktop_win32.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\..\src\platforms\rcore_drm.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">true</ExcludedFromBuild>

View File

@ -46,6 +46,9 @@
<ClCompile Include="..\..\..\src\platforms\rcore_web.c">
<Filter>Source Files\Platform Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\src\platforms\rcore_desktop_win32.c">
<Filter>Source Files\Platform Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\src\external\cgltf.h">

View File

@ -447,8 +447,8 @@ int GetMonitorCount(void)
int GetCurrentMonitor(void)
{
int displayId = -1;
JNIEnv* env = NULL;
JavaVM* vm = platform.app->activity->vm;
JNIEnv *env = NULL;
JavaVM *vm = platform.app->activity->vm;
(*vm)->AttachCurrentThread(vm, &env, NULL);
jobject activity = platform.app->activity->clazz;
@ -458,12 +458,15 @@ int GetCurrentMonitor(void)
jobject display = (*env)->CallObjectMethod(env, activity, getDisplayMethod);
if (display == NULL) {
if (display == NULL)
{
TRACELOG(LOG_ERROR, "GetCurrentMonitor() couldn't get the display object");
} else {
}
else
{
jclass displayClass = (*env)->FindClass(env, "android/view/Display");
jmethodID getDisplayIdMethod = (*env)->GetMethodID(env, displayClass, "getDisplayId", "()I");
displayId = (int) (*env)->CallIntMethod(env, display, getDisplayIdMethod);
displayId = (int)(*env)->CallIntMethod(env, display, getDisplayIdMethod);
(*env)->DeleteLocalRef(env, displayClass);
}

File diff suppressed because it is too large Load Diff

View File

@ -2555,7 +2555,7 @@ RMAPI int QuaternionEquals(Quaternion p, Quaternion q)
// Decompose a transformation matrix into its rotational, translational and scaling components and remove shear
RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotation, Vector3 *scale)
{
float eps = 1e-9;
float eps = (float)1e-9;
// Extract Translation
translation->x = mat.m12;

View File

@ -4261,9 +4261,10 @@ static void BuildPoseFromParentJoints(BoneInfo *bones, int boneCount, Transform
continue;
}
transforms[i].rotation = QuaternionMultiply(transforms[bones[i].parent].rotation, transforms[i].rotation);
transforms[i].scale = Vector3Multiply(transforms[i].scale, transforms[bones[i].parent].scale);
transforms[i].translation = Vector3Multiply(transforms[i].translation, transforms[bones[i].parent].scale);
transforms[i].translation = Vector3RotateByQuaternion(transforms[i].translation, transforms[bones[i].parent].rotation);
transforms[i].translation = Vector3Add(transforms[i].translation, transforms[bones[i].parent].translation);
transforms[i].scale = Vector3Multiply(transforms[i].scale, transforms[bones[i].parent].scale);
}
}
}
@ -6238,6 +6239,18 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
*animCount = (int)data->animations_count;
animations = (ModelAnimation *)RL_CALLOC(data->animations_count, sizeof(ModelAnimation));
Transform worldTransform = { 0 };
cgltf_float cgltf_worldTransform[16] = { 0 };
cgltf_node *node = skin.joints[0];
cgltf_node_transform_world(node->parent, cgltf_worldTransform);
Matrix worldMatrix = {
cgltf_worldTransform[0], cgltf_worldTransform[4], cgltf_worldTransform[8], cgltf_worldTransform[12],
cgltf_worldTransform[1], cgltf_worldTransform[5], cgltf_worldTransform[9], cgltf_worldTransform[13],
cgltf_worldTransform[2], cgltf_worldTransform[6], cgltf_worldTransform[10], cgltf_worldTransform[14],
cgltf_worldTransform[3], cgltf_worldTransform[7], cgltf_worldTransform[11], cgltf_worldTransform[15]
};
MatrixDecompose(worldMatrix, &worldTransform.translation, &worldTransform.rotation, &worldTransform.scale);
for (unsigned int i = 0; i < data->animations_count; i++)
{
animations[i].bones = LoadBoneInfoGLTF(skin, &animations[i].boneCount);
@ -6356,6 +6369,13 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, int *animCo
};
}
Transform* root = &animations[i].framePoses[j][0];
root->rotation = QuaternionMultiply(worldTransform.rotation, root->rotation);
root->scale = Vector3Multiply(root->scale, worldTransform.scale);
root->translation = Vector3Multiply(root->translation, worldTransform.scale);
root->translation = Vector3RotateByQuaternion(root->translation, worldTransform.rotation);
root->translation = Vector3Add(root->translation, worldTransform.translation);
BuildPoseFromParentJoints(animations[i].bones, animations[i].boneCount, animations[i].framePoses[j]);
}

View File

@ -2047,6 +2047,7 @@ static void SortExampleByName(rlExampleInfo *items, int count)
// WARNING: Supported resource file extensions is hardcoded by used file types
// but new examples could require other file extensions to be added,
// maybe it should look for '.xxx")' patterns instead
// TODO: WARNING: Some resources could require linked resources: .fnt --> .png, .mtl --> .png, .gltf --> .png, ...
static char **ScanExampleResources(const char *filePath, int *resPathCount)
{
#define REXM_MAX_RESOURCE_PATH_LEN 256