Exemplo n.º 1
0
		void Scene::UpdateRecursive(Entity *e, const Matrix44 &current)
		{
			Components::SceneNode *nodeComp = e->Get<Components::SceneNode>();
			Components::Transform *transComp = e->Get<Components::Transform>();

			Matrix44 world = current * transComp->GetMatrix();
			transComp->SetWorldMatrix(world);

			const int32 size = nodeComp->children.size();
			for(int32 i = 0; i < size; i++) {
				UpdateRecursive(nodeComp->children[i], world);
			}
		}
Exemplo n.º 2
0
bool j1EntityManager::Update(float dt)
{
	accumulated_time += dt;

	if(accumulated_time >= update_ms_cycle)
	{
		do_logic = true;
	}

	UpdateRecursive(dt, &entities.trunk);

	if(do_logic == true)
	{
		//LOG("Did logic step after %f", accumulated_time);
		accumulated_time = 0.0f;
	}

	return true;
}
Exemplo n.º 3
0
void j1EntityManager::UpdateRecursive(float dt, p2TreeNode<j1Entity*>* node)
{
	j1Entity* entity = node->data;

	if(entity->IsActive() == true)
	{
		entity->FixedUpdate(dt);

		if(do_logic == true)
		{
			entity->LogicUpdate(accumulated_time);
		}

		p2List_item<p2TreeNode<j1Entity*>*>* item = node->childs.start;
		for(; item != NULL; item = item->next)
		{
			UpdateRecursive(dt, item->data);
		}
	}
}