Files
unease/engine/render/render_shared.h
Kirill Yurkin 719171e7d8 Big changes
2025-03-07 16:54:27 +03:00

107 lines
1.6 KiB
C

// Shared header for render stuff
#ifndef RENDER_SHARED_H
#define RENDER_SHARED_H
#include "utils/maths.h"
enum BufferAccess
{
BA_READ_ONLY,
BA_WRITE_ONLY,
BA_READ_WRITE
};
// texture format
enum PixelFormat
{
PF_UNKNOWN,
PF_R8G8B8,
PF_R8G8B8A8,
PF_R8G8B8F,
PF_R8G8B8A8F,
// Depth formats
PF_DEPTH32F
};
// 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
};
enum TextureSurfaceType
{
TST_COLOR = 1 << 0,
TST_DEPTH = 1 << 1,
TST_STENCIL = 1 << 2,
};
enum PrimitiveType
{
PT_POINTS,
PT_LINES,
PT_TRIANGLES
};
enum TextureWrap
{
TW_REPEAT,
TW_MIRRORED_REPEAT,
TW_CLAMP_TO_EDGE,
TW_CLAMP_TO_BORDER
};
enum TextureFilter
{
TF_NEAREST,
TF_LINEAR,
TF_NEAREST_MIPMAP_NEAREST,
TF_LINEAR_MIPMAP_NEAREST,
TF_NEAREST_MIPMAP_LINEAR,
TF_LINEAR_MIPMAP_LINEAR
};
// Base structure for render view (view and projection matrices, viewport settings)
struct View
{
int x, y;
int width, height;
float fov;
};
// Global instance of render view
extern View g_renderView;
// pixel format convertion
uint GetGLPF(PixelFormat pf);
uint GetGLInternalPF(PixelFormat pf);
uint GetGLTypePF(PixelFormat pf);
// Blending factor convertion
uint GetGLBlendFactor(BlendFactor factor);
// Stretched picture vertex
//struct StretchedVertex
//{
// Vec3 position;
// Vec2 texcoord;
//};
//#define MAX_STRETCH_VX 12 * sizeof(StretchedVertex)
#endif