lovr/src/modules/graphics/texture.h

51 lines
1.8 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"
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 {
TextureType type;
TextureFormat format;
2019-05-20 21:34:03 +00:00
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t mipmapCount;
TextureFilter filter;
TextureWrap wrap;
2019-05-20 21:34:03 +00:00
uint32_t msaa;
bool srgb;
bool mipmaps;
bool allocated;
GPU_TEXTURE_FIELDS
} Texture;
2019-05-20 21:34:03 +00:00
Texture* lovrTextureInit(Texture* texture, TextureType type, struct TextureData** slices, uint32_t sliceCount, bool srgb, bool mipmaps, uint32_t msaa);
Texture* lovrTextureInitFromHandle(Texture* texture, uint32_t handle, TextureType type, uint32_t depth);
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);
2019-05-20 21:34:03 +00:00
void lovrTextureAllocate(Texture* texture, uint32_t width, uint32_t height, uint32_t depth, TextureFormat format);
void lovrTextureReplacePixels(Texture* texture, struct TextureData* data, uint32_t x, uint32_t y, uint32_t slice, uint32_t mipmap);
uint32_t lovrTextureGetWidth(Texture* texture, uint32_t mipmap);
uint32_t lovrTextureGetHeight(Texture* texture, uint32_t mipmap);
uint32_t lovrTextureGetDepth(Texture* texture, uint32_t mipmap);
uint32_t lovrTextureGetMipmapCount(Texture* texture);
uint32_t 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);