mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-08 07:09:18 -05:00
Compare commits
8 Commits
3f6d67c61c
...
070c7894c6
| Author | SHA1 | Date | |
|---|---|---|---|
| 070c7894c6 | |||
| e79603d501 | |||
| 06cfda6ff9 | |||
| 87f758f9b4 | |||
| f6c07099af | |||
| 2724f07c9a | |||
| fe8c83b57d | |||
| 15d234b79d |
@ -17,7 +17,7 @@ out vec4 finalColor;
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
// Texel color fetching from texture sampler
|
// 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;
|
vec4 texelColor = texture(texture0, fragTexCoord)*fragColor;
|
||||||
|
|
||||||
// Convert the (normalized) texel color RED component (GB would work, too)
|
// Convert the (normalized) texel color RED component (GB would work, too)
|
||||||
|
|||||||
@ -504,6 +504,20 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug.DLL|ARM64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</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">
|
<ClCompile Include="..\..\..\src\platforms\rcore_drm.c">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release.DLL|Win32'">true</ExcludedFromBuild>
|
||||||
|
|||||||
@ -46,6 +46,9 @@
|
|||||||
<ClCompile Include="..\..\..\src\platforms\rcore_web.c">
|
<ClCompile Include="..\..\..\src\platforms\rcore_web.c">
|
||||||
<Filter>Source Files\Platform Files</Filter>
|
<Filter>Source Files\Platform Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\src\platforms\rcore_desktop_win32.c">
|
||||||
|
<Filter>Source Files\Platform Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\..\src\external\cgltf.h">
|
<ClInclude Include="..\..\..\src\external\cgltf.h">
|
||||||
|
|||||||
@ -447,8 +447,8 @@ int GetMonitorCount(void)
|
|||||||
int GetCurrentMonitor(void)
|
int GetCurrentMonitor(void)
|
||||||
{
|
{
|
||||||
int displayId = -1;
|
int displayId = -1;
|
||||||
JNIEnv* env = NULL;
|
JNIEnv *env = NULL;
|
||||||
JavaVM* vm = platform.app->activity->vm;
|
JavaVM *vm = platform.app->activity->vm;
|
||||||
(*vm)->AttachCurrentThread(vm, &env, NULL);
|
(*vm)->AttachCurrentThread(vm, &env, NULL);
|
||||||
|
|
||||||
jobject activity = platform.app->activity->clazz;
|
jobject activity = platform.app->activity->clazz;
|
||||||
@ -458,12 +458,15 @@ int GetCurrentMonitor(void)
|
|||||||
|
|
||||||
jobject display = (*env)->CallObjectMethod(env, activity, getDisplayMethod);
|
jobject display = (*env)->CallObjectMethod(env, activity, getDisplayMethod);
|
||||||
|
|
||||||
if (display == NULL) {
|
if (display == NULL)
|
||||||
|
{
|
||||||
TRACELOG(LOG_ERROR, "GetCurrentMonitor() couldn't get the display object");
|
TRACELOG(LOG_ERROR, "GetCurrentMonitor() couldn't get the display object");
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
jclass displayClass = (*env)->FindClass(env, "android/view/Display");
|
jclass displayClass = (*env)->FindClass(env, "android/view/Display");
|
||||||
jmethodID getDisplayIdMethod = (*env)->GetMethodID(env, displayClass, "getDisplayId", "()I");
|
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);
|
(*env)->DeleteLocalRef(env, displayClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -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
|
// 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)
|
RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotation, Vector3 *scale)
|
||||||
{
|
{
|
||||||
float eps = 1e-9;
|
float eps = (float)1e-9;
|
||||||
|
|
||||||
// Extract Translation
|
// Extract Translation
|
||||||
translation->x = mat.m12;
|
translation->x = mat.m12;
|
||||||
|
|||||||
@ -4261,9 +4261,10 @@ static void BuildPoseFromParentJoints(BoneInfo *bones, int boneCount, Transform
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
transforms[i].rotation = QuaternionMultiply(transforms[bones[i].parent].rotation, transforms[i].rotation);
|
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 = Vector3RotateByQuaternion(transforms[i].translation, transforms[bones[i].parent].rotation);
|
||||||
transforms[i].translation = Vector3Add(transforms[i].translation, transforms[bones[i].parent].translation);
|
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;
|
*animCount = (int)data->animations_count;
|
||||||
animations = (ModelAnimation *)RL_CALLOC(data->animations_count, sizeof(ModelAnimation));
|
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++)
|
for (unsigned int i = 0; i < data->animations_count; i++)
|
||||||
{
|
{
|
||||||
animations[i].bones = LoadBoneInfoGLTF(skin, &animations[i].boneCount);
|
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]);
|
BuildPoseFromParentJoints(animations[i].bones, animations[i].boneCount, animations[i].framePoses[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2047,6 +2047,7 @@ static void SortExampleByName(rlExampleInfo *items, int count)
|
|||||||
// WARNING: Supported resource file extensions is hardcoded by used file types
|
// WARNING: Supported resource file extensions is hardcoded by used file types
|
||||||
// but new examples could require other file extensions to be added,
|
// but new examples could require other file extensions to be added,
|
||||||
// maybe it should look for '.xxx")' patterns instead
|
// 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)
|
static char **ScanExampleResources(const char *filePath, int *resPathCount)
|
||||||
{
|
{
|
||||||
#define REXM_MAX_RESOURCE_PATH_LEN 256
|
#define REXM_MAX_RESOURCE_PATH_LEN 256
|
||||||
|
|||||||
Reference in New Issue
Block a user