stuff
This commit is contained in:
parent
fe93749a88
commit
f3dc2caca4
13
raylib.h
13
raylib.h
|
|
@ -33,7 +33,6 @@
|
|||
* [raudio] miniaudio (David Reid - github.com/mackron/miniaudio) for audio device/context management
|
||||
*
|
||||
* OPTIONAL DEPENDENCIES (included):
|
||||
* [rcore] msf_gif (Miles Fogle) for GIF recording
|
||||
* [rcore] sinfl (Micha Mettke) for DEFLATE decompression algorithm
|
||||
* [rcore] sdefl (Micha Mettke) for DEFLATE compression algorithm
|
||||
* [rcore] rprand (Ramon Santamaria) for pseudo-random numbers generation
|
||||
|
|
@ -100,13 +99,13 @@
|
|||
#define __declspec(x) __attribute__((x))
|
||||
#endif
|
||||
#if defined(BUILD_LIBTYPE_SHARED)
|
||||
#define RLAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll)
|
||||
#define RLAPI __declspec(dllexport) // Building the library as a Win32 shared library (.dll)
|
||||
#elif defined(USE_LIBTYPE_SHARED)
|
||||
#define RLAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll)
|
||||
#define RLAPI __declspec(dllimport) // Using the library as a Win32 shared library (.dll)
|
||||
#endif
|
||||
#else
|
||||
#if defined(BUILD_LIBTYPE_SHARED)
|
||||
#define RLAPI __attribute__((visibility("default"))) // We are building as a Unix shared library (.so/.dylib)
|
||||
#define RLAPI __attribute__((visibility("default"))) // Building as a Unix shared library (.so/.dylib)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
@ -158,7 +157,7 @@
|
|||
#error "C++11 or later is required. Add -std=c++11"
|
||||
#endif
|
||||
|
||||
// NOTE: We set some defines with some data types declared by raylib
|
||||
// NOTE: Set some defines with some data types declared by raylib
|
||||
// Other modules (raymath, rlgl) also require some of those types, so,
|
||||
// to be able to use those other modules as standalone (not depending on raylib)
|
||||
// this defines are very useful for internal check and avoid type (re)definitions
|
||||
|
|
@ -1673,7 +1672,7 @@ RLAPI void ResumeSound(Sound sound); // Resume
|
|||
RLAPI bool IsSoundPlaying(Sound sound); // Check if a sound is currently playing
|
||||
RLAPI void SetSoundVolume(Sound sound, float volume); // Set volume for a sound (1.0 is max level)
|
||||
RLAPI void SetSoundPitch(Sound sound, float pitch); // Set pitch for a sound (1.0 is base level)
|
||||
RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (0.5 is center)
|
||||
RLAPI void SetSoundPan(Sound sound, float pan); // Set pan for a sound (-1.0 left, 0.0 center, 1.0 right)
|
||||
RLAPI Wave WaveCopy(Wave wave); // Copy a wave to a new wave
|
||||
RLAPI void WaveCrop(Wave *wave, int initFrame, int finalFrame); // Crop a wave to defined frames range
|
||||
RLAPI void WaveFormat(Wave *wave, int sampleRate, int sampleSize, int channels); // Convert wave data to desired format
|
||||
|
|
@ -1694,7 +1693,7 @@ RLAPI void ResumeMusicStream(Music music); // Resume
|
|||
RLAPI void SeekMusicStream(Music music, float position); // Seek music to a position (in seconds)
|
||||
RLAPI void SetMusicVolume(Music music, float volume); // Set volume for music (1.0 is max level)
|
||||
RLAPI void SetMusicPitch(Music music, float pitch); // Set pitch for a music (1.0 is base level)
|
||||
RLAPI void SetMusicPan(Music music, float pan); // Set pan for a music (0.5 is center)
|
||||
RLAPI void SetMusicPan(Music music, float pan); // Set pan for a music (-1.0 left, 0.0 center, 1.0 right)
|
||||
RLAPI float GetMusicTimeLength(Music music); // Get music time length (in seconds)
|
||||
RLAPI float GetMusicTimePlayed(Music music); // Get current music time played (in seconds)
|
||||
|
||||
|
|
|
|||
36
raymath.h
36
raymath.h
|
|
@ -2552,7 +2552,38 @@ RMAPI int QuaternionEquals(Quaternion p, Quaternion q)
|
|||
return result;
|
||||
}
|
||||
|
||||
// Compose a transformation matrix from rotational, translational and scaling components
|
||||
// TODO: This function is not following raymath conventions defined in header: NOT self-contained
|
||||
RMAPI Matrix MatrixCompose(Vector3 translation, Quaternion rotation, Vector3 scale)
|
||||
{
|
||||
// Initialize vectors
|
||||
Vector3 right = { 1.0f, 0.0f, 0.0f };
|
||||
Vector3 up = { 0.0f, 1.0f, 0.0f };
|
||||
Vector3 forward = { 0.0f, 0.0f, 1.0f };
|
||||
|
||||
// Scale vectors
|
||||
right = Vector3Scale(right, scale.x);
|
||||
up = Vector3Scale(up, scale.y);
|
||||
forward = Vector3Scale(forward , scale.z);
|
||||
|
||||
// Rotate vectors
|
||||
right = Vector3RotateByQuaternion(right, rotation);
|
||||
up = Vector3RotateByQuaternion(up, rotation);
|
||||
forward = Vector3RotateByQuaternion(forward, rotation);
|
||||
|
||||
// Set result matrix output
|
||||
Matrix result = {
|
||||
right.x, up.x, forward.x, translation.x,
|
||||
right.y, up.y, forward.y, translation.y,
|
||||
right.z, up.z, forward.z, translation.z,
|
||||
0.0f, 0.0f, 0.0f, 1.0f
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Decompose a transformation matrix into its rotational, translational and scaling components and remove shear
|
||||
// TODO: This function is not following raymath conventions defined in header: NOT self-contained
|
||||
RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotation, Vector3 *scale)
|
||||
{
|
||||
float eps = (float)1e-9;
|
||||
|
|
@ -2587,10 +2618,7 @@ RMAPI void MatrixDecompose(Matrix mat, Vector3 *translation, Quaternion *rotatio
|
|||
|
||||
// X Scale
|
||||
scl.x = Vector3Length(matColumns[0]);
|
||||
if (scl.x > eps)
|
||||
{
|
||||
matColumns[0] = Vector3Scale(matColumns[0], 1.0f / scl.x);
|
||||
}
|
||||
if (scl.x > eps) matColumns[0] = Vector3Scale(matColumns[0], 1.0f / scl.x);
|
||||
|
||||
// Compute XY shear and make col2 orthogonal
|
||||
shear[0] = Vector3DotProduct(matColumns[0], matColumns[1]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user