1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-25 07:03:35 +00:00
lovr/src/graphics/texture.h

53 lines
1.7 KiB
C
Raw Normal View History

2018-02-11 23:22:04 +00:00
#include "data/textureData.h"
#include "graphics/opengl.h"
2018-12-18 22:27:46 +00:00
#include "data/modelData.h"
2019-04-05 11:58:29 +00:00
#include "types.h"
2018-07-04 20:51:35 +00:00
#include <stdbool.h>
2016-11-08 11:14:33 +00:00
2017-01-26 10:20:30 +00:00
#pragma once
2016-11-08 11:14:33 +00:00
2019-04-05 11:58:29 +00:00
struct TextureData;
2017-10-15 23:56:00 +00:00
typedef enum {
2018-07-05 03:11:52 +00:00
TEXTURE_2D,
TEXTURE_CUBE,
TEXTURE_ARRAY,
TEXTURE_VOLUME
2017-10-15 23:56:00 +00:00
} TextureType;
2019-04-05 11:58:29 +00:00
typedef struct Texture {
Ref ref;
TextureType type;
TextureFormat format;
int width;
int height;
int depth;
int mipmapCount;
TextureFilter filter;
TextureWrap wrap;
int msaa;
bool srgb;
bool mipmaps;
bool allocated;
GPU_TEXTURE_FIELDS
} Texture;
2019-04-05 11:58:29 +00:00
Texture* lovrTextureInit(Texture* texture, TextureType type, struct TextureData** slices, int sliceCount, bool srgb, bool mipmaps, int msaa);
Texture* lovrTextureInitFromHandle(Texture* texture, uint32_t handle, TextureType type);
2018-12-19 08:25:20 +00:00
#define lovrTextureCreate(...) lovrTextureInit(lovrAlloc(Texture), __VA_ARGS__)
#define lovrTextureCreateFromHandle(...) lovrTextureInitFromHandle(lovrAlloc(Texture), __VA_ARGS__)
2018-02-26 08:59:03 +00:00
void lovrTextureDestroy(void* ref);
void lovrTextureAllocate(Texture* texture, int width, int height, int depth, TextureFormat format);
2019-04-05 11:58:29 +00:00
void lovrTextureReplacePixels(Texture* texture, struct TextureData* data, int x, int y, int slice, int mipmap);
int lovrTextureGetWidth(Texture* texture, int mipmap);
int lovrTextureGetHeight(Texture* texture, int mipmap);
int lovrTextureGetDepth(Texture* texture, int mipmap);
int lovrTextureGetMipmapCount(Texture* texture);
int lovrTextureGetMSAA(Texture* texture);
2018-02-21 01:27:35 +00:00
TextureType lovrTextureGetType(Texture* texture);
2018-08-16 21:27:45 +00:00
TextureFormat lovrTextureGetFormat(Texture* texture);
2017-08-02 07:29:47 +00:00
TextureFilter lovrTextureGetFilter(Texture* texture);
void lovrTextureSetFilter(Texture* texture, TextureFilter filter);
2017-10-15 23:56:00 +00:00
TextureWrap lovrTextureGetWrap(Texture* texture);
void lovrTextureSetWrap(Texture* texture, TextureWrap wrap);