예제 #1
0
파일: camera.cpp 프로젝트: chenbk85/KGLT
void Camera::update_following(double dt) {
    ActorPtr following_actor = following_actor_.lock();
    if(following_actor) {
        kmQuaternion actor_rotation = following_actor->absolute_rotation();
        kmVec3 actor_position = following_actor->absolute_position();

        kmVec3 actor_forward;
        kmQuaternionGetForwardVec3RH(&actor_forward, &actor_rotation);

        kmQuaternion initial_rotation;
        kmQuaternionAssign(&initial_rotation, &rotation_);

        float t = ((following_lag_ == 0) ? 1.0 : dt * (1.0 / following_lag_));
        kmQuaternionSlerp(&rotation_, &initial_rotation, &actor_rotation, t);

        kmVec3 rotated_offset;
        kmQuaternionMultiplyVec3(&rotated_offset, &rotation_, &following_offset_);

        //kmMat4RotationQuaternion(&new_rotation_matrix, &rotation_);
        //kmVec3MultiplyMat4(&rotated_offset, &following_offset_, &new_rotation_matrix);
        kmVec3Add(&position_, &rotated_offset, &actor_position);

        update_from_parent();
    } else {
        //The actor was destroyed, so reset
        following_actor_ = ActorRef();
    }
}
예제 #2
0
파일: IActor.cpp 프로젝트: aquaworks/IShape
ActorRef IActor::Find(ActorSelector const& selector) const
{
	if (selector(m_self.lock()))
	{
		return m_self;
	}

	for (auto&& child : m_children)
	{
		ActorRef&& find = child->Find(selector);
		if (!find.expired())
		{
			return find;
		}
	}

	return ActorRef();
}
예제 #3
0
파일: Tcp.cpp 프로젝트: vortex314/ea_actor
ActorRef TcpClient::create(const char* host, uint16_t port) {
return ActorRef(new TcpClient(host, port));
}
예제 #4
0
ActorRef Splitter::create(ActorRef input) {
	return ActorRef(new Splitter(input));
}
예제 #5
0
ActorRef LineFramer::create(ActorRef link) {
	return ActorRef(new LineFramer(link));
}
예제 #6
0
파일: Tcp.cpp 프로젝트: vortex314/ea_stm32
//_____________________________________________________________
//
ActorRef TcpServer::create(ActorRef wifi, uint16_t port) {
return ActorRef(new TcpServer(wifi, port));
}
예제 #7
0
파일: Tcp.cpp 프로젝트: vortex314/ea_stm32
ActorRef Tcp::create() {
	return ActorRef(new Tcp());
}