Esempio n. 1
0
void Camera::lookAt(const glm::vec4& target, const glm::vec4& up) {
	// create an orthogonal matrix frame that is aimed at the target
	glm::vec3 zAxis(glm::normalize(m_localTransform[3] - target));
	glm::vec3 xAxis = glm::normalize(glm::cross(glm::vec3(up), zAxis));
	glm::vec3 yAxis = glm::normalize(glm::cross(zAxis, xAxis));

	m_localTransform[0] = glm::vec4(xAxis, 0);
	m_localTransform[1] = glm::vec4(yAxis, 0);
	m_localTransform[2] = glm::vec4(zAxis, 0);

	updateGlobalTransform();
}
Esempio n. 2
0
void Camera::lookAtFrom(const glm::vec3& eye,
	const glm::vec3& target,
	const glm::vec3& up) {
	// create an orthogonal matrix frame that is aimed at the target from the eye position
	glm::vec3 zAxis = glm::normalize(eye - target);
	glm::vec3 xAxis = glm::normalize(glm::cross(up, zAxis));
	glm::vec3 yAxis = glm::normalize(glm::cross(zAxis, xAxis));

	m_localTransform[0] = glm::vec4(xAxis, 0);
	m_localTransform[1] = glm::vec4(yAxis, 0);
	m_localTransform[2] = glm::vec4(zAxis, 0);
	m_localTransform[3] = glm::vec4(eye, 1);

	updateGlobalTransform();
}
Esempio n. 3
0
void Node::Update(sf32 time)
{
	for ( su32 j = 0 ; j < Animators.size() ; j ++ )
	{
		NodeAnimator& animator = *( Animators[j] ) ;

		animator.animate(time);
	}

    if ( _mTransformChanged )
	{
		updateGlobalTransform();
	}

	for ( su32 i = 0 ; i < Children.size() ; i ++ )
	{
        Node& node = *( Children[i] ) ;
		node.Update(time);
	}
}