Exemple #1
0
void Node::rotateBy(const Matrix3x3& rotation)
{
    localTransform_.rotation *= rotation;
    invalidateWorldTransform();

    // invalidateWorlTransform() should invalidate the world transform
    GRAPHICS_RUNTIME_ASSERT(worldTransformValid_ == false);
}
Exemple #2
0
void Node::transformBy(const Transform3& transform)
{
    localTransform_ = ::transform(localTransform_, transform);
    invalidateWorldTransform();

    // invalidateWorlTransform() should invalidate the world transform
    GRAPHICS_RUNTIME_ASSERT(worldTransformValid_ == false);
}
Exemple #3
0
void Node::translateBy(const Vector3& translation)
{
    localTransform_.translation += translation;
    invalidateWorldTransform();

    // invalidateWorlTransform() should invalidate the world transform
    GRAPHICS_RUNTIME_ASSERT(worldTransformValid_ == false);
}
Exemple #4
0
void Node::setLocalScale(float newScale)
{
  m_local.scale = newScale;

  if (m_parent)
    m_parent->invalidateBounds();

  invalidateWorldTransform();
}
Exemple #5
0
void Node::setLocalRotation(const quat& newRotation)
{
  m_local.rotation = newRotation;

  if (m_parent)
    m_parent->invalidateBounds();

  invalidateWorldTransform();
}
Exemple #6
0
void Node::setLocalPosition(const vec3& newPosition)
{
  m_local.position = newPosition;

  if (m_parent)
    m_parent->invalidateBounds();

  invalidateWorldTransform();
}
Exemple #7
0
void Node::setLocalTransform(const Transform3& newTransform)
{
  m_local = newTransform;

  if (m_parent)
    m_parent->invalidateBounds();

  invalidateWorldTransform();
}
Exemple #8
0
void Node::scaleBy(const float scaling)
{
    GRAPHICS_RUNTIME_ASSERT(scaling > 0.0f);

    localTransform_.scaling *= scaling;
    invalidateWorldTransform();

    // invalidateWorlTransform() should invalidate the world transform
    GRAPHICS_RUNTIME_ASSERT(worldTransformValid_ == false);
}
Exemple #9
0
void Node::setScalingLocked(const bool locked)
{
    if (scalingLocked_ == locked)
    {
        // nothing to do
        return;
    }

    scalingLocked_ = locked;
    invalidateWorldTransform();

    // invalidateWorlTransform() should invalidate the world transform
    GRAPHICS_RUNTIME_ASSERT(worldTransformValid_ == false);
}
Exemple #10
0
void Node::removeFromParent()
{
  if (m_parent || m_graph)
  {
    if (m_parent)
    {
      auto& siblings = m_parent->m_children;
      siblings.erase(std::find(siblings.begin(), siblings.end(), this));

      m_parent->invalidateBounds();
      m_parent = nullptr;

      invalidateWorldTransform();
    }
    else
    {
      auto& roots = m_graph->m_roots;
      roots.erase(std::find(roots.begin(), roots.end(), this));
    }

    setGraph(nullptr);
  }
}