aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2017-04-24 00:18:53 +0200
committerGitHub <noreply@github.com>2017-04-24 00:18:53 +0200
commit71fe3c0b086c9cf7707d9ef455c57360f88be8a1 (patch)
tree1d1b7dfc780fd6049f68b5d69d9194add1302dfd /src
parent0ed82150f0228c949c36f9ee83d4c2e0c92f9d0e (diff)
parent9a515ae9db9f63d5bfa8545cfbbfdce683daf5f6 (diff)
downloadraylib-71fe3c0b086c9cf7707d9ef455c57360f88be8a1.tar.gz
raylib-71fe3c0b086c9cf7707d9ef455c57360f88be8a1.zip
Merge pull request #269 from raysan5/develop
Integrate develop branch
Diffstat (limited to 'src')
-rw-r--r--src/audio.c3
-rw-r--r--src/core.c2
-rw-r--r--src/external/stb_vorbis.c2
-rw-r--r--src/models.c114
-rw-r--r--src/raylib.h63
-rw-r--r--src/rlgl.c20
-rw-r--r--src/rlgl.h2
-rw-r--r--src/text.c6
-rw-r--r--src/textures.c4
-rw-r--r--src/utils.h4
10 files changed, 119 insertions, 101 deletions
diff --git a/src/audio.c b/src/audio.c
index 34be4789..d63047a8 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -68,6 +68,7 @@
//-------------------------------------------------
#define SUPPORT_FILEFORMAT_WAV
#define SUPPORT_FILEFORMAT_OGG
+#define SUPPORT_FILEFORMAT_XM
//-------------------------------------------------
#if defined(AUDIO_STANDALONE)
@@ -75,7 +76,7 @@
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
#else
#include "raylib.h"
- #include "utils.h" // Required for: fopen() Android mapping, TraceLog()
+ #include "utils.h" // Required for: fopen() Android mapping
#endif
#ifdef __APPLE__
diff --git a/src/core.c b/src/core.c
index 3f3bc6ea..ee069d97 100644
--- a/src/core.c
+++ b/src/core.c
@@ -81,7 +81,7 @@
#include "raylib.h"
#include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2
-#include "utils.h" // Required for: fopen() Android mapping, TraceLog()
+#include "utils.h" // Required for: fopen() Android mapping
#define RAYMATH_IMPLEMENTATION // Use raymath as a header-only library (includes implementation)
#define RAYMATH_EXTERN_INLINE // Compile raymath functions as static inline (remember, it's a compiler hint)
diff --git a/src/external/stb_vorbis.c b/src/external/stb_vorbis.c
index ac8c9ca5..21638bcd 100644
--- a/src/external/stb_vorbis.c
+++ b/src/external/stb_vorbis.c
@@ -168,7 +168,7 @@
#include <math.h>
// find definition of alloca if it's not in stdlib.h:
- #ifdef _MSC_VER
+ #if defined(_MSC_VER) || defined(__MINGW32__)
#include <malloc.h>
#endif
#if defined(__linux__) || defined(__linux) || defined(__EMSCRIPTEN__)
diff --git a/src/models.c b/src/models.c
index 55311a02..fa6faf16 100644
--- a/src/models.c
+++ b/src/models.c
@@ -607,13 +607,13 @@ Mesh LoadMesh(const char *fileName)
}
// Load mesh from vertex data
-// NOTE: All vertex data arrays must be same size: numVertex
-Mesh LoadMeshEx(int numVertex, float *vData, float *vtData, float *vnData, Color *cData)
+// NOTE: All vertex data arrays must be same size: vertexCount
+Mesh LoadMeshEx(int vertexCount, float *vData, float *vtData, float *vnData, Color *cData)
{
Mesh mesh = { 0 };
- mesh.vertexCount = numVertex;
- mesh.triangleCount = numVertex/3;
+ mesh.vertexCount = vertexCount;
+ mesh.triangleCount = vertexCount/3;
mesh.vertices = vData;
mesh.texcoords = vtData;
mesh.texcoords2 = NULL;
@@ -754,9 +754,9 @@ static Mesh GenMeshHeightmap(Image heightmap, Vector3 size)
Color *pixels = GetImageData(heightmap);
// NOTE: One vertex per pixel
- int numTriangles = (mapX-1)*(mapZ-1)*2; // One quad every four pixels
+ int triangleCount = (mapX-1)*(mapZ-1)*2; // One quad every four pixels
- mesh.vertexCount = numTriangles*3;
+ mesh.vertexCount = triangleCount*3;
mesh.vertices = (float *)malloc(mesh.vertexCount*3*sizeof(float));
mesh.normals = (float *)malloc(mesh.vertexCount*3*sizeof(float));
@@ -1615,10 +1615,10 @@ static Mesh LoadOBJ(const char *fileName)
char dataType;
char comments[200];
- int numVertex = 0;
- int numNormals = 0;
- int numTexCoords = 0;
- int numTriangles = 0;
+ int vertexCount = 0;
+ int normalCount = 0;
+ int texcoordCount = 0;
+ int triangleCount = 0;
FILE *objFile;
@@ -1630,7 +1630,7 @@ static Mesh LoadOBJ(const char *fileName)
return mesh;
}
- // First reading pass: Get numVertex, numNormals, numTexCoords, numTriangles
+ // First reading pass: Get vertexCount, normalCount, texcoordCount, triangleCount
// NOTE: vertex, texcoords and normals could be optimized (to be used indexed on faces definition)
// NOTE: faces MUST be defined as TRIANGLES (3 vertex per face)
while (!feof(objFile))
@@ -1654,40 +1654,40 @@ static Mesh LoadOBJ(const char *fileName)
if (dataType == 't') // Read texCoord
{
- numTexCoords++;
+ texcoordCount++;
fgets(comments, 200, objFile);
}
else if (dataType == 'n') // Read normals
{
- numNormals++;
+ normalCount++;
fgets(comments, 200, objFile);
}
else // Read vertex
{
- numVertex++;
+ vertexCount++;
fgets(comments, 200, objFile);
}
} break;
case 'f':
{
- numTriangles++;
+ triangleCount++;
fgets(comments, 200, objFile);
} break;
default: break;
}
}
- TraceLog(DEBUG, "[%s] Model num vertices: %i", fileName, numVertex);
- TraceLog(DEBUG, "[%s] Model num texcoords: %i", fileName, numTexCoords);
- TraceLog(DEBUG, "[%s] Model num normals: %i", fileName, numNormals);
- TraceLog(DEBUG, "[%s] Model num triangles: %i", fileName, numTriangles);
+ TraceLog(DEBUG, "[%s] Model vertices: %i", fileName, vertexCount);
+ TraceLog(DEBUG, "[%s] Model texcoords: %i", fileName, texcoordCount);
+ TraceLog(DEBUG, "[%s] Model normals: %i", fileName, normalCount);
+ TraceLog(DEBUG, "[%s] Model triangles: %i", fileName, triangleCount);
// Once we know the number of vertices to store, we create required arrays
- Vector3 *midVertices = (Vector3 *)malloc(numVertex*sizeof(Vector3));
+ Vector3 *midVertices = (Vector3 *)malloc(vertexCount*sizeof(Vector3));
Vector3 *midNormals = NULL;
- if (numNormals > 0) midNormals = (Vector3 *)malloc(numNormals*sizeof(Vector3));
+ if (normalCount > 0) midNormals = (Vector3 *)malloc(normalCount*sizeof(Vector3));
Vector2 *midTexCoords = NULL;
- if (numTexCoords > 0) midTexCoords = (Vector2 *)malloc(numTexCoords*sizeof(Vector2));
+ if (texcoordCount > 0) midTexCoords = (Vector2 *)malloc(texcoordCount*sizeof(Vector2));
int countVertex = 0;
int countNormals = 0;
@@ -1738,7 +1738,7 @@ static Mesh LoadOBJ(const char *fileName)
// At this point all vertex data (v, vt, vn) has been gathered on midVertices, midTexCoords, midNormals
// Now we can organize that data into our Mesh struct
- mesh.vertexCount = numTriangles*3;
+ mesh.vertexCount = triangleCount*3;
// Additional arrays to store vertex data as floats
mesh.vertices = (float *)malloc(mesh.vertexCount*3*sizeof(float));
@@ -1750,11 +1750,11 @@ static Mesh LoadOBJ(const char *fileName)
int tcCounter = 0; // Used to count texcoords float by float
int nCounter = 0; // Used to count normals float by float
- int vNum[3], vtNum[3], vnNum[3]; // Used to store triangle indices for v, vt, vn
+ int vCount[3], vtCount[3], vnCount[3]; // Used to store triangle indices for v, vt, vn
rewind(objFile); // Return to the beginning of the file, to read again
- if (numNormals == 0) TraceLog(INFO, "[%s] No normals data on OBJ, normals will be generated from faces data", fileName);
+ if (normalCount == 0) TraceLog(INFO, "[%s] No normals data on OBJ, normals will be generated from faces data", fileName);
// Third reading pass: Get faces (triangles) data and fill VertexArray
while (!feof(objFile))
@@ -1768,43 +1768,43 @@ static Mesh LoadOBJ(const char *fileName)
{
// NOTE: It could be that OBJ does not have normals or texcoords defined!
- if ((numNormals == 0) && (numTexCoords == 0)) fscanf(objFile, "%i %i %i", &vNum[0], &vNum[1], &vNum[2]);
- else if (numNormals == 0) fscanf(objFile, "%i/%i %i/%i %i/%i", &vNum[0], &vtNum[0], &vNum[1], &vtNum[1], &vNum[2], &vtNum[2]);
- else if (numTexCoords == 0) fscanf(objFile, "%i//%i %i//%i %i//%i", &vNum[0], &vnNum[0], &vNum[1], &vnNum[1], &vNum[2], &vnNum[2]);
- else fscanf(objFile, "%i/%i/%i %i/%i/%i %i/%i/%i", &vNum[0], &vtNum[0], &vnNum[0], &vNum[1], &vtNum[1], &vnNum[1], &vNum[2], &vtNum[2], &vnNum[2]);
+ if ((normalCount == 0) && (texcoordCount == 0)) fscanf(objFile, "%i %i %i", &vCount[0], &vCount[1], &vCount[2]);
+ else if (normalCount == 0) fscanf(objFile, "%i/%i %i/%i %i/%i", &vCount[0], &vtCount[0], &vCount[1], &vtCount[1], &vCount[2], &vtCount[2]);
+ else if (texcoordCount == 0) fscanf(objFile, "%i//%i %i//%i %i//%i", &vCount[0], &vnCount[0], &vCount[1], &vnCount[1], &vCount[2], &vnCount[2]);
+ else fscanf(objFile, "%i/%i/%i %i/%i/%i %i/%i/%i", &vCount[0], &vtCount[0], &vnCount[0], &vCount[1], &vtCount[1], &vnCount[1], &vCount[2], &vtCount[2], &vnCount[2]);
- mesh.vertices[vCounter] = midVertices[vNum[0]-1].x;
- mesh.vertices[vCounter + 1] = midVertices[vNum[0]-1].y;
- mesh.vertices[vCounter + 2] = midVertices[vNum[0]-1].z;
+ mesh.vertices[vCounter] = midVertices[vCount[0]-1].x;
+ mesh.vertices[vCounter + 1] = midVertices[vCount[0]-1].y;
+ mesh.vertices[vCounter + 2] = midVertices[vCount[0]-1].z;
vCounter += 3;
- mesh.vertices[vCounter] = midVertices[vNum[1]-1].x;
- mesh.vertices[vCounter + 1] = midVertices[vNum[1]-1].y;
- mesh.vertices[vCounter + 2] = midVertices[vNum[1]-1].z;
+ mesh.vertices[vCounter] = midVertices[vCount[1]-1].x;
+ mesh.vertices[vCounter + 1] = midVertices[vCount[1]-1].y;
+ mesh.vertices[vCounter + 2] = midVertices[vCount[1]-1].z;
vCounter += 3;
- mesh.vertices[vCounter] = midVertices[vNum[2]-1].x;
- mesh.vertices[vCounter + 1] = midVertices[vNum[2]-1].y;
- mesh.vertices[vCounter + 2] = midVertices[vNum[2]-1].z;
+ mesh.vertices[vCounter] = midVertices[vCount[2]-1].x;
+ mesh.vertices[vCounter + 1] = midVertices[vCount[2]-1].y;
+ mesh.vertices[vCounter + 2] = midVertices[vCount[2]-1].z;
vCounter += 3;
- if (numNormals > 0)
+ if (normalCount > 0)
{
- mesh.normals[nCounter] = midNormals[vnNum[0]-1].x;
- mesh.normals[nCounter + 1] = midNormals[vnNum[0]-1].y;
- mesh.normals[nCounter + 2] = midNormals[vnNum[0]-1].z;
+ mesh.normals[nCounter] = midNormals[vnCount[0]-1].x;
+ mesh.normals[nCounter + 1] = midNormals[vnCount[0]-1].y;
+ mesh.normals[nCounter + 2] = midNormals[vnCount[0]-1].z;
nCounter += 3;
- mesh.normals[nCounter] = midNormals[vnNum[1]-1].x;
- mesh.normals[nCounter + 1] = midNormals[vnNum[1]-1].y;
- mesh.normals[nCounter + 2] = midNormals[vnNum[1]-1].z;
+ mesh.normals[nCounter] = midNormals[vnCount[1]-1].x;
+ mesh.normals[nCounter + 1] = midNormals[vnCount[1]-1].y;
+ mesh.normals[nCounter + 2] = midNormals[vnCount[1]-1].z;
nCounter += 3;
- mesh.normals[nCounter] = midNormals[vnNum[2]-1].x;
- mesh.normals[nCounter + 1] = midNormals[vnNum[2]-1].y;
- mesh.normals[nCounter + 2] = midNormals[vnNum[2]-1].z;
+ mesh.normals[nCounter] = midNormals[vnCount[2]-1].x;
+ mesh.normals[nCounter + 1] = midNormals[vnCount[2]-1].y;
+ mesh.normals[nCounter + 2] = midNormals[vnCount[2]-1].z;
nCounter += 3;
}
else
{
// If normals not defined, they are calculated from the 3 vertices [N = (V2 - V1) x (V3 - V1)]
- Vector3 norm = VectorCrossProduct(VectorSubtract(midVertices[vNum[1]-1], midVertices[vNum[0]-1]), VectorSubtract(midVertices[vNum[2]-1], midVertices[vNum[0]-1]));
+ Vector3 norm = VectorCrossProduct(VectorSubtract(midVertices[vCount[1]-1], midVertices[vCount[0]-1]), VectorSubtract(midVertices[vCount[2]-1], midVertices[vCount[0]-1]));
VectorNormalize(&norm);
mesh.normals[nCounter] = norm.x;
@@ -1821,18 +1821,18 @@ static Mesh LoadOBJ(const char *fileName)
nCounter += 3;
}
- if (numTexCoords > 0)
+ if (texcoordCount > 0)
{
// NOTE: If using negative texture coordinates with a texture filter of GL_CLAMP_TO_EDGE doesn't work!
// NOTE: Texture coordinates are Y flipped upside-down
- mesh.texcoords[tcCounter] = midTexCoords[vtNum[0]-1].x;
- mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtNum[0]-1].y;
+ mesh.texcoords[tcCounter] = midTexCoords[vtCount[0]-1].x;
+ mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtCount[0]-1].y;
tcCounter += 2;
- mesh.texcoords[tcCounter] = midTexCoords[vtNum[1]-1].x;
- mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtNum[1]-1].y;
+ mesh.texcoords[tcCounter] = midTexCoords[vtCount[1]-1].x;
+ mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtCount[1]-1].y;
tcCounter += 2;
- mesh.texcoords[tcCounter] = midTexCoords[vtNum[2]-1].x;
- mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtNum[2]-1].y;
+ mesh.texcoords[tcCounter] = midTexCoords[vtCount[2]-1].x;
+ mesh.texcoords[tcCounter + 1] = 1.0f - midTexCoords[vtCount[2]-1].y;
tcCounter += 2;
}
} break;
@@ -1843,7 +1843,7 @@ static Mesh LoadOBJ(const char *fileName)
fclose(objFile);
// Security check, just in case no normals or no texcoords defined in OBJ
- if (numTexCoords == 0) for (int i = 0; i < (2*mesh.vertexCount); i++) mesh.texcoords[i] = 0.0f;
+ if (texcoordCount == 0) for (int i = 0; i < (2*mesh.vertexCount); i++) mesh.texcoords[i] = 0.0f;
else
{
// Attempt to calculate mesh tangents and binormals using positions and texture coordinates
diff --git a/src/raylib.h b/src/raylib.h
index b82ec342..18d442d1 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -74,7 +74,6 @@
//#define PLATFORM_ANDROID // Android device
//#define PLATFORM_RPI // Raspberry Pi
//#define PLATFORM_WEB // HTML5 (emscripten, asm.js)
-//#define RLGL_OCULUS_SUPPORT // Oculus Rift CV1 (complementary to PLATFORM_DESKTOP)
// Security check in case no PLATFORM_* defined
#if !defined(PLATFORM_DESKTOP) && !defined(PLATFORM_ANDROID) && !defined(PLATFORM_RPI) && !defined(PLATFORM_WEB)
@@ -295,7 +294,7 @@
#define RAYWHITE CLITERAL{ 245, 245, 245, 255 } // My own White (raylib logo)
//----------------------------------------------------------------------------------
-// Types and Structures Definition
+// Structures Definition
//----------------------------------------------------------------------------------
#ifndef __cplusplus
// Boolean type
@@ -516,6 +515,34 @@ typedef struct AudioStream {
unsigned int buffers[2]; // OpenAL audio buffers (double buffering)
} AudioStream;
+// rRES data returned when reading a resource,
+// it contains all required data for user (24 byte)
+typedef struct RRESData {
+ unsigned int type; // Resource type (4 byte)
+
+ unsigned int param1; // Resouce parameter 1 (4 byte)
+ unsigned int param2; // Resouce parameter 2 (4 byte)
+ unsigned int param3; // Resouce parameter 3 (4 byte)
+ unsigned int param4; // Resouce parameter 4 (4 byte)
+
+ void *data; // Resource data pointer (4 byte)
+} RRESData;
+
+// RRES type (pointer to RRESData array)
+typedef struct RRESData *RRES;
+
+//----------------------------------------------------------------------------------
+// Enumerators Definition
+//----------------------------------------------------------------------------------
+// Trace log type
+typedef enum {
+ INFO = 0,
+ WARNING,
+ ERROR,
+ DEBUG,
+ OTHER
+} LogType;
+
// Texture formats
// NOTE: Support depends on OpenGL version and platform
typedef enum {
@@ -552,10 +579,18 @@ typedef enum {
} TextureFilterMode;
// Texture parameters: wrap mode
-typedef enum { WRAP_REPEAT = 0, WRAP_CLAMP, WRAP_MIRROR } TextureWrapMode;
+typedef enum {
+ WRAP_REPEAT = 0,
+ WRAP_CLAMP,
+ WRAP_MIRROR
+} TextureWrapMode;
// Color blending modes (pre-defined)
-typedef enum { BLEND_ALPHA = 0, BLEND_ADDITIVE, BLEND_MULTIPLIED } BlendMode;
+typedef enum {
+ BLEND_ALPHA = 0,
+ BLEND_ADDITIVE,
+ BLEND_MULTIPLIED
+} BlendMode;
// Gestures type
// NOTE: It could be used as flags to enable only some gestures
@@ -595,19 +630,6 @@ typedef enum {
HMD_FOVE_VR,
} VrDevice;
-// rRES data returned when reading a resource,
-// it contains all required data for user (24 byte)
-typedef struct RRESData {
- unsigned int type; // Resource type (4 byte)
-
- unsigned int param1; // Resouce parameter 1 (4 byte)
- unsigned int param2; // Resouce parameter 2 (4 byte)
- unsigned int param3; // Resouce parameter 3 (4 byte)
- unsigned int param4; // Resouce parameter 4 (4 byte)
-
- void *data; // Resource data pointer (4 byte)
-} RRESData;
-
// RRESData type
typedef enum {
RRES_TYPE_RAW = 0,
@@ -620,9 +642,6 @@ typedef enum {
RRES_TYPE_DIRECTORY
} RRESDataType;
-// RRES type (pointer to RRESData array)
-typedef struct RRESData *RRES;
-
#ifdef __cplusplus
extern "C" { // Prevents name mangling of functions
#endif
@@ -689,7 +708,7 @@ RLAPI Color Fade(Color color, float alpha); // Color fade-
RLAPI void ShowLogo(void); // Activates raylib logo at startup (can be done with flags)
RLAPI void SetConfigFlags(char flags); // Setup some window configuration flags
-//RLAPI void TraceLog(int logType, const char *text, ...); // Show trace log messages (INFO, WARNING, ERROR, DEBUG)
+RLAPI void TraceLog(int logType, const char *text, ...); // Show trace log messages (INFO, WARNING, ERROR, DEBUG)
RLAPI void TakeScreenshot(void); // Takes a screenshot and saves it in the same folder as executable
RLAPI bool IsFileExtension(const char *fileName, const char *ext);// Check file extension
@@ -847,7 +866,7 @@ RLAPI void DrawTexturePro(Texture2D texture, Rectangle sourceRec, Rectangle dest
//------------------------------------------------------------------------------------
RLAPI SpriteFont GetDefaultFont(void); // Get the default SpriteFont
RLAPI SpriteFont LoadSpriteFont(const char *fileName); // Load SpriteFont from file into GPU memory (VRAM)
-RLAPI SpriteFont LoadSpriteFontTTF(const char *fileName, int fontSize, int charsCount, int *fontChars); // Load SpriteFont from TTF font file with generation parameters
+RLAPI SpriteFont LoadSpriteFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars); // Load SpriteFont from file with extended parameters
RLAPI void UnloadSpriteFont(SpriteFont spriteFont); // Unload SpriteFont from GPU memory (VRAM)
RLAPI void DrawText(const char *text, int posX, int posY, int fontSize, Color color); // Draw text (using default font)
diff --git a/src/rlgl.c b/src/rlgl.c
index 3b23d91a..b336571f 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -1331,7 +1331,7 @@ Vector3 rlglUnproject(Vector3 source, Matrix proj, Matrix view)
}
// Convert image data to OpenGL texture (returns OpenGL valid Id)
-unsigned int rlglLoadTexture(void *data, int width, int height, int textureFormat, int mipmapCount)
+unsigned int rlglLoadTexture(void *data, int width, int height, int format, int mipmapCount)
{
glBindTexture(GL_TEXTURE_2D, 0); // Free any old binding
@@ -1339,39 +1339,39 @@ unsigned int rlglLoadTexture(void *data, int width, int height, int textureForma
// Check texture format support by OpenGL 1.1 (compressed textures not supported)
#if defined(GRAPHICS_API_OPENGL_11)
- if (textureFormat >= 8)
+ if (format >= COMPRESSED_DXT1_RGB)
{
TraceLog(WARNING, "OpenGL 1.1 does not support GPU compressed texture formats");
return id;
}
#endif
- if ((!texCompDXTSupported) && ((textureFormat == COMPRESSED_DXT1_RGB) || (textureFormat == COMPRESSED_DXT1_RGBA) ||
- (textureFormat == COMPRESSED_DXT3_RGBA) || (textureFormat == COMPRESSED_DXT5_RGBA)))
+ if ((!texCompDXTSupported) && ((format == COMPRESSED_DXT1_RGB) || (format == COMPRESSED_DXT1_RGBA) ||
+ (format == COMPRESSED_DXT3_RGBA) || (format == COMPRESSED_DXT5_RGBA)))
{
TraceLog(WARNING, "DXT compressed texture format not supported");
return id;
}
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
- if ((!texCompETC1Supported) && (textureFormat == COMPRESSED_ETC1_RGB))
+ if ((!texCompETC1Supported) && (format == COMPRESSED_ETC1_RGB))
{
TraceLog(WARNING, "ETC1 compressed texture format not supported");
return id;
}
- if ((!texCompETC2Supported) && ((textureFormat == COMPRESSED_ETC2_RGB) || (textureFormat == COMPRESSED_ETC2_EAC_RGBA)))
+ if ((!texCompETC2Supported) && ((format == COMPRESSED_ETC2_RGB) || (format == COMPRESSED_ETC2_EAC_RGBA)))
{
TraceLog(WARNING, "ETC2 compressed texture format not supported");
return id;
}
- if ((!texCompPVRTSupported) && ((textureFormat == COMPRESSED_PVRT_RGB) || (textureFormat == COMPRESSED_PVRT_RGBA)))
+ if ((!texCompPVRTSupported) && ((format == COMPRESSED_PVRT_RGB) || (format == COMPRESSED_PVRT_RGBA)))
{
TraceLog(WARNING, "PVRT compressed texture format not supported");
return id;
}
- if ((!texCompASTCSupported) && ((textureFormat == COMPRESSED_ASTC_4x4_RGBA) || (textureFormat == COMPRESSED_ASTC_8x8_RGBA)))
+ if ((!texCompASTCSupported) && ((format == COMPRESSED_ASTC_4x4_RGBA) || (format == COMPRESSED_ASTC_8x8_RGBA)))
{
TraceLog(WARNING, "ASTC compressed texture format not supported");
return id;
@@ -1399,7 +1399,7 @@ unsigned int rlglLoadTexture(void *data, int width, int height, int textureForma
// GL_RGBA8 GL_RGBA GL_UNSIGNED_BYTE
// GL_RGB8 GL_RGB GL_UNSIGNED_BYTE
- switch (textureFormat)
+ switch (format)
{
case UNCOMPRESSED_GRAYSCALE:
{
@@ -1440,7 +1440,7 @@ unsigned int rlglLoadTexture(void *data, int width, int height, int textureForma
}
#elif defined(GRAPHICS_API_OPENGL_11) || defined(GRAPHICS_API_OPENGL_ES2)
// NOTE: on OpenGL ES 2.0 (WebGL), internalFormat must match format and options allowed are: GL_LUMINANCE, GL_RGB, GL_RGBA
- switch (textureFormat)
+ switch (format)
{
case UNCOMPRESSED_GRAYSCALE: glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, width, height, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, (unsigned char *)data); break;
case UNCOMPRESSED_GRAY_ALPHA: glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE_ALPHA, width, height, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, (unsigned char *)data); break;
diff --git a/src/rlgl.h b/src/rlgl.h
index a870a907..f3fd6b22 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -366,7 +366,7 @@ void rlglClose(void); // De-init rlgl
void rlglDraw(void); // Draw VAO/VBO
void rlglLoadExtensions(void *loader); // Load OpenGL extensions
-unsigned int rlglLoadTexture(void *data, int width, int height, int textureFormat, int mipmapCount); // Load texture in GPU
+unsigned int rlglLoadTexture(void *data, int width, int height, int format, int mipmapCount); // Load texture in GPU
RenderTexture2D rlglLoadRenderTexture(int width, int height); // Load a texture to be used for rendering (fbo with color and depth attachments)
void rlglUpdateTexture(unsigned int id, int width, int height, int format, const void *data); // Update GPU texture with new data
void rlglGenerateMipmaps(Texture2D *texture); // Generate mipmap data for selected texture
diff --git a/src/text.c b/src/text.c
index a057e347..cba9a7d6 100644
--- a/src/text.c
+++ b/src/text.c
@@ -50,7 +50,7 @@
#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end()
#include <stdio.h> // Required for: FILE, fopen(), fclose(), fscanf(), feof(), rewind(), fgets()
-#include "utils.h" // Required for: IsFileExtension()
+#include "utils.h" // Required for: fopen() Android mapping
#if defined(SUPPORT_FILEFORMAT_TTF)
// Following libs are used on LoadTTF()
@@ -316,7 +316,7 @@ SpriteFont LoadSpriteFont(const char *fileName)
//UnloadResource(rres[0]);
}
#if defined(SUPPORT_FILEFORMAT_TTF)
- else if (IsFileExtension(fileName, ".ttf")) spriteFont = LoadSpriteFontTTF(fileName, DEFAULT_TTF_FONTSIZE, 0, NULL);
+ else if (IsFileExtension(fileName, ".ttf")) spriteFont = LoadSpriteFontEx(fileName, DEFAULT_TTF_FONTSIZE, 0, NULL);
#endif
#if defined(SUPPORT_FILEFORMAT_FNT)
else if (IsFileExtension(fileName, ".fnt")) spriteFont = LoadBMFont(fileName);
@@ -341,7 +341,7 @@ SpriteFont LoadSpriteFont(const char *fileName)
// Load SpriteFont from TTF font file with generation parameters
// NOTE: You can pass an array with desired characters, those characters should be available in the font
// if array is NULL, default char set is selected 32..126
-SpriteFont LoadSpriteFontTTF(const char *fileName, int fontSize, int charsCount, int *fontChars)
+SpriteFont LoadSpriteFontEx(const char *fileName, int fontSize, int charsCount, int *fontChars)
{
SpriteFont spriteFont = { 0 };
diff --git a/src/textures.c b/src/textures.c
index 9fd5944e..6c56d6c5 100644
--- a/src/textures.c
+++ b/src/textures.c
@@ -65,7 +65,7 @@
// Required for: rlglLoadTexture() rlDeleteTextures(),
// rlglGenerateMipmaps(), some funcs for DrawTexturePro()
-#include "utils.h" // Required for: fopen() Android mapping, TraceLog()
+#include "utils.h" // Required for: fopen() Android mapping
// Support only desired texture formats on stb_image
#if !defined(SUPPORT_FILEFORMAT_BMP)
@@ -379,6 +379,8 @@ Texture2D LoadTextureFromImage(Image image)
texture.height = image.height;
texture.mipmaps = image.mipmaps;
texture.format = image.format;
+
+ TraceLog(INFO, "[TEX %i] Parameters: %ix%i, %i mips, format %i", texture.id, texture.width, texture.height, texture.mipmaps, texture.format);
return texture;
}
diff --git a/src/utils.h b/src/utils.h
index 2b4d838b..64592c73 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -46,8 +46,6 @@
//----------------------------------------------------------------------------------
// Types and Structures Definition
//----------------------------------------------------------------------------------
-typedef enum { INFO = 0, ERROR, WARNING, DEBUG, OTHER } TraceLogType;
-
#ifdef __cplusplus
extern "C" { // Prevents name mangling of functions
#endif
@@ -60,8 +58,6 @@ extern "C" { // Prevents name mangling of functions
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
-void TraceLog(int msgType, const char *text, ...); // Outputs a trace log message
-
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_RPI)
#if defined(SUPPORT_SAVE_BMP)
void SaveBMP(const char *fileName, unsigned char *imgData, int width, int height, int compSize);