mirror of
https://github.com/raysan5/raylib.git
synced 2025-10-08 19:06:27 +00:00
Fix compiler warnings, first part
This commit is contained in:
10
src/models.c
10
src/models.c
@@ -1771,7 +1771,7 @@ void DrawModelWiresEx(Model model, Vector3 position, Vector3 rotationAxis, float
|
||||
// Draw a billboard
|
||||
void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint)
|
||||
{
|
||||
Rectangle sourceRec = { 0, 0, texture.width, texture.height };
|
||||
Rectangle sourceRec = { 0.0f, 0.0f, (float)texture.width, (float)texture.height };
|
||||
|
||||
DrawBillboardRec(camera, texture, sourceRec, center, size, tint);
|
||||
}
|
||||
@@ -1837,9 +1837,9 @@ void DrawBoundingBox(BoundingBox box, Color color)
|
||||
{
|
||||
Vector3 size;
|
||||
|
||||
size.x = fabs(box.max.x - box.min.x);
|
||||
size.y = fabs(box.max.y - box.min.y);
|
||||
size.z = fabs(box.max.z - box.min.z);
|
||||
size.x = (float)fabs(box.max.x - box.min.x);
|
||||
size.y = (float)fabs(box.max.y - box.min.y);
|
||||
size.z = (float)fabs(box.max.z - box.min.z);
|
||||
|
||||
Vector3 center = { box.min.x + size.x/2.0f, box.min.y + size.y/2.0f, box.min.z + size.z/2.0f };
|
||||
|
||||
@@ -2206,9 +2206,9 @@ void MeshBinormals(Mesh *mesh)
|
||||
Vector3 tangent = { mesh->tangents[i*4 + 0], mesh->tangents[i*4 + 1], mesh->tangents[i*4 + 2] };
|
||||
float tangentW = mesh->tangents[i*4 + 3];
|
||||
|
||||
Vector3 binormal = Vector3Multiply(Vector3CrossProduct(normal, tangent), tangentW);
|
||||
|
||||
// TODO: Register computed binormal in mesh->binormal ?
|
||||
// Vector3 binormal = Vector3Multiply( Vector3CrossProduct( normal, tangent ), tangentW );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -296,12 +296,12 @@ RMDEF Vector3 Vector3Perpendicular(Vector3 v)
|
||||
{
|
||||
Vector3 result = { 0 };
|
||||
|
||||
float min = fabs(v.x);
|
||||
float min = (float) fabs(v.x);
|
||||
Vector3 cardinalAxis = {1.0f, 0.0f, 0.0f};
|
||||
|
||||
if (fabs(v.y) < min)
|
||||
{
|
||||
min = fabs(v.y);
|
||||
min = (float) fabs(v.y);
|
||||
Vector3 tmp = {0.0f, 1.0f, 0.0f};
|
||||
cardinalAxis = tmp;
|
||||
}
|
||||
@@ -840,28 +840,28 @@ RMDEF Matrix MatrixFrustum(double left, double right, double bottom, double top,
|
||||
{
|
||||
Matrix result = { 0 };
|
||||
|
||||
float rl = (right - left);
|
||||
float tb = (top - bottom);
|
||||
float fn = (far - near);
|
||||
float rl = (float)(right - left);
|
||||
float tb = (float)(top - bottom);
|
||||
float fn = (float)(far - near);
|
||||
|
||||
result.m0 = (near*2.0f)/rl;
|
||||
result.m0 = ((float) near*2.0f)/rl;
|
||||
result.m1 = 0.0f;
|
||||
result.m2 = 0.0f;
|
||||
result.m3 = 0.0f;
|
||||
|
||||
result.m4 = 0.0f;
|
||||
result.m5 = (near*2.0f)/tb;
|
||||
result.m5 = ((float) near*2.0f)/tb;
|
||||
result.m6 = 0.0f;
|
||||
result.m7 = 0.0f;
|
||||
|
||||
result.m8 = (right + left)/rl;
|
||||
result.m9 = (top + bottom)/tb;
|
||||
result.m10 = -(far + near)/fn;
|
||||
result.m8 = ((float)right + (float)left)/rl;
|
||||
result.m9 = ((float)top + (float)bottom)/tb;
|
||||
result.m10 = -((float)far + (float)near)/fn;
|
||||
result.m11 = -1.0f;
|
||||
|
||||
result.m12 = 0.0f;
|
||||
result.m13 = 0.0f;
|
||||
result.m14 = -(far*near*2.0f)/fn;
|
||||
result.m14 = -((float)far*(float)near*2.0f)/fn;
|
||||
result.m15 = 0.0f;
|
||||
|
||||
return result;
|
||||
@@ -899,9 +899,9 @@ RMDEF Matrix MatrixOrtho(double left, double right, double bottom, double top, d
|
||||
result.m9 = 0.0f;
|
||||
result.m10 = -2.0f/fn;
|
||||
result.m11 = 0.0f;
|
||||
result.m12 = -(left + right)/rl;
|
||||
result.m13 = -(top + bottom)/tb;
|
||||
result.m14 = -(far + near)/fn;
|
||||
result.m12 = -((float)left + (float)right)/rl;
|
||||
result.m13 = -((float)top + (float)bottom)/tb;
|
||||
result.m14 = -((float)far + (float)near)/fn;
|
||||
result.m15 = 1.0f;
|
||||
|
||||
return result;
|
||||
|
44
src/text.c
44
src/text.c
@@ -220,12 +220,12 @@ extern void LoadDefaultFont(void)
|
||||
{
|
||||
defaultFont.chars[i].value = 32 + i; // First char is 32
|
||||
|
||||
defaultFont.chars[i].rec.x = currentPosX;
|
||||
defaultFont.chars[i].rec.y = charsDivisor + currentLine*(charsHeight + charsDivisor);
|
||||
defaultFont.chars[i].rec.width = charsWidth[i];
|
||||
defaultFont.chars[i].rec.height = charsHeight;
|
||||
defaultFont.chars[i].rec.x = (float) currentPosX;
|
||||
defaultFont.chars[i].rec.y = (float) charsDivisor + currentLine*(charsHeight + charsDivisor);
|
||||
defaultFont.chars[i].rec.width = (float) charsWidth[i];
|
||||
defaultFont.chars[i].rec.height = (float) charsHeight;
|
||||
|
||||
testPosX += (defaultFont.chars[i].rec.width + charsDivisor);
|
||||
testPosX += (int) (defaultFont.chars[i].rec.width + (float) charsDivisor);
|
||||
|
||||
if (testPosX >= defaultFont.texture.width)
|
||||
{
|
||||
@@ -233,8 +233,8 @@ extern void LoadDefaultFont(void)
|
||||
currentPosX = 2*charsDivisor + charsWidth[i];
|
||||
testPosX = currentPosX;
|
||||
|
||||
defaultFont.chars[i].rec.x = charsDivisor;
|
||||
defaultFont.chars[i].rec.y = charsDivisor + currentLine*(charsHeight + charsDivisor);
|
||||
defaultFont.chars[i].rec.x = (float)charsDivisor;
|
||||
defaultFont.chars[i].rec.y = (float)charsDivisor + currentLine*(charsHeight + charsDivisor);
|
||||
}
|
||||
else currentPosX = testPosX;
|
||||
|
||||
@@ -244,7 +244,7 @@ extern void LoadDefaultFont(void)
|
||||
defaultFont.chars[i].advanceX = 0;
|
||||
}
|
||||
|
||||
defaultFont.baseSize = defaultFont.chars[0].rec.height;
|
||||
defaultFont.baseSize = (int) defaultFont.chars[0].rec.height;
|
||||
|
||||
TraceLog(LOG_INFO, "[TEX ID %i] Default font loaded successfully", defaultFont.texture.id);
|
||||
}
|
||||
@@ -361,14 +361,14 @@ CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int c
|
||||
if (!stbtt_InitFont(&fontInfo, fontBuffer, 0)) TraceLog(LOG_WARNING, "Failed to init font!");
|
||||
|
||||
// Calculate font scale factor
|
||||
float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, fontSize);
|
||||
float scaleFactor = stbtt_ScaleForPixelHeight(&fontInfo, (float) fontSize);
|
||||
|
||||
// Calculate font basic metrics
|
||||
// NOTE: ascent is equivalent to font baseline
|
||||
int ascent, descent, lineGap;
|
||||
stbtt_GetFontVMetrics(&fontInfo, &ascent, &descent, &lineGap);
|
||||
ascent *= scaleFactor;
|
||||
descent *= scaleFactor;
|
||||
ascent *= (int) scaleFactor;
|
||||
descent *= (int) scaleFactor;
|
||||
|
||||
// Fill fontChars in case not provided externally
|
||||
// NOTE: By default we fill charsCount consecutevely, starting at 32 (Space)
|
||||
@@ -407,7 +407,7 @@ CharInfo *LoadFontData(const char *fileName, int fontSize, int *fontChars, int c
|
||||
TraceLog(LOG_DEBUG, "Character offsetY: %i", ascent + chY1);
|
||||
|
||||
stbtt_GetCodepointHMetrics(&fontInfo, ch, &chars[i].advanceX, NULL);
|
||||
chars[i].advanceX *= scaleFactor;
|
||||
chars[i].advanceX *= (int) scaleFactor;
|
||||
}
|
||||
|
||||
free(fontBuffer);
|
||||
@@ -460,8 +460,8 @@ Image GenImageFontAtlas(CharInfo *chars, int charsCount, int fontSize, int paddi
|
||||
}
|
||||
}
|
||||
|
||||
chars[i].rec.x = offsetX;
|
||||
chars[i].rec.y = offsetY;
|
||||
chars[i].rec.x = (float) offsetX;
|
||||
chars[i].rec.y = (float) offsetY;
|
||||
|
||||
// Move atlas position X for next character drawing
|
||||
offsetX += ((int)chars[i].rec.width + 2*padding);
|
||||
@@ -502,8 +502,8 @@ Image GenImageFontAtlas(CharInfo *chars, int charsCount, int fontSize, int paddi
|
||||
|
||||
for (int i = 0; i < charsCount; i++)
|
||||
{
|
||||
chars[i].rec.x = rects[i].x + padding;
|
||||
chars[i].rec.y = rects[i].y + padding;
|
||||
chars[i].rec.x = rects[i].x + (float) padding;
|
||||
chars[i].rec.y = rects[i].y + (float) padding;
|
||||
|
||||
if (rects[i].was_packed)
|
||||
{
|
||||
@@ -834,15 +834,15 @@ static Font LoadImageFont(Image image, Color key, int firstChar)
|
||||
{
|
||||
tempCharValues[index] = firstChar + index;
|
||||
|
||||
tempCharRecs[index].x = xPosToRead;
|
||||
tempCharRecs[index].y = lineSpacing + lineToRead*(charHeight + lineSpacing);
|
||||
tempCharRecs[index].height = charHeight;
|
||||
tempCharRecs[index].x = (float) xPosToRead;
|
||||
tempCharRecs[index].y = (float) (lineSpacing + lineToRead*(charHeight + lineSpacing));
|
||||
tempCharRecs[index].height = (float) charHeight;
|
||||
|
||||
int charWidth = 0;
|
||||
|
||||
while (!COLOR_EQUAL(pixels[(lineSpacing + (charHeight+lineSpacing)*lineToRead)*image.width + xPosToRead + charWidth], key)) charWidth++;
|
||||
|
||||
tempCharRecs[index].width = charWidth;
|
||||
tempCharRecs[index].width = (float) charWidth;
|
||||
|
||||
index++;
|
||||
|
||||
@@ -887,7 +887,7 @@ static Font LoadImageFont(Image image, Color key, int firstChar)
|
||||
spriteFont.chars[i].advanceX = 0;
|
||||
}
|
||||
|
||||
spriteFont.baseSize = spriteFont.chars[0].rec.height;
|
||||
spriteFont.baseSize = (int) spriteFont.chars[0].rec.height;
|
||||
|
||||
TraceLog(LOG_INFO, "Image file loaded correctly as Font");
|
||||
|
||||
@@ -996,7 +996,7 @@ static Font LoadBMFont(const char *fileName)
|
||||
|
||||
// Save data properly in sprite font
|
||||
font.chars[i].value = charId;
|
||||
font.chars[i].rec = (Rectangle){ charX, charY, charWidth, charHeight };
|
||||
font.chars[i].rec = (Rectangle){ (float) charX, (float) charY, (float) charWidth, (float) charHeight };
|
||||
font.chars[i].offsetX = charOffsetX;
|
||||
font.chars[i].offsetY = charOffsetY;
|
||||
font.chars[i].advanceX = charAdvanceX;
|
||||
|
Reference in New Issue
Block a user