halflife-sdk/cl_dll/GameStudioModelRenderer.cpp

120 lines
2.5 KiB
C++
Raw Normal View History

2002-12-23 00:00:00 +00:00
//========= Copyright <20> 1996-2002, Valve LLC, All rights reserved. ============
2001-11-08 00:00:00 +00:00
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
2000-11-07 00:00:00 +00:00
#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"
//
// Override the StudioModelRender virtual member functions here to implement custom bone
2001-11-08 00:00:00 +00:00
// setup, blending, etc.
2000-11-07 00:00:00 +00:00
//
// 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.
====================
*/
#define DLLEXPORT __declspec( dllexport )
extern "C" int DLLEXPORT HUD_GetStudioModelInterface( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *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;
}