Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/Model.cpp
Show First 20 Lines • Show All 504 Lines • ▼ Show 20 Lines | if (source->m_Flags & MODELFLAG_CASTSHADOWS) | ||||
m_Flags |= MODELFLAG_CASTSHADOWS; | m_Flags |= MODELFLAG_CASTSHADOWS; | ||||
m_ObjectBounds.SetEmpty(); | m_ObjectBounds.SetEmpty(); | ||||
InvalidateBounds(); | InvalidateBounds(); | ||||
} | } | ||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
// AddProp: add a prop to the model on the given point | // AddProp: add a prop to the model on the given point | ||||
void CModel::AddProp(const SPropPoint* point, CModelAbstract* model, CObjectEntry* objectentry, float minHeight, float maxHeight, bool selectable) | void CModel::AddProp(const SPropPoint* point, CModelAbstract* model, CObjectEntry* objectentry, float minHeight, float maxHeight, bool selectable, bool hidden) | ||||
{ | { | ||||
// position model according to prop point position | // position model according to prop point position | ||||
// this next call will invalidate the bounds of "model", which will in turn also invalidate the selection box | // this next call will invalidate the bounds of "model", which will in turn also invalidate the selection box | ||||
model->SetTransform(point->m_Transform); | model->SetTransform(point->m_Transform); | ||||
model->m_Parent = this; | model->m_Parent = this; | ||||
Prop prop; | Prop prop; | ||||
prop.m_Point = point; | prop.m_Point = point; | ||||
prop.m_Model = model; | prop.m_Model = model; | ||||
prop.m_ObjectEntry = objectentry; | prop.m_ObjectEntry = objectentry; | ||||
prop.m_MinHeight = minHeight; | prop.m_MinHeight = minHeight; | ||||
prop.m_MaxHeight = maxHeight; | prop.m_MaxHeight = maxHeight; | ||||
prop.m_Selectable = selectable; | prop.m_Selectable = selectable; | ||||
prop.m_Hidden = hidden; | |||||
m_Props.push_back(prop); | m_Props.push_back(prop); | ||||
} | } | ||||
void CModel::AddAmmoProp(const SPropPoint* point, CModelAbstract* model, CObjectEntry* objectentry) | void CModel::AddAmmoProp(const SPropPoint* point, CModelAbstract* model, CObjectEntry* objectentry) | ||||
{ | { | ||||
AddProp(point, model, objectentry); | AddProp(point, model, objectentry); | ||||
m_AmmoPropPoint = point; | m_AmmoPropPoint = point; | ||||
m_AmmoLoadedProp = m_Props.size() - 1; | m_AmmoLoadedProp = m_Props.size() - 1; | ||||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | CModelAbstract* CModel::Clone() const | ||||
clone->SetFlags(m_Flags); | clone->SetFlags(m_Flags); | ||||
for (size_t i = 0; i < m_Props.size(); i++) | for (size_t i = 0; i < m_Props.size(); i++) | ||||
{ | { | ||||
// eek! TODO, RC - need to investigate shallow clone here | // eek! TODO, RC - need to investigate shallow clone here | ||||
if (m_AmmoPropPoint && i == m_AmmoLoadedProp) | if (m_AmmoPropPoint && i == m_AmmoLoadedProp) | ||||
clone->AddAmmoProp(m_Props[i].m_Point, m_Props[i].m_Model->Clone(), m_Props[i].m_ObjectEntry); | clone->AddAmmoProp(m_Props[i].m_Point, m_Props[i].m_Model->Clone(), m_Props[i].m_ObjectEntry); | ||||
else | else | ||||
clone->AddProp(m_Props[i].m_Point, m_Props[i].m_Model->Clone(), m_Props[i].m_ObjectEntry, m_Props[i].m_MinHeight, m_Props[i].m_MaxHeight, m_Props[i].m_Selectable); | clone->AddProp(m_Props[i].m_Point, m_Props[i].m_Model->Clone(), m_Props[i].m_ObjectEntry, m_Props[i].m_MinHeight, m_Props[i].m_MaxHeight, m_Props[i].m_Selectable, m_Props[i].m_Hidden); | ||||
} | } | ||||
return clone; | return clone; | ||||
} | } | ||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////// | ///////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
// SetTransform: set the transform on this object, and reorientate props accordingly | // SetTransform: set the transform on this object, and reorientate props accordingly | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator