#include "uniquake.h" #include "../Quake/quakedef.h" #include "../Quake/gl_model.h" typedef struct unity_glcalls_s { void *target; int(*UploadAliasModel)(void *target, const char *name, aliashdr_t *aliashdr, aliasframetype_t frametype, maliasframedesc_t *frames, trivertx_t **poseVerts, mtriangle_t *triangles, stvert_t *stVerts); int(*UploadBrushModel)(void *target, qmodel_t *model); qboolean(*UploadTexture)(void *target, gltexture_t *texture, unsigned *data, GLuint *texnum); } unity_glcalls_t; const unity_glcalls_t *unity_glcalls; int UQ_GL_UploadAliasModel(qmodel_t *model, aliashdr_t *aliashdr, aliasframetype_t frametype, trivertx_t **poseVerts, mtriangle_t *triangles, stvert_t *stVerts) { // C# doesn't really understand this idea of a variable-length embedded array of structs, // so we pass along the pointer to the first frame struct which allows us to manually marshal the entire array. return unity_glcalls->UploadAliasModel(unity_glcalls->target, model->name, aliashdr, frametype, &aliashdr->frames[0], poseVerts, triangles, stVerts); } int UQ_GL_UploadBrushModel(qmodel_t *model) { return unity_glcalls->UploadBrushModel(unity_glcalls->target, model); } qboolean UQ_GL_UploadTexture(gltexture_t *texture, unsigned *data) { // Allow UniQuake to either sync up its internal texture reference number, or assign a new one. return unity_glcalls->UploadTexture(unity_glcalls->target, texture, data, &texture->texnum); }