mirror of https://github.com/raysan5/raylib
Minor format tweaks
This commit is contained in:
parent
6445200a93
commit
e95d8bc655
12
src/core.c
12
src/core.c
|
@ -2248,9 +2248,9 @@ RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
|||
shader.locs[SHADER_LOC_VERTEX_COLOR] = rlGetLocationAttrib(shader.id, DEFAULT_SHADER_ATTRIB_NAME_COLOR);
|
||||
|
||||
// Get handles to GLSL uniform locations (vertex shader)
|
||||
shader.locs[SHADER_LOC_MATRIX_MVP] = rlGetLocationUniform(shader.id, "mvp");
|
||||
shader.locs[SHADER_LOC_MATRIX_PROJECTION] = rlGetLocationUniform(shader.id, "projection");
|
||||
shader.locs[SHADER_LOC_MATRIX_VIEW] = rlGetLocationUniform(shader.id, "view");
|
||||
shader.locs[SHADER_LOC_MATRIX_MVP] = rlGetLocationUniform(shader.id, "mvp");
|
||||
shader.locs[SHADER_LOC_MATRIX_PROJECTION] = rlGetLocationUniform(shader.id, "projection");
|
||||
shader.locs[SHADER_LOC_MATRIX_VIEW] = rlGetLocationUniform(shader.id, "view");
|
||||
|
||||
// Get handles to GLSL uniform locations (fragment shader)
|
||||
shader.locs[SHADER_LOC_COLOR_DIFFUSE] = rlGetLocationUniform(shader.id, "colDiffuse");
|
||||
|
@ -5193,7 +5193,7 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
|
|||
}
|
||||
else
|
||||
{
|
||||
CORE.Window.display.width = ANativeWindow_getWidth(CORE.Android.app->window);
|
||||
CORE.Window.display.width = ANativeWindow_getWidth(CORE.Android.app->window);
|
||||
CORE.Window.display.height = ANativeWindow_getHeight(CORE.Android.app->window);
|
||||
|
||||
// Init graphics device (display device and OpenGL context)
|
||||
|
@ -6022,7 +6022,7 @@ static void *EventThread(void *arg)
|
|||
// Basic movement
|
||||
if (event.code == ABS_X)
|
||||
{
|
||||
CORE.Input.Mouse.position.x = (event.value - worker->absRange.x)*CORE.Window.screen.width/worker->absRange.width; // Scale acording to absRange
|
||||
CORE.Input.Mouse.position.x = (event.value - worker->absRange.x)*CORE.Window.screen.width/worker->absRange.width; // Scale acording to absRange
|
||||
CORE.Input.Touch.position[0].x = (event.value - worker->absRange.x)*CORE.Window.screen.width/worker->absRange.width; // Scale acording to absRange
|
||||
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM)
|
||||
|
@ -6033,7 +6033,7 @@ static void *EventThread(void *arg)
|
|||
|
||||
if (event.code == ABS_Y)
|
||||
{
|
||||
CORE.Input.Mouse.position.y = (event.value - worker->absRange.y)*CORE.Window.screen.height/worker->absRange.height; // Scale acording to absRange
|
||||
CORE.Input.Mouse.position.y = (event.value - worker->absRange.y)*CORE.Window.screen.height/worker->absRange.height; // Scale acording to absRange
|
||||
CORE.Input.Touch.position[0].y = (event.value - worker->absRange.y)*CORE.Window.screen.height/worker->absRange.height; // Scale acording to absRange
|
||||
|
||||
#if defined(SUPPORT_GESTURES_SYSTEM)
|
||||
|
|
|
@ -1435,11 +1435,11 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
|
|||
|
||||
for (int i = 0; i < model.meshes[m].vertexCount; i++)
|
||||
{
|
||||
model.meshes[m].animVertices[vCounter] = 0;
|
||||
model.meshes[m].animVertices[vCounter] = 0;
|
||||
model.meshes[m].animVertices[vCounter + 1] = 0;
|
||||
model.meshes[m].animVertices[vCounter + 2] = 0;
|
||||
|
||||
model.meshes[m].animNormals[vCounter] = 0;
|
||||
model.meshes[m].animNormals[vCounter] = 0;
|
||||
model.meshes[m].animNormals[vCounter + 1] = 0;
|
||||
model.meshes[m].animNormals[vCounter + 2] = 0;
|
||||
|
||||
|
|
|
@ -785,7 +785,7 @@ Sound LoadSoundFromWave(Wave wave)
|
|||
//
|
||||
// First option has been selected, format conversion is done on the loading stage.
|
||||
// The downside is that it uses more memory if the original sound is u8 or s16.
|
||||
ma_format formatIn = ((wave.sampleSize == 8)? ma_format_u8 : ((wave.sampleSize == 16)? ma_format_s16 : ma_format_f32));
|
||||
ma_format formatIn = ((wave.sampleSize == 8)? ma_format_u8 : ((wave.sampleSize == 16)? ma_format_s16 : ma_format_f32));
|
||||
ma_uint32 frameCountIn = wave.sampleCount/wave.channels;
|
||||
|
||||
ma_uint32 frameCount = (ma_uint32)ma_convert_frames(NULL, 0, AUDIO_DEVICE_FORMAT, AUDIO_DEVICE_CHANNELS, AUDIO.System.device.sampleRate, NULL, frameCountIn, formatIn, wave.channels, wave.sampleRate);
|
||||
|
@ -2108,7 +2108,7 @@ static void OnSendAudioDataToDevice(ma_device *pDevice, void *pFramesOut, const
|
|||
if (framesJustRead > 0)
|
||||
{
|
||||
float *framesOut = (float *)pFramesOut + (framesRead*AUDIO.System.device.playback.channels);
|
||||
float *framesIn = tempBuffer;
|
||||
float *framesIn = tempBuffer;
|
||||
|
||||
MixAudioFrames(framesOut, framesIn, framesJustRead, audioBuffer->volume);
|
||||
|
||||
|
@ -2159,7 +2159,7 @@ static void MixAudioFrames(float *framesOut, const float *framesIn, ma_uint32 fr
|
|||
for (ma_uint32 iChannel = 0; iChannel < AUDIO.System.device.playback.channels; ++iChannel)
|
||||
{
|
||||
float *frameOut = framesOut + (iFrame*AUDIO.System.device.playback.channels);
|
||||
const float *frameIn = framesIn + (iFrame*AUDIO.System.device.playback.channels);
|
||||
const float *frameIn = framesIn + (iFrame*AUDIO.System.device.playback.channels);
|
||||
|
||||
frameOut[iChannel] += (frameIn[iChannel]*localVolume);
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
#endif
|
||||
|
||||
// NOTE: MSVC C++ compiler does not support compound literals (C99 feature)
|
||||
// Plain structures in C++ (without constructors) can be initialized from { } initializers.
|
||||
// Plain structures in C++ (without constructors) can be initialized with { }
|
||||
#if defined(__cplusplus)
|
||||
#define CLITERAL(type) type
|
||||
#else
|
||||
|
|
|
@ -326,7 +326,7 @@ RMDEF Vector2 Vector2MoveTowards(Vector2 v, Vector2 target, float maxDistance)
|
|||
float dy = target.y - v.y;
|
||||
float value = (dx*dx) + (dy*dy);
|
||||
|
||||
if ((value == 0) || ((maxDistance >= 0) && (value <= maxDistance * maxDistance))) return target;
|
||||
if ((value == 0) || ((maxDistance >= 0) && (value <= maxDistance*maxDistance))) return target;
|
||||
|
||||
float dist = sqrtf(value);
|
||||
|
||||
|
@ -870,18 +870,18 @@ RMDEF Matrix MatrixRotate(Vector3 axis, float angle)
|
|||
float cosres = cosf(angle);
|
||||
float t = 1.0f - cosres;
|
||||
|
||||
result.m0 = x*x*t + cosres;
|
||||
result.m1 = y*x*t + z*sinres;
|
||||
result.m2 = z*x*t - y*sinres;
|
||||
result.m3 = 0.0f;
|
||||
result.m0 = x*x*t + cosres;
|
||||
result.m1 = y*x*t + z*sinres;
|
||||
result.m2 = z*x*t - y*sinres;
|
||||
result.m3 = 0.0f;
|
||||
|
||||
result.m4 = x*y*t - z*sinres;
|
||||
result.m5 = y*y*t + cosres;
|
||||
result.m6 = z*y*t + x*sinres;
|
||||
result.m7 = 0.0f;
|
||||
result.m4 = x*y*t - z*sinres;
|
||||
result.m5 = y*y*t + cosres;
|
||||
result.m6 = z*y*t + x*sinres;
|
||||
result.m7 = 0.0f;
|
||||
|
||||
result.m8 = x*z*t + y*sinres;
|
||||
result.m9 = y*z*t - x*sinres;
|
||||
result.m8 = x*z*t + y*sinres;
|
||||
result.m9 = y*z*t - x*sinres;
|
||||
result.m10 = z*z*t + cosres;
|
||||
result.m11 = 0.0f;
|
||||
|
||||
|
@ -1292,7 +1292,7 @@ RMDEF Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount)
|
|||
{
|
||||
Quaternion result = { 0 };
|
||||
|
||||
float cosHalfTheta = q1.x*q2.x + q1.y*q2.y + q1.z*q2.z + q1.w*q2.w;
|
||||
float cosHalfTheta = q1.x*q2.x + q1.y*q2.y + q1.z*q2.z + q1.w*q2.w;
|
||||
|
||||
if (cosHalfTheta < 0)
|
||||
{
|
||||
|
@ -1375,7 +1375,7 @@ RMDEF Quaternion QuaternionFromMatrix(Matrix mat)
|
|||
}
|
||||
else
|
||||
{
|
||||
float s = sqrtf(1.0f + mat.m10 - mat.m0 - mat.m5)*2;
|
||||
float s = sqrtf(1.0f + mat.m10 - mat.m0 - mat.m5)*2;
|
||||
result.x = (mat.m2 + mat.m8)/s;
|
||||
result.y = (mat.m9 + mat.m6)/s;
|
||||
result.z = 0.25f*s;
|
||||
|
|
42
src/rlgl.h
42
src/rlgl.h
|
@ -2769,7 +2769,7 @@ void rlGenerateMipmaps(Texture2D *texture)
|
|||
#define MIN(a,b) (((a)<(b))?(a):(b))
|
||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||
|
||||
texture->mipmaps = 1 + (int)floor(log(MAX(texture->width, texture->height))/log(2));
|
||||
texture->mipmaps = 1 + (int)floor(log(MAX(texture->width, texture->height))/log(2));
|
||||
TRACELOG(LOG_INFO, "TEXTURE: [ID %i] Mipmaps generated automatically, total: %i", texture->id, texture->mipmaps);
|
||||
}
|
||||
#endif
|
||||
|
@ -3475,10 +3475,22 @@ Matrix rlGetMatrixModelview(void)
|
|||
#if defined(GRAPHICS_API_OPENGL_11)
|
||||
float mat[16];
|
||||
glGetFloatv(GL_MODELVIEW_MATRIX, mat);
|
||||
matrix.m0 = mat[0]; matrix.m1 = mat[1]; matrix.m2 = mat[2]; matrix.m3 = mat[3];
|
||||
matrix.m4 = mat[4]; matrix.m5 = mat[5]; matrix.m6 = mat[6]; matrix.m7 = mat[7];
|
||||
matrix.m8 = mat[8]; matrix.m9 = mat[9]; matrix.m10 = mat[10]; matrix.m11 = mat[11];
|
||||
matrix.m12 = mat[12]; matrix.m13 = mat[13]; matrix.m14 = mat[14]; matrix.m15 = mat[15];
|
||||
matrix.m0 = mat[0];
|
||||
matrix.m1 = mat[1];
|
||||
matrix.m2 = mat[2];
|
||||
matrix.m3 = mat[3];
|
||||
matrix.m4 = mat[4];
|
||||
matrix.m5 = mat[5];
|
||||
matrix.m6 = mat[6];
|
||||
matrix.m7 = mat[7];
|
||||
matrix.m8 = mat[8];
|
||||
matrix.m9 = mat[9];
|
||||
matrix.m10 = mat[10];
|
||||
matrix.m11 = mat[11];
|
||||
matrix.m12 = mat[12];
|
||||
matrix.m13 = mat[13];
|
||||
matrix.m14 = mat[14];
|
||||
matrix.m15 = mat[15];
|
||||
#else
|
||||
matrix = RLGL.State.modelview;
|
||||
#endif
|
||||
|
@ -3492,10 +3504,22 @@ Matrix rlGetMatrixProjection(void)
|
|||
float mat[16];
|
||||
glGetFloatv(GL_PROJECTION_MATRIX,mat);
|
||||
Matrix m;
|
||||
m.m0 = mat[0]; m.m1 = mat[1]; m.m2 = mat[2]; m.m3 = mat[3];
|
||||
m.m4 = mat[4]; m.m5 = mat[5]; m.m6 = mat[6]; m.m7 = mat[7];
|
||||
m.m8 = mat[8]; m.m9 = mat[9]; m.m10 = mat[10]; m.m11 = mat[11];
|
||||
m.m12 = mat[12]; m.m13 = mat[13]; m.m14 = mat[14]; m.m15 = mat[15];
|
||||
m.m0 = mat[0];
|
||||
m.m1 = mat[1];
|
||||
m.m2 = mat[2];
|
||||
m.m3 = mat[3];
|
||||
m.m4 = mat[4];
|
||||
m.m5 = mat[5];
|
||||
m.m6 = mat[6];
|
||||
m.m7 = mat[7];
|
||||
m.m8 = mat[8];
|
||||
m.m9 = mat[9];
|
||||
m.m10 = mat[10];
|
||||
m.m11 = mat[11];
|
||||
m.m12 = mat[12];
|
||||
m.m13 = mat[13];
|
||||
m.m14 = mat[14];
|
||||
m.m15 = mat[15];
|
||||
return m;
|
||||
#else
|
||||
return RLGL.State.projection;
|
||||
|
|
|
@ -1325,7 +1325,7 @@ char *TextReplace(char *text, const char *replace, const char *by)
|
|||
char *TextInsert(const char *text, const char *insert, int position)
|
||||
{
|
||||
int textLen = TextLength(text);
|
||||
int insertLen = TextLength(insert);
|
||||
int insertLen = TextLength(insert);
|
||||
|
||||
char *result = (char *)RL_MALLOC(textLen + insertLen + 1);
|
||||
|
||||
|
|
|
@ -425,7 +425,7 @@ bool ExportImage(Image image, const char *fileName)
|
|||
RL_FREE(fileData);
|
||||
}
|
||||
#else
|
||||
if (false) {}
|
||||
if (false) { }
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_BMP)
|
||||
else if (IsFileExtension(fileName, ".bmp")) success = stbi_write_bmp(fileName, image.width, image.height, channels, imgData);
|
||||
|
|
Loading…
Reference in New Issue