You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
2.1 KiB
51 lines
2.1 KiB
#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);
|
|
int(*UploadWorldModel)(void *target, qmodel_t *model);
|
|
qboolean(*UploadTexture)(void *target, gltexture_t *texture, unsigned *data, GLuint *texnum);
|
|
qboolean(*UploadLightmap)(void *target, int lmap, int width, int height, byte *data);
|
|
void(*SetupView)(void *target, vec3_t origin, vec3_t angles, mleaf_t *viewLeaf);
|
|
} 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);
|
|
}
|
|
|
|
int UQ_GL_UploadWorldModel(qmodel_t *model)
|
|
{
|
|
return unity_glcalls->UploadWorldModel(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);
|
|
}
|
|
|
|
qboolean UQ_GL_UploadLightmap(int lmap, int width, int height, byte *data)
|
|
{
|
|
return unity_glcalls->UploadLightmap(unity_glcalls->target, lmap, width, height, data);
|
|
}
|
|
|
|
void UQ_GL_SetupView(vec3_t origin, vec3_t angles, mleaf_t *viewLeaf)
|
|
{
|
|
unity_glcalls->SetupView(unity_glcalls->target, origin, angles, viewLeaf);
|
|
}
|