39{
41
42 const TCHAR szFOBBoneName[] =
"FOB";
43
44
45 {
46 struct ModelInfo
47 {
48 const TCHAR* szModelName;
50 } aModels[] = {
51 { "", 6 },
52 { "", 0 },
53 { "data\\models\\treelittle.trb", 1 },
54 { "data\\models\\tree_bent_trunk.trb", 2 },
55 { "data\\models\\tree_standard_trunk.trb", 3 },
56 { "data\\models\\tree_tall_trunk.trb", 4 },
57 { "data\\models\\treewall_sim_trunks.trb", 5 },
58 { "", 7 }
59 };
60
62 m_pTrunks =
new Model[ m_iNumTrunks ];
63
64 for (
TINT i = 0; i < m_iNumTrunks; i++ )
65 {
66 const TCHAR* pchModelName = aModels[ i ].szModelName;
67 Model* pTreeModel = &m_pTrunks[ i ];
68
69 pTreeModel->m_uiID = aModels[ i ].iIndex;
70
71 if ( pchModelName[ 0 ] == '\0' )
72
73 {
74 pTreeModel->m_iNumFOBs = 1;
75 pTreeModel->m_pFOBMatrices = new TMatrix44[ 1 ];
76 pTreeModel->m_pFOBMatrices[ 0 ].Identity();
77 pTreeModel->m_fUnk1 = 0.0f;
78 pTreeModel->m_fRadius = 1.6f;
79
80 if ( i != 1 )
81 pTreeModel->m_fRadius = 4.4f;
82 }
83 else
84
85 {
86
87 pTreeModel->Load( pchModelName );
88
89
90 TModel* pModel = pTreeModel->m_pManagedModel->GetModel();
92
95
96 TSkeletonInstance* pSkeletonInstance = pTreeModel->m_pSceneObject->GetInstance()->GetSkeletonInstance();
97 TSkeleton* pSkeleton = pSkeletonInstance->
GetSkeleton();
98
99
100 pTreeModel->m_iNumFOBs = 0;
102 {
104
105 {
106 pTreeModel->m_iNumFOBs += 1;
107 }
108 }
109
110
111 TINT iCurrentFOB = 0;
112 pTreeModel->m_pFOBMatrices = new TMatrix44[ pTreeModel->m_iNumFOBs ];
114 {
116
117 {
119 }
120 }
121 }
122 }
123 }
124
125
126 {
127 const TCHAR* aFOBModelNames[] = {
128 "data\\models\\busha.trb",
129 "data\\models\\busha_LOD1.trb",
130 "data\\models\\foblittle.trb",
132 "data\\models\\tree_bent_fob.trb",
134 "data\\models\\tree_standard_fob.trb",
136 "data\\models\\tree_tall_fob.trb",
138 "data\\models\\treewall_sim_fobs.trb",
140 "data\\models\\fob_bens.trb",
142 "data\\models\\Fob_pond.trb",
144 };
145
147 m_pFOBs =
new Model[ m_iNumFOBs ];
148
149 for (
TINT i = 0; i < m_iNumFOBs; i++ )
150 {
151 if (
const TCHAR* pchModelName = aFOBModelNames[ i ] )
152 {
153
154 m_pFOBs[ i ].Load( pchModelName );
155 }
156 }
157 }
158
159
161 {
162 m_llFreeTreeInstances.PushFront( &m_aTreeInstances[ i ] );
163 }
164
166}
constexpr TFORCEINLINE TFLOAT GetRadius() const
constexpr TFORCEINLINE TVector3 & GetOrigin()
TModelLOD & GetLOD(TUINT32 a_uiLOD)
const TCHAR * GetName() const
TSkeletonBone * GetBone(const TCHAR *a_cBoneName, TUINT32 a_iLength=0)
TINT GetBoneCount() const
const TMatrix44 & GetBoneTransformCurrent(TINT a_iBone)
TSkeleton * GetSkeleton()