// ---------------------------------------------------------------------------------- void GameObject::SetParent(GameObject* parent) { InvalidateBounds(); // mark 'old' ancestors as dirty. m_parent = parent; InvalidateBounds(); // mark 'new' ancestors as dirty. InvalidateWorld(); // mark world as dirty. }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // BuildAnimation: load raw animation frame animation from given file, and build a // animation specific to this model CSkeletonAnim* CModel::BuildAnimation(const VfsPath& pathname, const CStr& name, float speed, float actionpos, float actionpos2, float soundpos) { CSkeletonAnimDef* def = m_SkeletonAnimManager.GetAnimation(pathname); if (!def) return NULL; CSkeletonAnim* anim = new CSkeletonAnim(); anim->m_Name = name; anim->m_AnimDef = def; anim->m_Speed = speed; if (actionpos == -1.f) anim->m_ActionPos = -1.f; else anim->m_ActionPos = actionpos * anim->m_AnimDef->GetDuration(); if (actionpos2 == -1.f) anim->m_ActionPos2 = -1.f; else anim->m_ActionPos2 = actionpos2 * anim->m_AnimDef->GetDuration(); if (soundpos == -1.f) anim->m_SoundPos = -1.f; else anim->m_SoundPos = soundpos * anim->m_AnimDef->GetDuration(); anim->m_ObjectBounds.SetEmpty(); InvalidateBounds(); return anim; }
void DisplayElement::SetWidth (DISPLAY_INT w) { mRect.SetWidth(w); if (mFlags & DISPLAY_FLAG_BOUNDS_VALID) { InvalidateBounds(); } }
void DisplayElement::SizeTo(DISPLAY_INT w, DISPLAY_INT h) { mRect.SizeTo(w,h); if (mFlags & DISPLAY_FLAG_BOUNDS_VALID) { InvalidateBounds(); } }
void DisplayElement::MoveTo(DISPLAY_INT x, DISPLAY_INT y) { mRect.MoveTo(x, y); if (mFlags & DISPLAY_FLAG_BOUNDS_VALID) { InvalidateBounds(); } }
void DisplayElement::Move(WebRect * pRect) { mRect.Set(pRect); if (mFlags & DISPLAY_FLAG_BOUNDS_VALID) { InvalidateBounds(); } }
void CModelParticleEmitter::ValidatePosition() { // TODO: do we need to do anything here? // This is a convenient (though possibly not particularly appropriate) place // to invalidate bounds so they'll be recomputed from the recent particle data InvalidateBounds(); }
// ---------------------------------------------------------------------------------- void Locator::AddResource(ResourceReference* r, int /*index*/) { m_resource = r; m_modelTransforms.clear(); m_renderables.clear(); InvalidateBounds(); InvalidateWorld(); }
void DisplayElement::SetHeight (DISPLAY_INT h) { mRect.SetHeight(h); if (mFlags & DISPLAY_FLAG_BOUNDS_VALID) { InvalidateBounds(); } }
void CurveGob::RemovePoint(ControlPointGob* point) { assert(point->Parent() == this ); point->SetParent(NULL); auto it = std::find(m_points.begin(), m_points.end(), point); m_points.erase(it); m_needsRebuild = true; InvalidateBounds(); }
void DisplayElement::Remove(DisplayElement *pChild) { Unlink(pChild); pChild->mpParent = 0; pChild->SetManager(0); if (mFlags & DISPLAY_FLAG_BOUNDS_VALID) { InvalidateBounds(); } }
/////////////////////////////////////////////////////////////////////////////// // Initialize: setup patch data void CPatch::Initialize(CTerrain* parent,ssize_t x,ssize_t z) { delete m_RenderData; m_RenderData=0; m_Parent=parent; m_X=x; m_Z=z; InvalidateBounds(); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // CopyAnimation void CModel::CopyAnimationFrom(CModel* source) { m_Anim = source->m_Anim; m_AnimTime = source->m_AnimTime; m_Flags &= ~MODELFLAG_CASTSHADOWS; if (source->m_Flags & MODELFLAG_CASTSHADOWS) m_Flags |= MODELFLAG_CASTSHADOWS; m_ObjectBounds.SetEmpty(); InvalidateBounds(); }
void CurveGob::AddPoint(ControlPointGob* point, int index) { assert(point->Parent() == NULL); point->SetParent(this); if(index >=0) { m_points.insert(m_points.begin() + index, point); } else { m_points.push_back(point); } m_needsRebuild = true; InvalidateBounds(); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// // SetAnimation: set the given animation as the current animation on this model; // return false on error, else true bool CModel::SetAnimation(CSkeletonAnim* anim, bool once) { m_Anim = NULL; // in case something fails if (anim) { m_Flags &= ~MODELFLAG_NOLOOPANIMATION; if (once) m_Flags |= MODELFLAG_NOLOOPANIMATION; if (!m_BoneMatrices && anim->m_AnimDef) { // not boned, can't animate return false; } if (m_BoneMatrices && !anim->m_AnimDef) { // boned, but animation isn't valid // (e.g. the default (static) idle animation on an animated unit) return false; } if (anim->m_AnimDef && anim->m_AnimDef->GetNumKeys() != m_pModelDef->GetNumBones()) { // mismatch between model's skeleton and animation's skeleton LOGERROR(L"Mismatch between model's skeleton and animation's skeleton (%lu model bones != %lu animation keys)", (unsigned long)m_pModelDef->GetNumBones(), (unsigned long)anim->m_AnimDef->GetNumKeys()); return false; } // reset the cached bounds when the animation is changed m_ObjectBounds.SetEmpty(); InvalidateBounds(); // start anim from beginning m_AnimTime = 0; } m_Anim = anim; return true; }
void DisplayElement::InsertBefore (DisplayElement *pPlace, DisplayElement *pChild) { WEBC_ASSERT(pPlace != pChild); WEBC_ASSERT(pPlace->mpParent == this); if (pChild->mpParent) { pChild->mpParent->Unlink(pChild); if (pChild->mpParent != this) { if (pChild->mpParent->mFlags & DISPLAY_FLAG_BOUNDS_VALID) { pChild->mpParent->InvalidateBounds(); } } } if (pChild->mpParent != this) { if (mFlags & DISPLAY_FLAG_BOUNDS_VALID) { InvalidateBounds(); } pChild->mpParent = this; pChild->SetManager(GetManager()); } pChild->mpNext = pPlace; pChild->mpPrev = pPlace->mpPrev; if (pPlace->mpPrev) { pPlace->mpPrev->mpNext = pChild; } else { mpFirstChild = pChild; } pPlace->mpPrev = pChild; }
void DisplayElement::InsertLast(DisplayElement *pChild) { if (pChild->mpParent) { pChild->mpParent->Unlink(pChild); if (pChild->mpParent != this) { if (pChild->mpParent->mFlags & DISPLAY_FLAG_BOUNDS_VALID) { pChild->mpParent->InvalidateBounds(); } } } if (pChild->mpParent != this) { if (mFlags & DISPLAY_FLAG_BOUNDS_VALID) { InvalidateBounds(); } pChild->mpParent = this; pChild->SetManager(GetManager()); } pChild->mpPrev = mpLastChild; pChild->mpNext = 0; if (mpLastChild) { mpLastChild->mpNext = pChild; } else { mpFirstChild = pChild; } mpLastChild = pChild; }
// ---------------------------------------------------------------------------------- void GameObject::InvalidateWorld() { m_worldDirty = true; InvalidateBounds(); }
// ---------------------------------------------------------------------------------- void GameObject::SetVisible(bool visible) { InvalidateBounds(); // mark 'old' ancestors as dirty. m_visible = visible; }
// ---------------------------------------------------------------------------------- void GameObject::SetTransform(const Matrix& xform) { m_local = xform; InvalidateWorld(); InvalidateBounds(); }
void CurveGob::SetInterpolationType(int type) { m_type = (InterpolationType)type; m_needsRebuild = true; InvalidateBounds(); }
void CurveGob::SetSteps(int steps) { m_steps = steps; m_needsRebuild = true; InvalidateBounds(); }
void CurveGob::SetClosed(bool closed) { m_closed = closed; InvalidateBounds(); m_needsRebuild = true; }