OpenBarnyard
 
Loading...
Searching...
No Matches
ATerrainSection::ModelNode Class Reference

#include <ATerrainSection.h>

Inheritance diagram for ATerrainSection::ModelNode:

Public Types

enum  ModelNodeFlags_ : ModelNodeFlags { MNF_NONE = 0 , MNF_USE_LIGHTING = BITFLAG( 0 ) , MNF_GLOW = BITFLAG( 1 ) }
 
using ModelNodeFlags = TUINT8
 

Public Member Functions

 ModelNode ()
 
 ~ModelNode ()
 
void Render ()
 
void SetUseLighting (TBOOL a_bUseLighting)
 
void SetGlow (TBOOL a_bIsGlow)
 
TBOOL IsUsingLighting () const
 
AWorldMaterialGetAnimatedMaterial () const
 

Public Attributes

Toshi::TManagedModel m_ModelRef
 
Toshi::TSceneObject * m_pSceneObject
 
AWorldVis m_WorldVis
 
AWorldMaterialm_pAnimatedMaterial
 
char m_szType [TYPE_NAME_MAX_SIZE+1]
 
ModelNodeFlags m_eFlags
 
TBOOL m_bCreated
 

Static Public Attributes

static constexpr TUINT TYPE_NAME_MAX_SIZE = 14
 

Detailed Description

Definition at line 14 of file ATerrainSection.h.

Member Typedef Documentation

◆ ModelNodeFlags

Member Enumeration Documentation

◆ ModelNodeFlags_

Enumerator
MNF_NONE 
MNF_USE_LIGHTING 
MNF_GLOW 

Definition at line 18 of file ATerrainSection.h.

Constructor & Destructor Documentation

◆ ModelNode()

ATerrainSection::ModelNode::ModelNode ( )

Definition at line 392 of file ATerrainSection.cpp.

394{
395 m_szType[ 0 ] = '\0';
396}
#define TNULL
Definition Typedefs.h:23
#define TFALSE
Definition Typedefs.h:24
AWorldMaterial * m_pAnimatedMaterial
char m_szType[TYPE_NAME_MAX_SIZE+1]

◆ ~ModelNode()

ATerrainSection::ModelNode::~ModelNode ( )

Definition at line 398 of file ATerrainSection.cpp.

399{
400 TIMPLEMENT_D( "Destroy collision data" );
401
402 if ( m_pSceneObject )
403 {
404 m_pSceneObject->Delete();
405 }
406}
#define TIMPLEMENT_D(DESC)
Definition Defines.h:137
Toshi::TSceneObject * m_pSceneObject

Member Function Documentation

◆ GetAnimatedMaterial()

AWorldMaterial * ATerrainSection::ModelNode::GetAnimatedMaterial ( ) const
inline

Definition at line 37 of file ATerrainSection.h.

37{ return m_pAnimatedMaterial; }

◆ IsUsingLighting()

TBOOL ATerrainSection::ModelNode::IsUsingLighting ( ) const
inline

Definition at line 36 of file ATerrainSection.h.

36{ return !ISZERO( m_eFlags & MNF_USE_LIGHTING ); }
#define ISZERO(X)
Definition Defines.h:3

◆ Render()

void ATerrainSection::ModelNode::Render ( )

Definition at line 408 of file ATerrainSection.cpp.

409{
410 if ( m_bCreated )
411 {
412 AWorldMaterialHAL* pAnimatedMaterial = TDYNAMICCAST( AWorldMaterialHAL, m_pAnimatedMaterial );
413
414 if ( pAnimatedMaterial )
415 {
416 TScheduler* pScheduler = g_oSystemManager.GetScheduler();
417
418 pAnimatedMaterial->AddUVOffsetY( 1, pScheduler->GetCurrentDeltaTime() * 0.02f );
419
420 if ( 1.0 <= pAnimatedMaterial->GetUVOffsetY( 1 ) )
421 pAnimatedMaterial->AddUVOffsetY( 1, -1.0f );
422 }
423
424 ATerrainInterface* pTerrain = ATerrainInterface::GetSingleton();
425 AWorldShaderHAL* pShader = TSTATICCAST( AWorldShaderHAL, AWorldShader::GetSingleton() );
426
428 pShader->SetColours( pTerrain->GetLitShadowColor(), pTerrain->GetLitAmbientColor() );
429
430 m_pSceneObject->EnableSkeletonUpdate();
431 m_pSceneObject->RenderIfVisible();
432
434 pShader->SetColours( pTerrain->GetDefaultShadowColor(), pTerrain->GetDefaultAmbientColor() );
435 }
436}
#define TSTATICCAST(POINTERTYPE, VALUE)
Definition Defines.h:69
#define TDYNAMICCAST(T, OBJECT)
Definition TObject.h:227
TSystemManager g_oSystemManager
Definition TSystem.cpp:15
TFLOAT GetCurrentDeltaTime() const
Definition TScheduler.h:62
TScheduler * GetScheduler() const
Definition TSystem.h:155
void AddUVOffsetY(TUINT a_uiTextureIndex, TFLOAT a_fOffset)
TFLOAT GetUVOffsetY(TUINT a_uiTextureIndex)
void SetColours(const Toshi::TVector4 &a_rShadowColour, const Toshi::TVector4 a_rAmbientColour)
const Toshi::TVector4 & GetDefaultAmbientColor() const
const Toshi::TVector4 & GetLitShadowColor() const
const Toshi::TVector4 & GetLitAmbientColor() const
const Toshi::TVector4 & GetDefaultShadowColor() const
friend class ATerrainInterface

◆ SetGlow()

void ATerrainSection::ModelNode::SetGlow ( TBOOL a_bIsGlow)

Definition at line 446 of file ATerrainSection.cpp.

447{
448 if ( a_bIsGlow )
450 else
452
453 if ( TNULL != m_pSceneObject )
454 {
455 auto pModel = m_pSceneObject->GetModelRef()->GetModel();
456
457 for ( TINT i = 0; i < pModel->GetNumLODs(); i++ )
458 {
459 auto& rLOD = pModel->GetLOD( i );
460
461 for ( TINT k = 0; k < rLOD.iNumMeshes; k++ )
462 {
463 auto pMesh = rLOD.ppMeshes[ k ];
464 auto pMaterial = TSTATICCAST( AWorldMaterial, pMesh->GetMaterial() );
465
466 pMesh->SetFlags( TMesh::State_Glow, TTRUE );
467 pMaterial->SetFlags( TMaterial::FLAGS_GLOW, a_bIsGlow );
468 pMaterial->SetBlendMode( 3 );
469 }
470 }
471 }
472}
int TINT
Definition Typedefs.h:7
#define TTRUE
Definition Typedefs.h:25
@ State_Glow
Definition TMesh.h:21

◆ SetUseLighting()

void ATerrainSection::ModelNode::SetUseLighting ( TBOOL a_bUseLighting)

Definition at line 438 of file ATerrainSection.cpp.

439{
440 if ( a_bUseLighting )
442 else
444}

Member Data Documentation

◆ m_bCreated

TBOOL ATerrainSection::ModelNode::m_bCreated

Definition at line 47 of file ATerrainSection.h.

◆ m_eFlags

ModelNodeFlags ATerrainSection::ModelNode::m_eFlags

Definition at line 46 of file ATerrainSection.h.

◆ m_ModelRef

Toshi::TManagedModel ATerrainSection::ModelNode::m_ModelRef

Definition at line 40 of file ATerrainSection.h.

◆ m_pAnimatedMaterial

AWorldMaterial* ATerrainSection::ModelNode::m_pAnimatedMaterial

Definition at line 43 of file ATerrainSection.h.

◆ m_pSceneObject

Toshi::TSceneObject* ATerrainSection::ModelNode::m_pSceneObject

Definition at line 41 of file ATerrainSection.h.

◆ m_szType

char ATerrainSection::ModelNode::m_szType[TYPE_NAME_MAX_SIZE+1]

Definition at line 45 of file ATerrainSection.h.

◆ m_WorldVis

AWorldVis ATerrainSection::ModelNode::m_WorldVis

Definition at line 42 of file ATerrainSection.h.

◆ TYPE_NAME_MAX_SIZE

TUINT ATerrainSection::ModelNode::TYPE_NAME_MAX_SIZE = 14
staticconstexpr

Definition at line 25 of file ATerrainSection.h.


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