2017-02-19 09:54:58 +00:00
|
|
|
#include "loaders/texture.h"
|
2017-04-13 02:48:17 +00:00
|
|
|
#include "lib/glfw.h"
|
2016-11-19 07:41:23 +00:00
|
|
|
#include "util.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
|
|
|
|
2016-11-08 22:44:22 +00:00
|
|
|
typedef enum {
|
2017-07-23 10:09:07 +00:00
|
|
|
FILTER_NEAREST,
|
|
|
|
FILTER_BILINEAR,
|
|
|
|
FILTER_TRILINEAR,
|
|
|
|
FILTER_ANISOTROPIC
|
2016-11-08 22:44:22 +00:00
|
|
|
} FilterMode;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
WRAP_CLAMP = GL_CLAMP_TO_EDGE,
|
|
|
|
WRAP_REPEAT = GL_REPEAT,
|
2017-06-18 04:09:03 +00:00
|
|
|
WRAP_MIRRORED_REPEAT = GL_MIRRORED_REPEAT
|
2016-11-08 22:44:22 +00:00
|
|
|
} WrapMode;
|
|
|
|
|
2017-01-12 07:38:28 +00:00
|
|
|
typedef enum {
|
|
|
|
PROJECTION_ORTHOGRAPHIC,
|
|
|
|
PROJECTION_PERSPECTIVE
|
|
|
|
} TextureProjection;
|
|
|
|
|
2016-11-08 11:14:33 +00:00
|
|
|
typedef struct {
|
2016-11-19 07:41:23 +00:00
|
|
|
Ref ref;
|
2016-11-26 07:54:45 +00:00
|
|
|
TextureData* textureData;
|
2016-11-08 11:14:33 +00:00
|
|
|
GLuint id;
|
2017-01-15 01:38:25 +00:00
|
|
|
GLuint msaaId;
|
2017-01-12 07:38:28 +00:00
|
|
|
GLuint framebuffer;
|
2017-01-15 01:38:25 +00:00
|
|
|
GLuint resolveFramebuffer;
|
|
|
|
GLuint depthBuffer;
|
2017-01-12 07:38:28 +00:00
|
|
|
TextureProjection projection;
|
2017-07-23 10:09:07 +00:00
|
|
|
FilterMode filter;
|
|
|
|
float anisotropy;
|
2016-11-08 22:44:22 +00:00
|
|
|
WrapMode wrapHorizontal;
|
|
|
|
WrapMode wrapVertical;
|
2017-01-15 01:38:25 +00:00
|
|
|
int msaa;
|
2016-11-08 11:14:33 +00:00
|
|
|
} Texture;
|
|
|
|
|
2017-06-10 23:25:46 +00:00
|
|
|
GLenum lovrTextureGetGLFormat(TextureFormat format);
|
|
|
|
|
2017-01-12 07:38:28 +00:00
|
|
|
Texture* lovrTextureCreate(TextureData* textureData);
|
2017-01-15 01:38:25 +00:00
|
|
|
Texture* lovrTextureCreateWithFramebuffer(TextureData* textureData, TextureProjection projection, int msaa);
|
2016-11-19 07:41:23 +00:00
|
|
|
void lovrTextureDestroy(const Ref* ref);
|
2017-01-12 04:26:08 +00:00
|
|
|
void lovrTextureBindFramebuffer(Texture* texture);
|
2017-01-15 01:38:25 +00:00
|
|
|
void lovrTextureResolveMSAA(Texture* texture);
|
2016-11-17 09:30:40 +00:00
|
|
|
void lovrTextureRefresh(Texture* texture);
|
2016-11-08 11:14:33 +00:00
|
|
|
int lovrTextureGetHeight(Texture* texture);
|
|
|
|
int lovrTextureGetWidth(Texture* texture);
|
2017-07-23 10:09:07 +00:00
|
|
|
void lovrTextureGetFilter(Texture* texture, FilterMode* filter, float* anisotropy);
|
|
|
|
void lovrTextureSetFilter(Texture* texture, FilterMode filter, float anisotropy);
|
2016-11-08 22:44:22 +00:00
|
|
|
void lovrTextureGetWrap(Texture* texture, WrapMode* horizontal, WrapMode* vertical);
|
|
|
|
void lovrTextureSetWrap(Texture* texture, WrapMode horizontal, WrapMode vertical);
|