mirror of https://github.com/bjornbytes/lovr.git
Get rid of loadImage;
This commit is contained in:
parent
dff9cc3c98
commit
14dfeb688f
|
@ -1,4 +1,5 @@
|
|||
#include "graphics/skybox.h"
|
||||
#include "vendor/stb/stb_image.h"
|
||||
#include "util.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -11,7 +12,8 @@ Skybox* lovrSkyboxCreate(void** data, int* size) {
|
|||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
int width, height, channels;
|
||||
unsigned char* image = loadImage(data[i], size[i], &width, &height, &channels, 3);
|
||||
stbi_set_flip_vertically_on_load(0);
|
||||
unsigned char* image = stbi_load_from_memory(data[i], size[i], &width, &height, &channels, 3);
|
||||
|
||||
if (!image) {
|
||||
error("Could not load skybox image %d", i);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "loaders/texture.h"
|
||||
#include "util.h"
|
||||
#include "vendor/stb/stb_image.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
TextureData* lovrTextureDataGetBlank(int width, int height, uint8_t value) {
|
||||
TextureData* textureData = malloc(sizeof(TextureData));
|
||||
|
@ -35,7 +36,11 @@ TextureData* lovrTextureDataFromFile(void* data, int size) {
|
|||
TextureData* textureData = malloc(sizeof(TextureData));
|
||||
if (!textureData) return NULL;
|
||||
|
||||
void* image = loadImage(data, size, &textureData->width, &textureData->height, &textureData->channels, 4);
|
||||
int* w = &textureData->width;
|
||||
int* h = &textureData->height;
|
||||
int* c = &textureData->channels;
|
||||
stbi_set_flip_vertically_on_load(1);
|
||||
void* image = stbi_load_from_memory(data, size, w, h, c, 4);
|
||||
|
||||
if (image) {
|
||||
textureData->data = image;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "util.h"
|
||||
#include "vendor/stb/stb_image.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -18,11 +17,6 @@ void error(const char* format, ...) {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
unsigned char* loadImage(void* data, size_t size, int* w, int* h, int* n, int channels) {
|
||||
stbi_set_flip_vertically_on_load(1);
|
||||
return stbi_load_from_memory(data, size, w, h, n, channels);
|
||||
}
|
||||
|
||||
// Returns a key that maps to value or NULL if the value is not in the map
|
||||
const char* map_int_find(map_int_t* map, int value) {
|
||||
const char* key;
|
||||
|
|
|
@ -34,7 +34,6 @@ typedef vec_t(unsigned int) vec_uint_t;
|
|||
#endif
|
||||
|
||||
void error(const char* format, ...);
|
||||
unsigned char* loadImage(void* data, size_t size, int* w, int* h, int* n, int channels);
|
||||
const char* map_int_find(map_int_t *map, int value);
|
||||
void lovrSleep(double seconds);
|
||||
|
||||
|
|
Loading…
Reference in New Issue