k3/src/k3_internal.h

87 lines
1.4 KiB
C

#pragma once
#include"k3.h"
#include"gl.h"
#include<cglm/vec2.h>
#include<cglm/frustum.h>
#include<cglm/cam.h>
#define GL_FROM_K3TEX(k3t) ((k3t) ? (k3t)->tex : 0)
#define GL_FROM_K3MARCHER(k3m) ((GLuint) (uintptr_t) (k3m))
#define GL_FROM_K3ARBVP(k3m) ((GLuint) (uintptr_t) (k3m))
#define GL_FROM_K3ARBFP(k3m) ((GLuint) (uintptr_t) (k3m))
#define GL_FROM_K3GLSL(k3m) ((GLuint) (uintptr_t) (k3m))
extern bool k3IsCore;
struct k3Tex {
GLuint tex;
int cubemap;
uint32_t szX;
uint32_t szY;
uint32_t szZ;
GLuint glInternalFormat;
GLuint glExternalFormat;
GLuint glInType;
bool mipmap;
// Asynchronous decoding
uint8_t deferredRemaining;
uint8_t *deferredData[6];
struct k3Tex *deferredNext;
};
struct k3Storage {
int16_t ref;
void(*free)(struct k3Storage*);
};
struct k3StorageBasic {
struct k3Storage;
GLuint gl;
};
struct k3Offscreen {
GLuint fbo;
struct k3Tex *diffuse;
struct k3Tex *depth;
struct {
uint8_t samples;
GLuint fbo;
GLuint rboDiffuse;
GLuint rboDepth;
} multisampling;
};
struct k3Mdl {
struct {
vec3 *pos;
uint8_t *boneids;
uint16_t *boneweights;
} cpuSkinning;
size_t verts;
struct k3StorageBasic *vstore;
struct k3StorageBasic *estore;
uint16_t meshCount;
struct k3Mesh *meshes;
size_t boneCount;
mat4 *invBind;
uint8_t *boneParents;
char *boneNames;
uint16_t animCount;
struct k3AnimationFountain **anims;
vec3 aabb[2];
int offV, offN, offC, offU, offB, offT;
const char *debugname;
};