84 lines
1.3 KiB
C
84 lines
1.3 KiB
C
// Shared header for render stuff
|
|
#ifndef RENDER_SHARED_H
|
|
#define RENDER_SHARED_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "utils/maths.h"
|
|
#include "render/color.h"
|
|
|
|
enum class BufferAccess
|
|
{
|
|
READ_ONLY,
|
|
WRITE_ONLY,
|
|
READ_WRITE
|
|
};
|
|
|
|
// texture format
|
|
enum PixelFormat
|
|
{
|
|
PF_UNKNOWN,
|
|
PF_R8G8B8,
|
|
PF_R8G8B8A8,
|
|
PF_R8G8B8F,
|
|
PF_R8G8B8A8F,
|
|
|
|
// Depth formats
|
|
PF_DEPTH32F
|
|
};
|
|
|
|
// pixel format convertion
|
|
uint32_t getGLPF(PixelFormat pf);
|
|
uint32_t getGLInternalPF(PixelFormat pf);
|
|
uint32_t getGLTypePF(PixelFormat pf);
|
|
|
|
// Blending functions
|
|
enum BlendFactor
|
|
{
|
|
BF_ZERO,
|
|
BF_ONE,
|
|
BF_SRC_COLOR,
|
|
BF_ONE_MINUS_SRC_COLOR,
|
|
BF_DST_COLOR,
|
|
BF_ONE_MINUS_DST_COLOR,
|
|
BF_SRC_ALPHA,
|
|
BF_ONE_MINUS_SRC_ALPHA,
|
|
BF_DST_ALPHA,
|
|
BF_ONE_MINUS_DST_ALPHA,
|
|
BF_CONSTANT_COLOR,
|
|
BF_ONE_MINUS_CONSTANT_COLOR,
|
|
BF_CONSTANT_ALPHA,
|
|
BF_ONE_MINUS_CONSTANT_ALPHA
|
|
};
|
|
|
|
// Blending factor convertion
|
|
uint32_t GetGLBlendFactor(BlendFactor factor);
|
|
|
|
// Base structure for render view (view and projection matrices, viewport settings)
|
|
struct View
|
|
{
|
|
glm::mat4 view;
|
|
glm::mat4 proj;
|
|
|
|
int x, y;
|
|
int width, height;
|
|
|
|
float fov;
|
|
};
|
|
|
|
// Global instance of render view
|
|
extern View g_renderView;
|
|
|
|
// Stretched picture vertex
|
|
struct StretchedVertex
|
|
{
|
|
Vec3 position;
|
|
Vec2 texcoord;
|
|
};
|
|
|
|
#define MAX_STRETCH_VX 12 * sizeof(StretchedVertex)
|
|
|
|
// debugging stuff
|
|
void check_for_opengl_error();
|
|
|
|
#endif |