Supress most warnings on rmodels.c (#2029)
* Supress most warnings on rmodels.c NOTE: unused symbols have been deleted and the following report will show in what location they were previously. Unused symbols: - ArrayInt - vox_loader.h: line 84 - initArrayInt - vox_loader.h: line 168 - insertArrayInt - vox_loader.h: line 175 - freeArrayInt - vox_loader.h: line 186 - offsetX, offsetY, offsetZ - vox_loader.h: line 610 - chunkTotalChildSize - vox_loader.h: line 623 Other warnings: - initialization discards 'const' qualifier - vox_loader.h: line 572 - incompatible types for VoxVector3 and Vector3 - rmodels.c: line 5748 - incompatible types for VoxColor and Color - rmodels: line 5749 * Remove ToVector3 and ToColor functions and assign values directly
This commit is contained in:
parent
f869229b7f
commit
9fce26bb06
44
src/external/vox_loader.h
vendored
44
src/external/vox_loader.h
vendored
@ -42,6 +42,7 @@ revision history:
|
|||||||
Removed Raylib dependencies
|
Removed Raylib dependencies
|
||||||
Changed Vox_LoadFileName to Vox_LoadFromMemory
|
Changed Vox_LoadFileName to Vox_LoadFromMemory
|
||||||
1.02 (2021-09-10) @raysan5: Reviewed some formating
|
1.02 (2021-09-10) @raysan5: Reviewed some formating
|
||||||
|
1.03 (2021-10-02) @catmanl: Reduce warnings on gcc
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -80,11 +81,6 @@ typedef struct {
|
|||||||
float x, y, z;
|
float x, y, z;
|
||||||
} VoxVector3;
|
} VoxVector3;
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int* array;
|
|
||||||
int used, size;
|
|
||||||
} ArrayInt;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
VoxVector3* array;
|
VoxVector3* array;
|
||||||
int used, size;
|
int used, size;
|
||||||
@ -142,7 +138,7 @@ extern "C" { // Prevents name mangling of functions
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
int Vox_LoadFromMemory(const unsigned char* pvoxData, unsigned int voxDataSize, VoxArray3D* pvoxarray);
|
int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArray3D* pvoxarray);
|
||||||
void Vox_FreeArrays(VoxArray3D* voxarray);
|
void Vox_FreeArrays(VoxArray3D* voxarray);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@ -161,35 +157,6 @@ void Vox_FreeArrays(VoxArray3D* voxarray);
|
|||||||
|
|
||||||
#ifdef VOX_LOADER_IMPLEMENTATION
|
#ifdef VOX_LOADER_IMPLEMENTATION
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// ArrayInt helper
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
static void initArrayInt(ArrayInt* a, int initialSize)
|
|
||||||
{
|
|
||||||
a->array = VOX_MALLOC(initialSize * sizeof(int));
|
|
||||||
a->used = 0;
|
|
||||||
a->size = initialSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void insertArrayInt(ArrayInt* a, int element)
|
|
||||||
{
|
|
||||||
if (a->used == a->size)
|
|
||||||
{
|
|
||||||
a->size *= 2;
|
|
||||||
a->array = VOX_REALLOC(a->array, a->size * sizeof(int));
|
|
||||||
}
|
|
||||||
|
|
||||||
a->array[a->used++] = element;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void freeArrayInt(ArrayInt* a)
|
|
||||||
{
|
|
||||||
VOX_FREE(a->array);
|
|
||||||
a->array = NULL;
|
|
||||||
a->used = a->size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// ArrayUShort helper
|
// ArrayUShort helper
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -560,7 +527,7 @@ static void Vox_Build_Voxel(VoxArray3D* pvoxArray, int x, int y, int z, int matI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MagicaVoxel *.vox file format Loader
|
// MagicaVoxel *.vox file format Loader
|
||||||
int Vox_LoadFromMemory(const unsigned char* pvoxData, unsigned int voxDataSize, VoxArray3D* pvoxarray)
|
int Vox_LoadFromMemory(unsigned char* pvoxData, unsigned int voxDataSize, VoxArray3D* pvoxarray)
|
||||||
{
|
{
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
//Read VOX file
|
//Read VOX file
|
||||||
@ -607,8 +574,6 @@ int Vox_LoadFromMemory(const unsigned char* pvoxData, unsigned int voxDataSize,
|
|||||||
unsigned long sizeX, sizeY, sizeZ;
|
unsigned long sizeX, sizeY, sizeZ;
|
||||||
sizeX = sizeY = sizeZ = 0;
|
sizeX = sizeY = sizeZ = 0;
|
||||||
unsigned long numVoxels = 0;
|
unsigned long numVoxels = 0;
|
||||||
int offsetX, offsetY, offsetZ;
|
|
||||||
offsetX = offsetY = offsetZ = 0;
|
|
||||||
|
|
||||||
while (fileDataPtr < endfileDataPtr)
|
while (fileDataPtr < endfileDataPtr)
|
||||||
{
|
{
|
||||||
@ -620,9 +585,6 @@ int Vox_LoadFromMemory(const unsigned char* pvoxData, unsigned int voxDataSize,
|
|||||||
unsigned long chunkSize = *((unsigned long*)fileDataPtr);
|
unsigned long chunkSize = *((unsigned long*)fileDataPtr);
|
||||||
fileDataPtr += sizeof(unsigned long);
|
fileDataPtr += sizeof(unsigned long);
|
||||||
|
|
||||||
unsigned long chunkTotalChildSize = *((unsigned long*)fileDataPtr);
|
|
||||||
fileDataPtr += sizeof(unsigned long);
|
|
||||||
|
|
||||||
if (strcmp(szChunkName, "SIZE") == 0)
|
if (strcmp(szChunkName, "SIZE") == 0)
|
||||||
{
|
{
|
||||||
//(4 bytes x 3 : x, y, z )
|
//(4 bytes x 3 : x, y, z )
|
||||||
|
@ -5745,8 +5745,18 @@ static Model LoadVOX(const char *fileName)
|
|||||||
int verticesRemain = voxarray.vertices.used;
|
int verticesRemain = voxarray.vertices.used;
|
||||||
int verticesMax = 65532; // 5461 voxels x 12 vertices per voxel -> 65532 (must be inf 65536)
|
int verticesMax = 65532; // 5461 voxels x 12 vertices per voxel -> 65532 (must be inf 65536)
|
||||||
|
|
||||||
Vector3 *pvertices = voxarray.vertices.array; // 6*4 = 12 vertices per voxel
|
// 6*4 = 12 vertices per voxel
|
||||||
Color *pcolors = voxarray.colors.array;
|
Vector3 *pvertices = { 0 };
|
||||||
|
pvertices->x = voxarray.vertices.array->x;
|
||||||
|
pvertices->y = voxarray.vertices.array->y;
|
||||||
|
pvertices->z = voxarray.vertices.array->z;
|
||||||
|
|
||||||
|
Color *pcolors = { 0 };
|
||||||
|
pcolors->r = voxarray.colors.array->r;
|
||||||
|
pcolors->g = voxarray.colors.array->g;
|
||||||
|
pcolors->b = voxarray.colors.array->b;
|
||||||
|
pcolors->a = voxarray.colors.array->a;
|
||||||
|
|
||||||
unsigned short *pindices = voxarray.indices.array; // 5461*6*6 = 196596 indices max per mesh
|
unsigned short *pindices = voxarray.indices.array; // 5461*6*6 = 196596 indices max per mesh
|
||||||
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user