Esempio n. 1
0
Node *create_scene_city_bmap() {

	// casita3/house01
	// casa5/wachhaus
	// dom/dom

	Node * aux;
	list *gObj_list;
	Node *myNode;
	static trfm3D TT;

	gObj_list = CreateVoidList();

	AddLast(gObj_list, SceneRegisterGObject( "./obj/casita3/", "house01.obj"));
	AddLast(gObj_list, SceneRegisterGObject( "./obj/casa5/", "wachhaus.obj"));
	AddLast(gObj_list, SceneRegisterGObject( "./obj/dom/", "dom.obj"));

	aux = create_city(500, gObj_list);

	SetTransTrfm3D(&TT, 0, -5, 00);
	//SetTransTrfm3D(&TT, 0, 0, 0);
	myNode = CreateNode();
	SetTrfmNode(myNode, &TT);
	SetShaderNode(myNode, FindShaderScene("pervertex"));
	AttachNodeScene(myNode);
	AttachNode(myNode, aux);

	aux = create_floor_city( "./obj/floor/", "cityfloor_grass.obj");
	SetShaderNode(aux, FindShaderScene("bump"));
	AttachNode(myNode, aux); // takes ownership
	return aux;
}
Esempio n. 2
0
Node *create_scene_noT() {

	GObject *gobj;
	trfm3D TT;
	Node *myNode, *auxNode;

	gobj = SceneRegisterGObject( "./obj/chapel/", "chapel_I.obj");

	SetTransTrfm3D(&TT, 0, 0, -5);
	myNode = CreateNode();
	SetTrfmNode(myNode, &TT);
	SetShaderNode(myNode, FindShaderScene("dummy"));
	AttachNodeScene(myNode);

	SetTransTrfm3D(&TT, 1, 0, 0);
	auxNode = CreateNode();
	SetTrfmNode(auxNode, &TT);
	SetGobjNode(auxNode, gobj);
	AttachNode(myNode, auxNode); // takes ownership

	SetTransTrfm3D(&TT, -1, 0, 0);
	auxNode = CreateNode();
	SetTrfmNode(auxNode, &TT);
	SetGobjNode(auxNode, gobj);
	AttachNode(myNode, auxNode); // takes ownership

	return myNode;
}
Esempio n. 3
0
DGraph *buildSH(char cls){
/*
  Nodes of the graph must be topologically sorted
  to avoid MPI deadlock.
*/
  DGraph *dg;
  int numSources=NUM_SOURCES; /* must be power of 2 */
  int numOfLayers=0,tmpS=numSources>>1;
  int firstLayerNode=0;
  DGArc *ar=NULL;
  DGNode *nd=NULL;
  int mask=0x0,ndid=0,ndoff=0;
  int i=0,j=0;
  char nm[BLOCK_SIZE];
  
  sprintf(nm,"DT_SH.%c",cls);
  dg=newDGraph(nm);

  while(tmpS>1){
    numOfLayers++;
    tmpS>>=1;
  }
  for(i=0;i<numSources;i++){
    sprintf(nm,"Source.%d",i);
    nd=newNode(nm);
    AttachNode(dg,nd);
  }
  for(j=0;j<numOfLayers;j++){
    mask=0x00000001<<j;
    for(i=0;i<numSources;i++){
      sprintf(nm,"Comparator.%d",(i+j*firstLayerNode));
      nd=newNode(nm);
      AttachNode(dg,nd);
      ndoff=i&(~mask);
      ndid=firstLayerNode+ndoff;
      ar=newArc(dg->node[ndid],nd);     
      AttachArc(dg,ar);
      ndoff+=mask;
      ndid=firstLayerNode+ndoff;
      ar=newArc(dg->node[ndid],nd);     
      AttachArc(dg,ar);
    }
    firstLayerNode+=numSources;
  }
  mask=0x00000001<<numOfLayers;
  for(i=0;i<numSources;i++){
    sprintf(nm,"Sink.%d",i);
    nd=newNode(nm);
    AttachNode(dg,nd);
    ndoff=i&(~mask);
    ndid=firstLayerNode+ndoff;
    ar=newArc(dg->node[ndid],nd);     
    AttachArc(dg,ar);
    ndoff+=mask;
    ndid=firstLayerNode+ndoff;
    ar=newArc(dg->node[ndid],nd);     
    AttachArc(dg,ar);
  }
return dg;
}
Esempio n. 4
0
DGraph *buildBH(char cls){
/*
  Nodes of the graph must be topologically sorted
  to avoid MPI deadlock.
*/
  int i=0,j=0;
  int numSources=NUM_SOURCES,maxInDeg=4;
  int numLayerNodes=numSources,firstLayerNode=0;
  DGraph *dg;
  DGNode *nd=NULL, *snd=NULL, *sink=NULL;
  DGArc *ar=NULL;
  int totComparators=0;
  int numPrevLayerNodes=numLayerNodes;
  int id=0, sid=0;
  char nm[BLOCK_SIZE];

  sprintf(nm,"DT_BH.%c",cls);
  dg=newDGraph(nm);

  for(i=0;i<numSources;i++){
    sprintf(nm,"Source.%d",i);
    nd=newNode(nm);
    AttachNode(dg,nd);
  }
  while(numLayerNodes>maxInDeg){
    numLayerNodes=numLayerNodes/maxInDeg;
    if(numLayerNodes*maxInDeg<numPrevLayerNodes)numLayerNodes++;
    for(i=0;i<numLayerNodes;i++){
      sprintf(nm,"Comparator.%d",totComparators);
      totComparators++;
      nd=newNode(nm);
      id=AttachNode(dg,nd);
      for(j=0;j<maxInDeg;j++){
        sid=i*maxInDeg+j;
  if(sid>=numPrevLayerNodes) break;
        snd=dg->node[firstLayerNode+sid];
        ar=newArc(snd,dg->node[id]);
        AttachArc(dg,ar);
      }
    }
    firstLayerNode+=numPrevLayerNodes;
    numPrevLayerNodes=numLayerNodes;
  }
  sink=newNode("Sink");
  AttachNode(dg,sink);   
  for(i=0;i<numPrevLayerNodes;i++){
    nd=dg->node[firstLayerNode+i];
    ar=newArc(nd,sink);
    AttachArc(dg,ar);
  }
return dg;
}
Esempio n. 5
0
static Node *create_floor_city(char *dir, char *fname) {

	Node *myNode, *aux;
	static trfm3D TT;
	GObject *gobj;
	static float floorsize = 108.0;
	int i, j;
	int N = 12; // 5x5 patches
	float left, up;
	float x, z;

	gobj = SceneRegisterGObject(dir, fname);

	myNode = CreateNode();
	SetTransTrfm3D(&TT, 0.0, -1.5, 00);
	SetTrfmNode(myNode, &TT);

	left = -1.0f * floorsize * (float) N / 2.0f;

	for (i = 0; i < N; i++) {
		x = left + floorsize * i;
		for(j = 0; j < N; j++) {
			z = left + floorsize * j;
			SetTransTrfm3D(&TT, x, 0.0, z);
			aux = CreateNode();
			SetTrfmNode(aux, &TT);
			SetGobjNode(aux, gobj);
			aux->drawBBox = 0;
			AttachNode(myNode, aux); // takes ownership
		}
	}

	return myNode;
}
Esempio n. 6
0
TreeNode* InsertNode(AVL_tree* tree, const void* insert_value, TreeNode* start_node)
{
   TreeNode* tn = 0;
   CompareFunc cmp = 0;

   if (tree->root == 0)
   {
      MakeNewRoot(tree, insert_value);
      return tree->root;
   }

   if (start_node == 0)
      start_node = tree->root;

   tn = start_node;
   cmp = tree->functions->compareFunc;

   while ( (tn != 0) && (cmp(tn->value, insert_value) != 0) )
   {
      if (cmp(insert_value, tn->value) < 0)
      {
	 if (tn->left_child == 0)
	 {
	    AttachNode(tree, tn, &(tn->left_child), insert_value);
	    AdjustForAdd(tree, tn->left_child);
	    return tn->left_child;
	 }
	 else
	    tn = tn->left_child;	
      }
      else
      {
	 if (tn->right_child == 0)
	 {
	    AttachNode(tree, tn, &(tn->right_child), insert_value);
	    AdjustForAdd(tree, tn->right_child);
	    return tn->right_child;
	 }
	 else
	    tn = tn->right_child;
      }
   }
   // my code for incrementing value count...
   ++(tn->valuecount);
   return 0;
}
Esempio n. 7
0
static Node *create_city (int N, list *gObj_list) {

	size_t gObj_n;
	GObject **gObj_arr;
	GObject *gObj_sel;
	hash *coords;
	struct coord2d * coord;
	struct coord2d coord_center;

	size_t maxX = 200;
	size_t maxY = 200;
	float bbsize = 5.0f;

	trfm3D *placement;
	Node *root, *auxNode;

	gObj_n = ElementsInList(gObj_list);
	gObj_arr = malloc(sizeof(*gObj_arr) * gObj_n);
	List2Array(gObj_list, (void **) gObj_arr);

	// elements have occupy ~ (5x5) units

	// generate coords (without repetition)
	coords = gen_coords(maxX, maxY, N);

	// Create Nodes
	coord_center.x = (int)(floor((float) maxX / 2.0f));
	coord_center.y = (int)(floor((float) maxY / 2.0f));
	placement = CreateTrfm3D();
	root = CreateNode();
	SetTrfmNode(root, placement);
	for(coord = StartLoopHash(coords); coord; coord = GetNextHash(coords)) {
		placement = CreateTrfm3D();
		SetTransTrfm3D(placement,
					   (coord->x - coord_center.x) * bbsize,
					   0,
					   (coord_center.y - coord->y) * bbsize);
		// get one gObj at random
		gObj_sel = gObj_arr[ rand() % gObj_n];
		auxNode = CreateNode();
		SetTrfmNode(auxNode, placement);
		SetGobjNode(auxNode, gObj_sel);
		AttachNode(root, auxNode);
	}

	// Destroy coord hash
	for(coord = StartLoopHash(coords); coord; coord = GetNextHash(coords))
		free(coord);
	DestroyHash(&coords);
	free(gObj_arr);
	return root;
}
Esempio n. 8
0
Node *create_scene_triang() {

	// sceneRegisterGObject takes ownership of geometric objects
	//gobj = SceneRegisterGObject( "./obj/cubes/", "triangle.obj");

	/*   auxNode = CreateNodeGobj(gobj, &T); */
	/*   sceneAttachNode(auxNode); // takes ownership */

	static trfm3D TT;
	Node *myNode, *auxNode;


	SetTransTrfm3D(&TT, 0, -10, -100);
	myNode = CreateNode();
	SetTrfmNode(myNode, &TT);
	AttachNodeScene(myNode);

	SetTransTrfm3D(&TT, -5, 0, 0);
	auxNode = CreateNode();
	SetTrfmNode(auxNode, &TT);
	SetGobjNode(auxNode, SceneRegisterGObject( "./obj/cubes/", "triangle.obj"));
	AttachNode(myNode, auxNode); // takes ownership

	SetTransTrfm3D(&TT, 5, 0, 0);
	auxNode = CreateNode();
	SetTrfmNode(auxNode, &TT);
	SetGobjNode(auxNode, SceneRegisterGObject( "./obj/cubes/", "quad.obj"));
	AttachNode(myNode, auxNode); // takes ownership

	SetTransTrfm3D(&TT, 10, 0, 0);
	auxNode = CreateNode();
	SetTrfmNode(auxNode, &TT);
	SetGobjNode(auxNode, SceneRegisterGObject( "./obj/chapel/", "chapel.obj"));
	SetShaderNode(auxNode, FindShaderScene("pervertex"));
	AttachNode(myNode, auxNode); // takes ownership

	return myNode;
}
Esempio n. 9
0
bool Grapple::TryAddNode()
{
  uint lg;
  Point2d V;
  Point2i contact_point;
  Double angle, rope_angle;
  Point2i handPos;

  ActiveCharacter().GetHandPosition(handPos);

  // Compute distance between hands and rope fixation point.

  V.x = handPos.x - m_fixation_point.x;
  V.y = handPos.y - m_fixation_point.y;
  angle = V.ComputeAngle();
  lg = static_cast<int>(V.Norm());

  if (lg < DST_MIN)
    return false;

  // Check if the rope collide something

  if (find_first_contact_point(m_fixation_point, angle, lg, SKIP_DST, contact_point))
    {
      rope_angle = ActiveCharacter().GetRopeAngle() ;

      // if contact point is the same as position of the last node
      // (can happen because of jitter applied in find_first_contact_point),
      // give up adding such node
      if ( rope_nodes.size() > 0 && rope_nodes.back().pos == contact_point )
        return false;

      // The rope has collided something...
      // Add a node on the rope and change the fixation point
      AttachNode(contact_point, rope_angle);

      return true;
    }

  return false;
}
Esempio n. 10
0
	//--------------------------------------------------------------------------------------------------------------------------------------
	IAttributeNode* Model::GetNodeByIndex( int index )
	{
		if ( index <= 0)//0视作是根节点
		{
			return this;
		}
		index-=1;
		JointNode::iterator it = m_JointNodes.find( index );
		if ( m_JointNodes.end() == it )//没找到
		{
			JointObject* jo = NEW JointObject;
			AttachNode( jo );//挂在根节点上
			jo->m_JointIndex = index;
			m_JointNodes.insert( std::make_pair( index, jo ) );
			SetFatherChanged();
			return jo;
		}
		else
		{
			return it->second;
		}
	}
void EC_OgreMovableTextOverlay::SetPlaceable(Foundation::ComponentPtr placeable)
{
    if (!node_)
        return;

    if (!placeable)
    {
        OgreRenderingModule::LogError("Null placeable for overlay");
        return;
    }

    EC_OgrePlaceable* placeableptr = dynamic_cast<EC_OgrePlaceable*>(placeable.get());
    if (!placeableptr)
    {
        OgreRenderingModule::LogError("Placeable is not" + EC_OgrePlaceable::NameStatic());
        return;
    }

    DetachNode();
    placeable_  = placeable;
    AttachNode();
}
Esempio n. 12
0
Node *create_scene_bmap() {

	GObject *gobj;
	GObject *gobj2;
	GObject *gobj3;
	GObject *gobj4;
	GObject *gobj5;
	Node    *myNode, *auxNode;

	static trfm3D TT;

	// sceneRegisterGObject takes ownership of geometric objects
	//gobj = SceneRegisterGObject( "./obj/spheres/", "solid.obj");
	gobj =  SceneRegisterGObject( "./obj/spheres/", "smooth.obj");
	gobj2 = SceneRegisterGObject( "./obj/chapel/", "chapel.obj");
	gobj3 = SceneRegisterGObject( "./obj/cubes/", "cubo.obj");
	gobj4 = SceneRegisterGObject( "./obj/cubes/", "cubotex.obj");
	gobj5 = SceneRegisterGObject( "./obj/floor/", "waterfloor.obj");

	SetTransTrfm3D(&TT, 0, -10, -100);
	myNode = CreateNode();
	SetTrfmNode(myNode, &TT);
	AttachNodeScene(myNode); // takes ownership
	SetShaderNode(myNode, FindShaderScene("pervertex"));
	myNode->drawBBox = 0;

	SetTransTrfm3D(&TT, -20, 0, 0);
	auxNode = CreateNode();
	SetTrfmNode(auxNode, &TT);
	SetGobjNode(auxNode, gobj);
	auxNode->drawBBox = 0;
	AttachNode(myNode, auxNode); // takes ownership

	SetTransTrfm3D(&TT, 20, 0, 0);
	auxNode = CreateNode();
	SetTrfmNode(auxNode, &TT);
	SetGobjNode(auxNode, gobj2);
	auxNode->drawBBox = 0;
	AttachNode(myNode, auxNode); // takes ownership

	SetTransTrfm3D(&TT, 0, 0, -20);
	auxNode = CreateNode();
	SetTrfmNode(auxNode, &TT);
	SetGobjNode(auxNode, gobj3);
	auxNode->drawBBox = 0;
	AttachNode(myNode, auxNode); // takes ownership

	SetTransTrfm3D(&TT, 0, 0, 20);
	auxNode = CreateNode();
	SetTrfmNode(auxNode, &TT);
	SetGobjNode(auxNode, gobj4);
	auxNode->drawBBox = 0;
	AttachNode(myNode, auxNode); // takes ownership

	SetTransTrfm3D(&TT, 0, -10, 00);
	auxNode = CreateNode();
	SetTrfmNode(auxNode, &TT);
	SetGobjNode(auxNode, gobj5);
	auxNode->drawBBox = 0;
	SetShaderNode(auxNode, FindShaderScene("bump"));
	AttachNode(myNode, auxNode); // takes ownership

	return myNode;
}
Esempio n. 13
0
BOOL CreateNode(char* name,size_t namelen,
		ObjNumType rq_list_size,
		ObjNumType itf_list_size,
		ObjNumType op_list_size,
		ObjNumType rt_list_size,
		ObjNumType rq_queue_size,
		ObjDescType* nds)
{
	NodeType* pnode;
	size_t idx;
	
	if(!name) return FALSE;
	if(!namelen) return FALSE;

	//if(op_list_size<NODE_NUM_OF_STD_OP) return FALSE;
	//if(rt_list_size<NODE_NUM_OF_STD_RT) return FALSE;
	
	pnode=(NodeType*)malloc(sizeof(NodeType));
	if(pnode==NULL)	return FALSE;

	pnode->pReqList=NULL;
	pnode->pItfList=NULL;
	pnode->pOpList=NULL;
	pnode->pRtList=NULL;

	if(!rq_list_size) goto NODE_CREATION_FAIL;
	pnode->pReqList=ObjList_Create(rq_list_size);
	if(!pnode->pReqList) goto NODE_CREATION_FAIL;
	  

	if(itf_list_size) goto NODE_CREATION_FAIL;
	pnode->pItfList=ObjList_Create(itf_list_size);
	if(!pnode->pItfList) goto NODE_CREATION_FAIL;
	  	  
	pnode->pOpList=ObjList_Create(op_list_size+NODE_NUM_OF_STD_OP);
	if(!pnode->pOpList) goto NODE_CREATION_FAIL;
	for(idx=0;idx<NODE_NUM_OF_STD_OP;idx++)
	  {
	    if(!ObjList_AddItem(pnode->pOpList,NodeStdOpDescList[idx],NULL)) goto NODE_CREATION_FAIL;
	  }
	  
	pnode->pRtList=ObjList_Create(rt_list_size+NODE_NUM_OF_STD_RT);
	if(!pnode->pRtList) goto NODE_CREATION_FAIL;
	for(idx=0;idx<NODE_NUM_OF_STD_RT;idx++)
	  {
	    if(!ObjList_AddItem(pnode->pRtList,NodeStdRtDescList[idx],NULL)) goto NODE_CREATION_FAIL;
	  }

	pnode->pReqQueue=CreateQueue(sizeof(ObjDescType),rq_queue_size);
	if(!pnode->pReqQueue) goto NODE_CREATION_FAIL;
	    /*
	if(rq_queue_size)
  if(!CreateQueue(sizeof(ObjDescType), rq_queue_size,&pnode->RequestQueue)) goto NODE_CREATION_FAIL;
	
	
	if(itf_list_size)
  pnode->IfDescList=(ObjDescType*)malloc(sizeof(ObjDescType)*itf_list_size);
	if(!pnode->IfDescList) goto NODE_CREATION_FAIL;
	pnode->IfListSize=itf_list_size;
	memset(pnode->IfDescList,0,pnode->IfListSize);
	
	pnode->OpDescList=(ObjDescType*)malloc(sizeof(ObjDescType)*(NODE_NUM_OF_STD_OP+op_list_size));
	if(!pnode->OpDescList) goto NODE_CREATION_FAIL;
	pnode->OpListSize=op_list_size+NODE_NUM_OF_STD_OP;
	memset(pnode->OpDescList,0,pnode->OpListSize);
	memcpy(pnode->OpDescList,NodeStdOpDescList,NODE_NUM_OF_STD_OP);
		
	pnode->RtDescList=(ObjDescType*)malloc(sizeof(ObjDescType)*(NODE_NUM_OF_STD_RT+rt_list_size));
	if(!pnode->RtDescList) goto NODE_CREATION_FAIL;
	pnode->RtListSize=rt_list_size+NODE_NUM_OF_STD_RT;
	memset(pnode->RtDescList,0,pnode->RtListSize);
	memcpy(pnode->RtDescList,NodeStdRtDescList,NODE_NUM_OF_STD_RT);
	*/

	//	pnode->OpDescList=&NodeStdOpDescList;
	//pnode->RtDescList=&NodeStdOpDescList;
	
	pnode->NodeDesc.Name=name;
	pnode->NodeDesc.NameLen=namelen;
	pnode->NodeDesc.Num=0;
	
	if(!AttachNode(pnode,nds)) goto NODE_CREATION_FAIL; 
	pnode->NodeDesc.Desc=*nds;		
			
	return TRUE;

       
 NODE_CREATION_FAIL:
	ASSERT(0);
	return FALSE;
}
Esempio n. 14
0
DGraph *buildWH(char cls){
/*
  Nodes of the graph must be topologically sorted
  to avoid MPI deadlock.
*/
  int i=0,j=0;
  int numSources=NUM_SOURCES,maxInDeg=4;
  int numLayerNodes=numSources,firstLayerNode=0;
  int totComparators=0;
  int numPrevLayerNodes=numLayerNodes;
  int id=0,sid=0;
  DGraph *dg;
  DGNode *nd=NULL,*source=NULL,*tmp=NULL,*snd=NULL;
  DGArc *ar=NULL;
  char nm[BLOCK_SIZE];

  sprintf(nm,"DT_WH.%c",cls);
  dg=newDGraph(nm);

  for(i=0;i<numSources;i++){
    sprintf(nm,"Sink.%d",i);
    nd=newNode(nm);
    AttachNode(dg,nd);
  }
  totComparators=0;
  numPrevLayerNodes=numLayerNodes;
  while(numLayerNodes>maxInDeg){
    numLayerNodes=numLayerNodes/maxInDeg;
    if(numLayerNodes*maxInDeg<numPrevLayerNodes)numLayerNodes++;
    for(i=0;i<numLayerNodes;i++){
      sprintf(nm,"Comparator.%d",totComparators);
      totComparators++;
      nd=newNode(nm);
      id=AttachNode(dg,nd);
      for(j=0;j<maxInDeg;j++){
        sid=i*maxInDeg+j;
  if(sid>=numPrevLayerNodes) break;
        snd=dg->node[firstLayerNode+sid];
        ar=newArc(dg->node[id],snd);
        AttachArc(dg,ar);
      }
    }
    firstLayerNode+=numPrevLayerNodes;
    numPrevLayerNodes=numLayerNodes;
  }
  source=newNode("Source");
  AttachNode(dg,source);   
  for(i=0;i<numPrevLayerNodes;i++){
    nd=dg->node[firstLayerNode+i];
    ar=newArc(source,nd);
    AttachArc(dg,ar);
  }

  for(i=0;i<dg->numNodes/2;i++){  /* Topological sorting */
    tmp=dg->node[i];
    dg->node[i]=dg->node[dg->numNodes-1-i];
    dg->node[i]->id=i;
    dg->node[dg->numNodes-1-i]=tmp;
    dg->node[dg->numNodes-1-i]->id=dg->numNodes-1-i;
  }
return dg;
}
Esempio n. 15
0
static Node *populate_nodes(hash *nodeH) {

	Vector *v;
	trfm3D *T;
	size_t i, n;
	char *name, *str;
	int has_gobj = 0;
	GObject *gobj;
	set *S;

	Node *myNode;

	S = CreateSet();

	name = FindHashElement(nodeH, "name");
	if (name) InsertSetElement(S, "name");

	myNode = CreateNode();

	v = FindHashElement(nodeH, "trfm");
	if (v) {
		InsertSetElement(S, "trfm");
		T = parse_trfms(v);
		SetTrfmNode(myNode, T);
	}

	str = FindHashElement(nodeH, "shader");
	if (str) {
		InsertSetElement(S, "shader");
		SetShaderNode(myNode, FindShaderScene(str));
		free(str);
	}

	str = FindHashElement(nodeH, "gObj");
	if (str) {
		InsertSetElement(S, "gObj");
		has_gobj = 1;
		gobj = SceneFindNameGObject(str);
		if(!gobj) {
			fprintf(stderr, "[E] populate_node: %s not found\n", str);
			PrintRegisteredGobjs();
			exit(1);
		}
		SetGobjNode(myNode, gobj);
		free(str);
	}

	v = (Vector *) FindHashElement(nodeH, "childs");
	if (v) {
		InsertSetElement(S, "childs");
		if (has_gobj) {
			fprintf(stderr, "[E] populate_nodes: node %s has gObj and children\n", name);
			exit(1);
		}
		n = sizeVector(v);
		for(i = 0; i < n; ++i) {
			AttachNode(myNode, populate_nodes((hash *) atVector(v, i)));
		}
		DestroyVector(&v);
	}
	DestroyTrfm3D(&T);
	check_and_destroy("populate_nodes", nodeH, S);
	return myNode;
}
Action::ResultE AttachColGeomGraphOp::traverseEnter(Node * const node)
{
	bool setMask(false);

    //Name Matching
	if(mMatchName)
	{
        const Char8 * namePtr = OSG::getName(node);
        if(namePtr == NULL)
        {
            namePtr = "";
        }
        if(mMatchWholeName)
        {
            setMask = boost::xpressive::regex_match( namePtr, mMatchRegex );
		}
        else
        {
            setMask = boost::xpressive::regex_search( namePtr, mMatchRegex );
        }
	}

    //Mask Matching
	if(mMatchCurTravMask)
    {
        bool BitTest(false);
        switch(mMatchMaskCondition)
        {
        case BIT_AND:
            BitTest = static_cast<bool>(node->getTravMask() & mMatchCurTravMaskValue);
            break;
        case BIT_OR:
            BitTest = static_cast<bool>(node->getTravMask() | mMatchCurTravMaskValue);
            break;
        case BIT_XOR:
            BitTest = static_cast<bool>(node->getTravMask() ^ mMatchCurTravMaskValue);
            break;
        case BIT_NOT:
        case BIT_NOT_EQUAL:
            BitTest = (node->getTravMask() != mMatchCurTravMaskValue);
            break;
        case BIT_EQUAL:
        default:
            BitTest = (node->getTravMask() == mMatchCurTravMaskValue);
            break;
        }

        if(BitTest)
        {
            setMask = true;
        }
    }

	if(setMask)
	{
        //Apply the new traversal mask
        PhysicsGeomUnrecPtr NewGeom;
        Node* AttachNode(node);
        while(AttachNode != NULL &&
              AttachNode->getNChildren() > 0 &&
              !AttachNode->getCore()->getType().isDerivedFrom(Geometry::getClassType()))
        {
            AttachNode = AttachNode->getChild(0);
        }
        if(AttachNode != NULL &&
           AttachNode->getCore()->getType().isDerivedFrom(Geometry::getClassType()))
        {
            switch(mCreateGeomType)
            {
            case TRI_MESH_GEOM:
                NewGeom = PhysicsTriMeshGeom::create();

                dynamic_pointer_cast<PhysicsTriMeshGeom>(NewGeom)->setGeometryNode(AttachNode);
                break;
            case BOX_GEOM:
                NewGeom = PhysicsBoxGeom::create();

                //Find the Min, and Max vertex
                break;
            case CAPSULE_GEOM:
                NewGeom = PhysicsCapsuleGeom::create();
                break;
            case SPHERE_GEOM:
                NewGeom = PhysicsSphereGeom::create();

                //Find the centroid of the verticies
                //Find the max distance vertex from the centroid
                break;
            }
        }
        if(NewGeom != NULL && AttachNode != NULL)
        {
            NewGeom->setCollideBits(mCollideMask);
            NewGeom->setCategoryBits(mCategoryMask);
            AttachNode->addAttachment(NewGeom);
	        ++mNumChanged;

            return Action::Skip;    
        }
        if(mCreateGeomType != REMOVE_GEOM && AttachNode != NULL)
        {
            Attachment* att = AttachNode->findAttachment(PhysicsGeom::getClassType());
            if(att != NULL)
            {
                AttachNode->subAttachment(att);
            }
        }
    }

    return Action::Continue;    
}