ns/main/source/cl_dll/GameStudioModelRenderer.cpp
Karl 8552ac617c Import from old repository
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@1 67975925-1194-0748-b3d5-c16f83f1a3a1
2005-03-09 01:31:56 +00:00

116 lines
2.4 KiB
C++

#include <assert.h>
#include "hud.h"
#include "cl_util.h"
#include "const.h"
#include "com_model.h"
#include "studio.h"
#include "entity_state.h"
#include "cl_entity.h"
#include "dlight.h"
#include "triangleapi.h"
#include <stdio.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include "studio_util.h"
#include "r_studioint.h"
#include "StudioModelRenderer.h"
#include "GameStudioModelRenderer.h"
#include "engine/APIProxy.h"
#include "cl_dll/Exports.h"
//
// Override the StudioModelRender virtual member functions here to implement custom bone
// setup, blending, etc.
//
// Global engine <-> studio model rendering code interface
extern engine_studio_api_t IEngineStudio;
// The renderer object, created on the stack.
CGameStudioModelRenderer g_StudioRenderer;
/*
====================
CGameStudioModelRenderer
====================
*/
CGameStudioModelRenderer::CGameStudioModelRenderer( void )
{
}
////////////////////////////////////
// Hooks to class implementation
////////////////////////////////////
/*
====================
R_StudioDrawPlayer
====================
*/
int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
{
return g_StudioRenderer.StudioDrawPlayer( flags, pplayer );
}
/*
====================
R_StudioDrawModel
====================
*/
int R_StudioDrawModel( int flags )
{
return g_StudioRenderer.StudioDrawModel( flags );
}
/*
====================
R_StudioInit
====================
*/
void R_StudioInit( void )
{
g_StudioRenderer.Init();
}
// The simple drawing interface we'll pass back to the engine
r_studio_interface_t studio =
{
STUDIO_INTERFACE_VERSION,
R_StudioDrawModel,
R_StudioDrawPlayer,
};
/*
====================
HUD_GetStudioModelInterface
Export this function for the engine to use the studio renderer class to render objects.
====================
*/
extern "C" int CL_DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio )
{
RecClStudioInterface(version, ppinterface, pstudio);
if ( version != STUDIO_INTERFACE_VERSION )
return 0;
// Point the engine to our callbacks
*ppinterface = &studio;
// Copy in engine helper functions
memcpy( &IEngineStudio, pstudio, sizeof( IEngineStudio ) );
// Initialize local variables, etc.
R_StudioInit();
// Success
return 1;
}