示例#1
0
void WindObject::GetWorldBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box )
{
	if ( ! vpt || ! vpt->IsAlive() )
	{
		box.Init();
		return;
	}

	Box3 meshBox;
	Matrix3 mat = inode->GetObjectTM(t);
	box.Init();
	int hoopson;
	pblock2->GetValue(PB_HOOPSON,t,hoopson,FOREVER);
	if (hoopson)
	{	float decay; pblock2->GetValue(PB_DECAY,t,decay,FOREVER);
		if (decay>0.0f)
		{	float range,xy; range=2.0f*(decay > 0.0f?0.6931472f / decay:0.0f);
			int type;pblock2->GetValue(PB_TYPE,t,type,ivalid);
			if (type==FORCE_PLANAR)	
			{	pblock2->GetValue(PB_DISPLENGTH,t,xy,FOREVER);
				xy*=3.0f;
			} 
			else 
				xy=range;
			Box3 rangeBox(Point3(-xy,-xy,-range),Point3(xy,xy,range)); 
			for(int i = 0; i < 8; i++)	
				box += mat * rangeBox[i];
		}
	}
	GetLocalBoundBox(t,inode,vpt,meshBox);	
	for(int i = 0; i < 8; i++)
		box += mat * meshBox[i];
}
示例#2
0
void PBombObject::GetWorldBoundBox(TimeValue t, INode* inode, ViewExp* vpt, Box3& box )
{	Box3 meshBox;
	Matrix3 mat = inode->GetObjectTM(t);
	box.Init();
	int hoopson,dorange;
	pblock->GetValue(PB_RANGEON,t,hoopson,FOREVER);
	pblock->GetValue(PB_DECAYTYPE,0,dorange,FOREVER);
	if ((hoopson)&&(dorange))
	{ float decay; pblock->GetValue(PB_DECAY,t,decay,FOREVER);
	  if (decay>0.0f)
	  {	float range; range=2.0f*decay;
	    Box3 rangeBox(Point3(-range,-range,-range),Point3(range,range,range)); 
		for(int i = 0; i < 8; i++)	box += mat * rangeBox[i];
	  }
	}
	GetLocalBoundBox(t,inode,vpt,meshBox);	
	for(int i = 0; i < 8; i++)
		box += mat * meshBox[i];
}