Remove trailing spaces
This commit is contained in:
parent
0776f1e106
commit
9e7ca41f58
22
src/core.c
22
src/core.c
@ -800,7 +800,7 @@ void InitWindow(int width, int height, const char *title)
|
||||
|
||||
// Initialize assets manager
|
||||
InitAssetManager(CORE.Android.app->activity->assetManager, CORE.Android.app->activity->internalDataPath);
|
||||
|
||||
|
||||
// Initialize base path for storage
|
||||
CORE.Storage.basePath = CORE.Android.app->activity->internalDataPath;
|
||||
|
||||
@ -838,10 +838,10 @@ void InitWindow(int width, int height, const char *title)
|
||||
|
||||
// Initialize hi-res timer
|
||||
InitTimer();
|
||||
|
||||
|
||||
// Initialize random seed
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
|
||||
// Initialize base path for storage
|
||||
CORE.Storage.basePath = GetWorkingDirectory();
|
||||
|
||||
@ -1945,7 +1945,7 @@ void BeginDrawing(void)
|
||||
{
|
||||
// WARNING: Previously to BeginDrawing() other render textures drawing could happen,
|
||||
// consequently the measure for update vs draw is not accurate (only the total frame time is accurate)
|
||||
|
||||
|
||||
CORE.Time.current = GetTime(); // Number of elapsed seconds since InitTimer()
|
||||
CORE.Time.update = CORE.Time.current - CORE.Time.previous;
|
||||
CORE.Time.previous = CORE.Time.current;
|
||||
@ -2347,7 +2347,7 @@ RLAPI Shader LoadShaderFromMemory(const char *vsCode, const char *fsCode)
|
||||
{
|
||||
Shader shader = { 0 };
|
||||
shader.locs = (int *)RL_CALLOC(MAX_SHADER_LOCATIONS, sizeof(int));
|
||||
|
||||
|
||||
// NOTE: All locations must be reseted to -1 (no location)
|
||||
for (int i = 0; i < MAX_SHADER_LOCATIONS; i++) shader.locs[i] = -1;
|
||||
|
||||
@ -3113,7 +3113,7 @@ bool SaveStorageValue(unsigned int position, int value)
|
||||
|
||||
success = SaveFileData(path, newFileData, newDataSize);
|
||||
RL_FREE(newFileData);
|
||||
|
||||
|
||||
TRACELOG(LOG_INFO, "FILEIO: [%s] Saved storage value: %i", path, value);
|
||||
}
|
||||
else
|
||||
@ -3127,7 +3127,7 @@ bool SaveStorageValue(unsigned int position, int value)
|
||||
|
||||
success = SaveFileData(path, fileData, dataSize);
|
||||
UnloadFileData(fileData);
|
||||
|
||||
|
||||
TRACELOG(LOG_INFO, "FILEIO: [%s] Saved storage value: %i", path, value);
|
||||
}
|
||||
#endif
|
||||
@ -3144,7 +3144,7 @@ int LoadStorageValue(unsigned int position)
|
||||
#if defined(SUPPORT_DATA_STORAGE)
|
||||
char path[512] = { 0 };
|
||||
strcpy(path, TextFormat("%s/%s", CORE.Storage.basePath, STORAGE_DATA_FILE));
|
||||
|
||||
|
||||
unsigned int dataSize = 0;
|
||||
unsigned char *fileData = LoadFileData(path, &dataSize);
|
||||
|
||||
@ -3158,7 +3158,7 @@ int LoadStorageValue(unsigned int position)
|
||||
}
|
||||
|
||||
UnloadFileData(fileData);
|
||||
|
||||
|
||||
TRACELOG(LOG_INFO, "FILEIO: [%s] Loaded storage value: %i", path, value);
|
||||
}
|
||||
#endif
|
||||
@ -4694,7 +4694,7 @@ void WaitTime(float ms)
|
||||
#if defined(SUPPORT_PARTIALBUSY_WAIT_LOOP)
|
||||
double previousTime = GetTime();
|
||||
double currentTime = 0.0;
|
||||
|
||||
|
||||
// Partial busy wait loop (only a fraction of the total wait time)
|
||||
while ((currentTime - previousTime) < busyWait/1000.0f) currentTime = GetTime();
|
||||
#endif
|
||||
@ -5360,7 +5360,7 @@ static void AndroidCommandCallback(struct android_app *app, int32_t cmd)
|
||||
|
||||
// Initialize hi-res timer
|
||||
InitTimer();
|
||||
|
||||
|
||||
// Initialize random seed
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
|
124
src/models.c
124
src/models.c
@ -4139,7 +4139,7 @@ static Image LoadImageFromCgltfImage(cgltf_image *image, const char *texPath, Co
|
||||
static bool ReadGLTFValue(cgltf_accessor *acc, unsigned int index, void *variable)
|
||||
{
|
||||
unsigned int typeElements = 0;
|
||||
|
||||
|
||||
switch (acc->type)
|
||||
{
|
||||
case cgltf_type_scalar: typeElements = 1; break;
|
||||
@ -4152,10 +4152,10 @@ static bool ReadGLTFValue(cgltf_accessor *acc, unsigned int index, void *variabl
|
||||
case cgltf_type_invalid: typeElements = 0; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
unsigned int typeSize = 0;
|
||||
|
||||
switch (acc->component_type)
|
||||
|
||||
switch (acc->component_type)
|
||||
{
|
||||
case cgltf_component_type_r_8u:
|
||||
case cgltf_component_type_r_8: typeSize = 1; break;
|
||||
@ -4166,9 +4166,9 @@ static bool ReadGLTFValue(cgltf_accessor *acc, unsigned int index, void *variabl
|
||||
case cgltf_component_type_invalid: typeSize = 0; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
unsigned int singleElementSize = typeSize*typeElements;
|
||||
|
||||
|
||||
if (acc->count == 2)
|
||||
{
|
||||
if (index > 1) return false;
|
||||
@ -4176,11 +4176,11 @@ static bool ReadGLTFValue(cgltf_accessor *acc, unsigned int index, void *variabl
|
||||
memcpy(variable, index == 0 ? acc->min : acc->max, singleElementSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
memset(variable, 0, singleElementSize);
|
||||
|
||||
if (acc->buffer_view == NULL || acc->buffer_view->buffer == NULL || acc->buffer_view->buffer->data == NULL) return false;
|
||||
|
||||
|
||||
if (!acc->buffer_view->stride)
|
||||
{
|
||||
void *readPosition = ((char *)acc->buffer_view->buffer->data) + (index*singleElementSize) + acc->buffer_view->offset + acc->offset;
|
||||
@ -4191,7 +4191,7 @@ static bool ReadGLTFValue(cgltf_accessor *acc, unsigned int index, void *variabl
|
||||
void *readPosition = ((char *)acc->buffer_view->buffer->data) + (index*acc->buffer_view->stride) + acc->buffer_view->offset + acc->offset;
|
||||
memcpy(variable, readPosition, singleElementSize);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -4210,7 +4210,7 @@ static void *ReadGLTFValuesAs(cgltf_accessor* acc, cgltf_component_type type, bo
|
||||
case cgltf_component_type_invalid: typeSize = 0; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
unsigned int typeElements = 0;
|
||||
switch (acc->type)
|
||||
{
|
||||
@ -4224,15 +4224,15 @@ static void *ReadGLTFValuesAs(cgltf_accessor* acc, cgltf_component_type type, bo
|
||||
case cgltf_type_invalid: typeElements = 0; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
if (acc->component_type == type)
|
||||
{
|
||||
void *array = RL_MALLOC(count*typeElements*typeSize);
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < count; i++) ReadGLTFValue(acc, i, (char *)array + i*typeElements*typeSize);
|
||||
|
||||
return array;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4248,15 +4248,15 @@ static void *ReadGLTFValuesAs(cgltf_accessor* acc, cgltf_component_type type, bo
|
||||
case cgltf_component_type_invalid: accTypeSize = 0; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
void *array = RL_MALLOC(count*typeElements*typeSize);
|
||||
void *additionalArray = RL_MALLOC(count*typeElements*accTypeSize);
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
{
|
||||
ReadGLTFValue(acc, i, (char *)additionalArray + i*typeElements*accTypeSize);
|
||||
}
|
||||
|
||||
|
||||
switch (acc->component_type)
|
||||
{
|
||||
case cgltf_component_type_r_8u:
|
||||
@ -4332,7 +4332,7 @@ static void *ReadGLTFValuesAs(cgltf_accessor* acc, cgltf_component_type type, bo
|
||||
unsigned int *typedArray = (unsigned int *)array;
|
||||
for (unsigned int i = 0; i < count*typeElements; i++) typedArray[i] = (unsigned int)typedAdditionalArray[i];
|
||||
} break;
|
||||
default:
|
||||
default:
|
||||
{
|
||||
RL_FREE(array);
|
||||
RL_FREE(additionalArray);
|
||||
@ -4382,7 +4382,7 @@ static void *ReadGLTFValuesAs(cgltf_accessor* acc, cgltf_component_type type, bo
|
||||
unsigned int* typedArray = (unsigned int*) array;
|
||||
for (unsigned int i = 0; i < count*typeElements; i++) typedArray[i] = (unsigned int)typedAdditionalArray[i];
|
||||
} break;
|
||||
default:
|
||||
default:
|
||||
{
|
||||
RL_FREE(array);
|
||||
RL_FREE(additionalArray);
|
||||
@ -4535,7 +4535,7 @@ static void *ReadGLTFValuesAs(cgltf_accessor* acc, cgltf_component_type type, bo
|
||||
return NULL;
|
||||
} break;
|
||||
}
|
||||
|
||||
|
||||
RL_FREE(additionalArray);
|
||||
return array;
|
||||
}
|
||||
@ -4583,7 +4583,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
// Read data buffers
|
||||
result = cgltf_load_buffers(&options, data, fileName);
|
||||
if (result != cgltf_result_success) TRACELOG(LOG_INFO, "MODEL: [%s] Failed to load mesh/material buffers", fileName);
|
||||
|
||||
|
||||
if (data->scenes_count > 1) TRACELOG(LOG_INFO, "MODEL: [%s] Has multiple scenes but only the first one will be loaded", fileName);
|
||||
|
||||
int primitivesCount = 0;
|
||||
@ -4591,7 +4591,7 @@ static Model LoadGLTF(const char *fileName)
|
||||
{
|
||||
GetGLTFPrimitiveCount(data->scene->nodes[i], &primitivesCount);
|
||||
}
|
||||
|
||||
|
||||
// Process glTF data and map to model
|
||||
model.meshCount = primitivesCount;
|
||||
model.meshes = RL_CALLOC(model.meshCount, sizeof(Mesh));
|
||||
@ -4601,10 +4601,10 @@ static Model LoadGLTF(const char *fileName)
|
||||
model.boneCount = (int)data->nodes_count;
|
||||
model.bones = RL_CALLOC(model.boneCount, sizeof(BoneInfo));
|
||||
model.bindPose = RL_CALLOC(model.boneCount, sizeof(Transform));
|
||||
|
||||
|
||||
InitGLTFBones(&model, data);
|
||||
LoadGLTFMaterial(&model, fileName, data);
|
||||
|
||||
|
||||
int primitiveIndex = 0;
|
||||
for (unsigned int i = 0; i < data->scene->nodes_count; i++)
|
||||
{
|
||||
@ -4875,12 +4875,12 @@ static ModelAnimation *LoadGLTFModelAnimations(const char *fileName, int *animCo
|
||||
{
|
||||
if (data->nodes[i].has_translation) memcpy(&output->framePoses[frame][i].translation, data->nodes[i].translation, 3*sizeof(float));
|
||||
else output->framePoses[frame][i].translation = Vector3Zero();
|
||||
|
||||
|
||||
if (data->nodes[i].has_rotation) memcpy(&output->framePoses[frame][i], data->nodes[i].rotation, 4*sizeof(float));
|
||||
else output->framePoses[frame][i].rotation = QuaternionIdentity();
|
||||
|
||||
|
||||
output->framePoses[frame][i].rotation = QuaternionNormalize(output->framePoses[frame][i].rotation);
|
||||
|
||||
|
||||
if (data->nodes[i].has_scale) memcpy(&output->framePoses[frame][i].scale, data->nodes[i].scale, 3*sizeof(float));
|
||||
else output->framePoses[frame][i].scale = Vector3One();
|
||||
}
|
||||
@ -4933,22 +4933,22 @@ static ModelAnimation *LoadGLTFModelAnimations(const char *fileName, int *animCo
|
||||
|
||||
// If the current transformation has no information for the current frame time point
|
||||
if (shouldSkipFurtherTransformation) continue;
|
||||
|
||||
|
||||
if (channel->target_path == cgltf_animation_path_type_translation)
|
||||
{
|
||||
Vector3 translationStart;
|
||||
Vector3 translationEnd;
|
||||
|
||||
float values[3];
|
||||
|
||||
|
||||
bool success = ReadGLTFValue(sampler->output, outputMin, values);
|
||||
|
||||
|
||||
translationStart.x = values[0];
|
||||
translationStart.y = values[1];
|
||||
translationStart.z = values[2];
|
||||
|
||||
|
||||
success = ReadGLTFValue(sampler->output, outputMax, values) || success;
|
||||
|
||||
|
||||
translationEnd.x = values[0];
|
||||
translationEnd.y = values[1];
|
||||
translationEnd.z = values[2];
|
||||
@ -4959,18 +4959,18 @@ static ModelAnimation *LoadGLTFModelAnimations(const char *fileName, int *animCo
|
||||
{
|
||||
Vector4 rotationStart;
|
||||
Vector4 rotationEnd;
|
||||
|
||||
|
||||
float values[4];
|
||||
|
||||
|
||||
bool success = ReadGLTFValue(sampler->output, outputMin, &values);
|
||||
|
||||
|
||||
rotationStart.x = values[0];
|
||||
rotationStart.y = values[1];
|
||||
rotationStart.z = values[2];
|
||||
rotationStart.w = values[3];
|
||||
|
||||
|
||||
success = ReadGLTFValue(sampler->output, outputMax, &values) || success;
|
||||
|
||||
|
||||
rotationEnd.x = values[0];
|
||||
rotationEnd.y = values[1];
|
||||
rotationEnd.z = values[2];
|
||||
@ -4985,17 +4985,17 @@ static ModelAnimation *LoadGLTFModelAnimations(const char *fileName, int *animCo
|
||||
{
|
||||
Vector3 scaleStart;
|
||||
Vector3 scaleEnd;
|
||||
|
||||
|
||||
float values[3];
|
||||
|
||||
|
||||
bool success = ReadGLTFValue(sampler->output, outputMin, &values);
|
||||
|
||||
|
||||
scaleStart.x = values[0];
|
||||
scaleStart.y = values[1];
|
||||
scaleStart.z = values[2];
|
||||
|
||||
|
||||
success = ReadGLTFValue(sampler->output, outputMax, &values) || success;
|
||||
|
||||
|
||||
scaleEnd.x = values[0];
|
||||
scaleEnd.y = values[1];
|
||||
scaleEnd.z = values[2];
|
||||
@ -5060,9 +5060,9 @@ void LoadGLTFMesh(cgltf_data* data, cgltf_mesh* mesh, Model* outModel, Matrix cu
|
||||
outModel->meshes[(*primitiveIndex)].vertexCount = (int)acc->count;
|
||||
int bufferSize = outModel->meshes[(*primitiveIndex)].vertexCount*3*sizeof(float);
|
||||
outModel->meshes[(*primitiveIndex)].animVertices = RL_MALLOC(bufferSize);
|
||||
|
||||
|
||||
outModel->meshes[(*primitiveIndex)].vertices = ReadGLTFValuesAs(acc, cgltf_component_type_r_32f, false);
|
||||
|
||||
|
||||
// Transform using the nodes matrix attributes
|
||||
for (unsigned int v = 0; v < outModel->meshes[(*primitiveIndex)].vertexCount; v++)
|
||||
{
|
||||
@ -5070,25 +5070,25 @@ void LoadGLTFMesh(cgltf_data* data, cgltf_mesh* mesh, Model* outModel, Matrix cu
|
||||
outModel->meshes[(*primitiveIndex)].vertices[(v*3 + 0)],
|
||||
outModel->meshes[(*primitiveIndex)].vertices[(v*3 + 1)],
|
||||
outModel->meshes[(*primitiveIndex)].vertices[(v*3 + 2)] };
|
||||
|
||||
|
||||
vertex = Vector3Transform(vertex, currentTransform);
|
||||
|
||||
|
||||
outModel->meshes[(*primitiveIndex)].vertices[(v*3 + 0)] = vertex.x;
|
||||
outModel->meshes[(*primitiveIndex)].vertices[(v*3 + 1)] = vertex.y;
|
||||
outModel->meshes[(*primitiveIndex)].vertices[(v*3 + 2)] = vertex.z;
|
||||
}
|
||||
|
||||
|
||||
memcpy(outModel->meshes[(*primitiveIndex)].animVertices, outModel->meshes[(*primitiveIndex)].vertices, bufferSize);
|
||||
}
|
||||
else if (mesh->primitives[p].attributes[j].type == cgltf_attribute_type_normal)
|
||||
{
|
||||
cgltf_accessor *acc = mesh->primitives[p].attributes[j].data;
|
||||
|
||||
|
||||
int bufferSize = (int)(acc->count*3*sizeof(float));
|
||||
outModel->meshes[(*primitiveIndex)].animNormals = RL_MALLOC(bufferSize);
|
||||
|
||||
|
||||
outModel->meshes[(*primitiveIndex)].normals = ReadGLTFValuesAs(acc, cgltf_component_type_r_32f, false);
|
||||
|
||||
|
||||
// Transform using the nodes matrix attributes
|
||||
for (unsigned int v = 0; v < outModel->meshes[(*primitiveIndex)].vertexCount; v++)
|
||||
{
|
||||
@ -5096,14 +5096,14 @@ void LoadGLTFMesh(cgltf_data* data, cgltf_mesh* mesh, Model* outModel, Matrix cu
|
||||
outModel->meshes[(*primitiveIndex)].normals[(v*3 + 0)],
|
||||
outModel->meshes[(*primitiveIndex)].normals[(v*3 + 1)],
|
||||
outModel->meshes[(*primitiveIndex)].normals[(v*3 + 2)] };
|
||||
|
||||
|
||||
normal = Vector3Transform(normal, currentTransform);
|
||||
|
||||
|
||||
outModel->meshes[(*primitiveIndex)].normals[(v*3 + 0)] = normal.x;
|
||||
outModel->meshes[(*primitiveIndex)].normals[(v*3 + 1)] = normal.y;
|
||||
outModel->meshes[(*primitiveIndex)].normals[(v*3 + 2)] = normal.z;
|
||||
}
|
||||
|
||||
|
||||
memcpy(outModel->meshes[(*primitiveIndex)].animNormals, outModel->meshes[(*primitiveIndex)].normals, bufferSize);
|
||||
}
|
||||
else if (mesh->primitives[p].attributes[j].type == cgltf_attribute_type_texcoord)
|
||||
@ -5116,14 +5116,14 @@ void LoadGLTFMesh(cgltf_data* data, cgltf_mesh* mesh, Model* outModel, Matrix cu
|
||||
cgltf_accessor *acc = mesh->primitives[p].attributes[j].data;
|
||||
unsigned int boneCount = acc->count;
|
||||
unsigned int totalBoneWeights = boneCount*4;
|
||||
|
||||
|
||||
outModel->meshes[(*primitiveIndex)].boneIds = RL_MALLOC(totalBoneWeights*sizeof(int));
|
||||
short *bones = ReadGLTFValuesAs(acc, cgltf_component_type_r_16, false);
|
||||
for (unsigned int a = 0; a < totalBoneWeights; a++)
|
||||
{
|
||||
outModel->meshes[(*primitiveIndex)].boneIds[a] = 0;
|
||||
if (bones[a] < 0) continue;
|
||||
|
||||
|
||||
cgltf_node* skinJoint = data->skins->joints[bones[a]];
|
||||
for (unsigned int k = 0; k < data->nodes_count; k++)
|
||||
{
|
||||
@ -5147,7 +5147,7 @@ void LoadGLTFMesh(cgltf_data* data, cgltf_mesh* mesh, Model* outModel, Matrix cu
|
||||
outModel->meshes[(*primitiveIndex)].colors = ReadGLTFValuesAs(acc, cgltf_component_type_r_8u, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cgltf_accessor *acc = mesh->primitives[p].indices;
|
||||
if (acc)
|
||||
{
|
||||
@ -5159,7 +5159,7 @@ void LoadGLTFMesh(cgltf_data* data, cgltf_mesh* mesh, Model* outModel, Matrix cu
|
||||
// Unindexed mesh
|
||||
outModel->meshes[(*primitiveIndex)].triangleCount = outModel->meshes[(*primitiveIndex)].vertexCount/3;
|
||||
}
|
||||
|
||||
|
||||
if (mesh->primitives[p].material)
|
||||
{
|
||||
// Compute the offset
|
||||
@ -5168,30 +5168,30 @@ void LoadGLTFMesh(cgltf_data* data, cgltf_mesh* mesh, Model* outModel, Matrix cu
|
||||
else outModel->meshMaterial[(*primitiveIndex)] = outModel->materialCount - 1;
|
||||
|
||||
BindGLTFPrimitiveToBones(outModel, data, *primitiveIndex);
|
||||
|
||||
|
||||
(*primitiveIndex) = (*primitiveIndex) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadGLTFNode(cgltf_data* data, cgltf_node* node, Model* outModel, Matrix currentTransform, int* primitiveIndex, const char *fileName)
|
||||
{
|
||||
Matrix nodeTransform = {
|
||||
Matrix nodeTransform = {
|
||||
node->matrix[0], node->matrix[4], node->matrix[8], node->matrix[12],
|
||||
node->matrix[1], node->matrix[5], node->matrix[9], node->matrix[13],
|
||||
node->matrix[2], node->matrix[6], node->matrix[10], node->matrix[14],
|
||||
node->matrix[3], node->matrix[7], node->matrix[11], node->matrix[15] };
|
||||
|
||||
|
||||
currentTransform = MatrixMultiply(nodeTransform, currentTransform);
|
||||
|
||||
|
||||
if (node->mesh != NULL) LoadGLTFMesh(data, node->mesh, outModel, currentTransform, primitiveIndex, fileName);
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < node->children_count; i++) LoadGLTFNode(data, node->children[i], outModel, currentTransform, primitiveIndex, fileName);
|
||||
}
|
||||
|
||||
static void GetGLTFPrimitiveCount(cgltf_node* node, int* outCount)
|
||||
{
|
||||
if (node->mesh != NULL) *outCount += node->mesh->primitives_count;
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < node->children_count; i++) GetGLTFPrimitiveCount(node->children[i], outCount);
|
||||
}
|
||||
|
||||
|
16
src/raudio.c
16
src/raudio.c
@ -738,7 +738,7 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
|
||||
wave.sampleSize = 16;
|
||||
wave.channels = wav.channels;
|
||||
wave.data = (short *)RL_MALLOC(wave.sampleCount*sizeof(short));
|
||||
|
||||
|
||||
// NOTE: We are forcing conversion to 16bit sample size on reading
|
||||
drwav_read_pcm_frames_s16(&wav, wav.totalPCMFrameCount, wave.data);
|
||||
}
|
||||
@ -761,7 +761,7 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
|
||||
wave.channels = info.channels;
|
||||
wave.sampleCount = (unsigned int)stb_vorbis_stream_length_in_samples(oggData)*info.channels; // Independent by channel
|
||||
wave.data = (short *)RL_MALLOC(wave.sampleCount*sizeof(short));
|
||||
|
||||
|
||||
// NOTE: Get the number of samples to process (be careful! we ask for number of shorts!)
|
||||
stb_vorbis_get_samples_short_interleaved(oggData, info.channels, (short *)wave.data, wave.sampleCount);
|
||||
stb_vorbis_close(oggData);
|
||||
@ -770,10 +770,10 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
|
||||
}
|
||||
#endif
|
||||
#if defined(SUPPORT_FILEFORMAT_FLAC)
|
||||
else if (TextIsEqual(fileExtLower, ".flac"))
|
||||
else if (TextIsEqual(fileExtLower, ".flac"))
|
||||
{
|
||||
unsigned long long int totalFrameCount = 0;
|
||||
|
||||
|
||||
// NOTE: We are forcing conversion to 16bit sample size on reading
|
||||
wave.data = drflac_open_memory_and_read_pcm_frames_s16(fileData, dataSize, &wave.channels, &wave.sampleRate, &totalFrameCount, NULL);
|
||||
wave.sampleSize = 16;
|
||||
@ -787,7 +787,7 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
|
||||
{
|
||||
drmp3_config config = { 0 };
|
||||
unsigned long long int totalFrameCount = 0;
|
||||
|
||||
|
||||
// NOTE: We are forcing conversion to 32bit float sample size on reading
|
||||
wave.data = drmp3_open_memory_and_read_pcm_frames_f32(fileData, dataSize, &config, &totalFrameCount, NULL);
|
||||
wave.sampleSize = 32;
|
||||
@ -799,11 +799,11 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
|
||||
wave.sampleCount = (int)totalFrameCount*wave.channels;
|
||||
}
|
||||
else TRACELOG(LOG_WARNING, "WAVE: Failed to load MP3 data");
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
else TRACELOG(LOG_WARNING, "WAVE: Data format not supported");
|
||||
|
||||
|
||||
TRACELOG(LOG_INFO, "WAVE: Data loaded successfully (%i Hz, %i bit, %i channels)", wave.sampleRate, wave.sampleSize, wave.channels);
|
||||
|
||||
return wave;
|
||||
@ -900,7 +900,7 @@ bool ExportWave(Wave wave, const char *fileName)
|
||||
|
||||
if (false) { }
|
||||
#if defined(SUPPORT_FILEFORMAT_WAV)
|
||||
else if (IsFileExtension(fileName, ".wav"))
|
||||
else if (IsFileExtension(fileName, ".wav"))
|
||||
{
|
||||
drwav wav = { 0 };
|
||||
drwav_data_format format = { 0 };
|
||||
|
@ -646,8 +646,8 @@ typedef enum {
|
||||
typedef enum {
|
||||
MOUSE_CURSOR_DEFAULT = 0, // Default pointer shape
|
||||
MOUSE_CURSOR_ARROW = 1, // Arrow shape
|
||||
MOUSE_CURSOR_IBEAM = 2, // Text writing cursor shape
|
||||
MOUSE_CURSOR_CROSSHAIR = 3, // Cross shape
|
||||
MOUSE_CURSOR_IBEAM = 2, // Text writing cursor shape
|
||||
MOUSE_CURSOR_CROSSHAIR = 3, // Cross shape
|
||||
MOUSE_CURSOR_POINTING_HAND = 4, // Pointing hand cursor
|
||||
MOUSE_CURSOR_RESIZE_EW = 5, // Horizontal resize/move arrow shape
|
||||
MOUSE_CURSOR_RESIZE_NS = 6, // Vertical resize/move arrow shape
|
||||
|
@ -1567,10 +1567,10 @@ RLAPI const char *CodepointToUtf8(int codepoint, int *byteLength)
|
||||
int *LoadCodepoints(const char *text, int *count)
|
||||
{
|
||||
int textLength = TextLength(text);
|
||||
|
||||
|
||||
int bytesProcessed = 0;
|
||||
int codepointsCount = 0;
|
||||
|
||||
|
||||
// Allocate a big enough buffer to store as many codepoints as text bytes
|
||||
int *codepoints = RL_CALLOC(textLength, sizeof(int));
|
||||
|
||||
@ -1650,7 +1650,7 @@ int GetCodepoint(const char *text, int *bytesProcessed)
|
||||
else if ((octet & 0xe0) == 0xc0)
|
||||
{
|
||||
// Two octets
|
||||
|
||||
|
||||
// [0]xC2-DF [1]UTF8-tail(x80-BF)
|
||||
unsigned char octet1 = text[1];
|
||||
|
||||
|
@ -379,7 +379,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i
|
||||
else if (TextIsEqual(fileExtLower, ".astc")) image = LoadASTC(fileData, dataSize);
|
||||
#endif
|
||||
else TRACELOG(LOG_WARNING, "IMAGE: Data format not supported");
|
||||
|
||||
|
||||
TRACELOG(LOG_INFO, "IMAGE: Data loaded successfully (%ix%i | %s | %i mipmaps)", image.width, image.height, rlGetPixelFormatName(image.format), image.mipmaps);
|
||||
|
||||
return image;
|
||||
@ -3218,8 +3218,8 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
|
||||
float width = (float)texture.width;
|
||||
float height = (float)texture.height;
|
||||
|
||||
float patchWidth = (dest.width <= 0.0f)? 0.0f : dest.width;
|
||||
float patchHeight = (dest.height <= 0.0f)? 0.0f : dest.height;
|
||||
float patchWidth = ((int)dest.width <= 0)? 0.0f : dest.width;
|
||||
float patchHeight = ((int)dest.height <= 0)? 0.0f : dest.height;
|
||||
|
||||
if (nPatchInfo.source.width < 0) nPatchInfo.source.x -= nPatchInfo.source.width;
|
||||
if (nPatchInfo.source.height < 0) nPatchInfo.source.y -= nPatchInfo.source.height;
|
||||
@ -3233,14 +3233,15 @@ void DrawTextureNPatch(Texture2D texture, NPatchInfo nPatchInfo, Rectangle dest,
|
||||
float rightBorder = (float)nPatchInfo.right;
|
||||
float bottomBorder = (float)nPatchInfo.bottom;
|
||||
|
||||
// adjust the lateral (left and right) border widths in case patchWidth < texture.width
|
||||
// Adjust the lateral (left and right) border widths in case patchWidth < texture.width
|
||||
if (patchWidth <= (leftBorder + rightBorder) && nPatchInfo.layout != NPATCH_THREE_PATCH_VERTICAL)
|
||||
{
|
||||
drawCenter = false;
|
||||
leftBorder = (leftBorder/(leftBorder + rightBorder))*patchWidth;
|
||||
rightBorder = patchWidth - leftBorder;
|
||||
}
|
||||
// adjust the lateral (top and bottom) border heights in case patchHeight < texture.height
|
||||
|
||||
// Adjust the lateral (top and bottom) border heights in case patchHeight < texture.height
|
||||
if (patchHeight <= (topBorder + bottomBorder) && nPatchInfo.layout != NPATCH_THREE_PATCH_HORIZONTAL)
|
||||
{
|
||||
drawMiddle = false;
|
||||
|
Loading…
Reference in New Issue
Block a user