OpenBarnyard
 
Loading...
Searching...
No Matches
TModelInstance Class Reference

#include <TModel.h>

Public Types

using t_PreRenderCB = void ( * )( TModelInstance* a_pInstance )
 
using t_CustomRenderCB = void ( * )( TModelInstance* a_pInstance, void* a_pUserData )
 

Public Member Functions

 TModelInstance (TModel *a_pModel)
 
 ~TModelInstance ()
 
void Update (TFLOAT a_fDeltaTime)
 
void Render ()
 
void Delete ()
 
void SetPreRenderCallback (t_PreRenderCB a_fnCallback)
 
void SetCustomRenderMethod (t_CustomRenderCB a_fnCallback, void *a_pUserData)
 
TINT32 GetLOD ()
 
void SetLOD (TINT32 a_iLOD)
 
TModelGetModel () const
 
TSkeletonInstanceGetSkeletonInstance () const
 

Friends

class TModel
 

Detailed Description

Definition at line 34 of file TModel.h.

Member Typedef Documentation

◆ t_CustomRenderCB

using TModelInstance::t_CustomRenderCB = void ( * )( TModelInstance* a_pInstance, void* a_pUserData )

Definition at line 40 of file TModel.h.

◆ t_PreRenderCB

using TModelInstance::t_PreRenderCB = void ( * )( TModelInstance* a_pInstance )

Definition at line 39 of file TModel.h.

Constructor & Destructor Documentation

◆ TModelInstance()

TModelInstance::TModelInstance ( TModel * a_pModel)

Definition at line 253 of file TModel.cpp.

254{
255 m_pModel = a_pModel;
256 m_pSkeletonInstance = TNULL;
257 m_fnPreRenderCb = 0;
258 m_fnCustomRenderCb = TNULL;
259 m_pCustomRenderCbUserData = TNULL;
260 m_iCurrentLOD = 0;
261}
#define TNULL
Definition Typedefs.h:23

◆ ~TModelInstance()

TModelInstance::~TModelInstance ( )

Definition at line 263 of file TModel.cpp.

264{
265}

Member Function Documentation

◆ Delete()

void TModelInstance::Delete ( )

Definition at line 319 of file TModel.cpp.

320{
321 if ( m_pSkeletonInstance )
322 {
323 m_pSkeletonInstance->Delete();
324 m_pSkeletonInstance = TNULL;
325 }
326
327 m_pModel->m_iNumInstances--;
328 m_pModel = TNULL;
329 delete this;
330}

◆ GetLOD()

TINT32 TModelInstance::GetLOD ( )

Definition at line 313 of file TModel.cpp.

314{
315 return m_iCurrentLOD;
316}

◆ GetModel()

TModel * TModelInstance::GetModel ( ) const

Definition at line 332 of file TModel.cpp.

333{
334 return m_pModel;
335}

◆ GetSkeletonInstance()

TSkeletonInstance * TModelInstance::GetSkeletonInstance ( ) const

Definition at line 337 of file TModel.cpp.

338{
339 return m_pSkeletonInstance;
340}

◆ Render()

void TModelInstance::Render ( )

Definition at line 273 of file TModel.cpp.

274{
275 if ( m_fnPreRenderCb )
276 {
277 m_fnPreRenderCb( this );
278 }
279
280 if ( !m_fnCustomRenderCb )
281 {
282 m_pSkeletonInstance->UpdateState( TTRUE );
284
285 for ( TINT i = 0; i < m_pModel->m_LODs[ m_iCurrentLOD ].iNumMeshes; i++ )
286 {
287 auto pMesh = m_pModel->m_LODs[ m_iCurrentLOD ].ppMeshes[ i ];
288 pMesh->Render();
289 }
290 }
291 else
292 {
293 m_fnCustomRenderCb( this, m_pCustomRenderCbUserData );
294 }
295}
int TINT
Definition Typedefs.h:7
#define TTRUE
Definition Typedefs.h:25
void SetSkeletonInstance(TSkeletonInstance *a_pSkeletonInstance)
TRenderContext * GetCurrentContext() const
static TFORCEINLINE TRenderInterface * GetSingleton()
Definition TSingleton.h:49

◆ SetCustomRenderMethod()

void TModelInstance::SetCustomRenderMethod ( t_CustomRenderCB a_fnCallback,
void * a_pUserData )

Definition at line 302 of file TModel.cpp.

303{
304 m_fnCustomRenderCb = a_fnCallback;
305 m_pCustomRenderCbUserData = a_pUserData;
306}

◆ SetLOD()

void TModelInstance::SetLOD ( TINT32 a_iLOD)

Definition at line 308 of file TModel.cpp.

309{
310 m_iCurrentLOD = a_iLOD;
311}

◆ SetPreRenderCallback()

void TModelInstance::SetPreRenderCallback ( t_PreRenderCB a_fnCallback)

Definition at line 297 of file TModel.cpp.

298{
299 m_fnPreRenderCb = a_fnCallback;
300}

◆ Update()

void TModelInstance::Update ( TFLOAT a_fDeltaTime)

Definition at line 267 of file TModel.cpp.

268{
269 m_pSkeletonInstance->UpdateTime( a_fDeltaTime );
270}

Friends And Related Symbol Documentation

◆ TModel

friend class TModel
friend

Definition at line 37 of file TModel.h.


The documentation for this class was generated from the following files: