bool TSShapeImport::import(TSShape* shape,ITRGeometry* geometry)
{
	//
	printf("TSShape Import\n");

	//
	VectorPtr<TSPartList*> partStack;
	partStack.push_back(dynamic_cast<TSPartList*>(shape));
	while (!partStack.empty()) {
		TSPartList& partList = *partStack.last();
		partStack.decrement();
		for (int i = 0; i < partList.getPartCount(); i++)
			if (TSPartList *pl = dynamic_cast<TSPartList*>(partList[i]))
				partStack.push_back(pl);
			else
				if (TSMesh* pm = dynamic_cast<TSMesh*>(partList[i])) {
					if (!import(pm,shape->getMaterialList(),geometry))
						return false;
				}
	}

	printf("   Vertices: %d\n",geometry->point3List.size());
	printf("   Surfaces: %d\n",geometry->surfaceList.size());
	printf("   Polygons: %d\n",geometry->polyList.size());
	printf("   Planes: %d\n",geometry->planeList.size());
	return true;
}
Example #2
0
Status BehaviorTreeStepper::stepThrough(VectorPtr<Task *> &taskVector) 
{
   if(taskVector.empty()) return INVALID;
         
   if(taskVector.back()->getStatus() == SUSPENDED)
      return SUSPENDED;

   Status status = INVALID;

   // loop through the tasks in the task list
   while(!taskVector.empty())
   {
      // get a task
      Task *currentTask = taskVector.back();

      // tick the task
      Task *nextTask = currentTask->tick();
      
      // if task returned no children, it has completed
      if(!nextTask)
      {
         // stop if it's RUNNING or SUSPENED
         status = currentTask->getStatus();
         if(status == RUNNING || status == SUSPENDED)
            break;
               
         // otherwise, remove it from the list
         taskVector.pop_back();
         if(!taskVector.empty())
            // and tell its parent that it completed
            taskVector.back()->onChildComplete(currentTask->getStatus());

         // complete the task
         currentTask->finish();
      }
      else
      {
         // add the child as a task
         nextTask->setup();
         taskVector.push_back(nextTask);
      }
   }

   return status;
}