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.
124 lines
2.5 KiB
124 lines
2.5 KiB
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ============ |
|
// |
|
// Purpose: |
|
// |
|
// $NoKeywords: $ |
|
//============================================================================= |
|
|
|
#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 "bumpmap.h" |
|
|
|
#include <stdio.h> |
|
#include <string.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 |
|
// 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 ); |
|
|
|
// FGW |
|
/*g_BumpmapMgr.RenderStudioModel( true ); |
|
int ret = g_StudioRenderer.StudioDrawModel( flags ); |
|
g_BumpmapMgr.RenderStudioModel( false ); |
|
|
|
return ret;*/ |
|
} |
|
|
|
/* |
|
==================== |
|
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 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; |
|
}
|
|
|