mirror of
https://github.com/bjornbytes/lovr.git
synced 2024-07-08 23:23:38 +00:00
53 lines
1.7 KiB
C
53 lines
1.7 KiB
C
#include "data/textureData.h"
|
|
#include "graphics/opengl.h"
|
|
#include "data/modelData.h"
|
|
#include "types.h"
|
|
#include <stdbool.h>
|
|
|
|
#pragma once
|
|
|
|
struct TextureData;
|
|
|
|
typedef enum {
|
|
TEXTURE_2D,
|
|
TEXTURE_CUBE,
|
|
TEXTURE_ARRAY,
|
|
TEXTURE_VOLUME
|
|
} TextureType;
|
|
|
|
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;
|
|
|
|
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);
|
|
#define lovrTextureCreate(...) lovrTextureInit(lovrAlloc(Texture), __VA_ARGS__)
|
|
#define lovrTextureCreateFromHandle(...) lovrTextureInitFromHandle(lovrAlloc(Texture), __VA_ARGS__)
|
|
void lovrTextureDestroy(void* ref);
|
|
void lovrTextureAllocate(Texture* texture, int width, int height, int depth, TextureFormat format);
|
|
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);
|
|
TextureType lovrTextureGetType(Texture* texture);
|
|
TextureFormat lovrTextureGetFormat(Texture* texture);
|
|
TextureFilter lovrTextureGetFilter(Texture* texture);
|
|
void lovrTextureSetFilter(Texture* texture, TextureFilter filter);
|
|
TextureWrap lovrTextureGetWrap(Texture* texture);
|
|
void lovrTextureSetWrap(Texture* texture, TextureWrap wrap);
|