Esempio n. 1
0
void Frame::Init(Frame *parent, const char *label, unsigned int flags)
{
	m_sfx = 0;
	m_sbody = 0;
	m_astroBody = 0;
	m_parent = parent;
	m_flags = flags;
	m_radius = 0;
	m_pos = vector3d(0.0);
	m_vel = vector3d(0.0);
	m_angSpeed = 0.0;
	m_orient = matrix3x3d::Identity();
	ClearMovement();
	m_collisionSpace = new CollisionSpace();
	if (m_parent) m_parent->AddChild(this);
	if (label) m_label = label;
}
Esempio n. 2
0
void Frame::UpdateInterpTransform(double alpha)
{
	m_interpPos = alpha*m_pos + (1.0-alpha)*m_oldPos;

	double len = m_oldAngDisplacement * (1.0-alpha);
	if (!is_zero_exact(len)) {			// very small values are normal here
		matrix3x3d rot = matrix3x3d::RotateY(len);		// RotateY is backwards
		m_interpOrient = m_orient * rot;
	}
	else m_interpOrient = m_orient;

	if (!m_parent) ClearMovement();
	else {
		m_rootInterpPos = m_parent->m_rootInterpOrient * m_interpPos
			+ m_parent->m_rootInterpPos;
		m_rootInterpOrient = m_parent->m_rootInterpOrient * m_interpOrient;
	}

	for (ChildIterator it = m_children.begin(); it != m_children.end(); ++it)
		(*it)->UpdateInterpTransform(alpha);
}
Esempio n. 3
0
void Frame::UpdateInterpTransform(double alpha)
{
	PROFILE_SCOPED()
	m_interpPos = alpha*m_pos + (1.0-alpha)*m_oldPos;

	double len = m_oldAngDisplacement * (1.0-alpha);
	if (!is_zero_exact(len)) {			// very small values are normal here
		matrix3x3d rot = matrix3x3d::RotateY(len);		// RotateY is backwards
		m_interpOrient = m_orient * rot;
	}
	else m_interpOrient = m_orient;

	if (!m_parent) ClearMovement();
	else {
		m_rootInterpPos = m_parent->m_rootInterpOrient * m_interpPos
			+ m_parent->m_rootInterpPos;
		m_rootInterpOrient = m_parent->m_rootInterpOrient * m_interpOrient;
	}

	for (Frame* kid : m_children)
		kid->UpdateInterpTransform(alpha);
}