lovr/src/data/textureData.h

51 lines
1.1 KiB
C
Raw Normal View History

#include "data/blob.h"
2018-01-21 05:33:09 +00:00
#include "util.h"
2018-09-26 17:49:33 +00:00
#include "lib/vec/vec.h"
2017-01-09 05:29:16 +00:00
#include <stdint.h>
2017-10-31 08:14:09 +00:00
#include <stdbool.h>
2016-11-26 07:54:45 +00:00
2017-02-19 09:54:58 +00:00
#pragma once
2017-12-08 16:44:28 +00:00
typedef enum {
FORMAT_RGB,
FORMAT_RGBA,
2018-07-21 00:45:25 +00:00
FORMAT_RGBA4,
2017-12-09 18:07:05 +00:00
FORMAT_RGBA16F,
FORMAT_RGBA32F,
2018-07-21 00:45:25 +00:00
FORMAT_R16F,
FORMAT_R32F,
2018-08-16 21:54:37 +00:00
FORMAT_RG16F,
FORMAT_RG32F,
2018-07-21 00:45:25 +00:00
FORMAT_RGB5A1,
FORMAT_RGB10A2,
2017-12-09 18:07:05 +00:00
FORMAT_RG11B10F,
2017-12-08 16:44:28 +00:00
FORMAT_DXT1,
FORMAT_DXT3,
FORMAT_DXT5
2017-02-19 09:54:58 +00:00
} TextureFormat;
typedef struct {
2017-07-22 10:42:05 +00:00
int width;
int height;
void* data;
size_t size;
} Mipmap;
2017-06-19 00:28:15 +00:00
2017-07-22 10:42:05 +00:00
typedef vec_t(Mipmap) vec_mipmap_t;
2017-06-19 00:28:15 +00:00
typedef struct {
Blob blob;
2017-02-19 09:54:58 +00:00
int width;
int height;
Blob* source;
2017-12-08 16:44:28 +00:00
TextureFormat format;
2018-01-14 21:21:34 +00:00
vec_mipmap_t mipmaps;
2017-02-19 09:54:58 +00:00
} TextureData;
2018-08-21 01:14:33 +00:00
TextureData* lovrTextureDataCreate(int width, int height, uint8_t value, TextureFormat format);
2018-09-04 03:59:12 +00:00
TextureData* lovrTextureDataCreateFromBlob(Blob* blob, bool flip);
Color lovrTextureDataGetPixel(TextureData* textureData, int x, int y);
void lovrTextureDataSetPixel(TextureData* textureData, int x, int y, Color color);
2018-02-09 04:17:50 +00:00
bool lovrTextureDataEncode(TextureData* textureData, const char* filename);
2018-02-26 08:59:03 +00:00
void lovrTextureDataDestroy(void* ref);