Пример #1
0
void light::set_active		(bool a)
{
	if (a)
	{
		if (flags.bActive)					return;
		flags.bActive						= true;
		spatial_register					();
		spatial_move						();
		//Msg								("! L-register: %X",u32(this));

#ifdef DEBUG
		Fvector	zero = {0,-1000,0}			;
		if (position.similar(zero))			{
			Msg	("- Uninitialized light position.");
		}
#endif // DEBUG
	}
	else
	{
		if (!flags.bActive)					return;
		flags.bActive						= false;
		spatial_move						();
		spatial_unregister					();
		//Msg								("! L-unregister: %X",u32(this));
	}
}
Пример #2
0
void CPHShell::Deactivate(){

#ifdef ANIMATED_PHYSICS_OBJECT_SUPPORT
	if (m_pPhysicsShellAnimatorC)
	{
		xr_delete<CPhysicsShellAnimator>(m_pPhysicsShellAnimatorC); 
	}
#endif

	if(!isActive())return;
	R_ASSERT2(!ph_world->Processing(),"can not deactivate physics shell during physics processing!!!");
	R_ASSERT2(!ph_world->IsFreezed(),"can not deactivate physics shell when ph world is freezed!!!");
	R_ASSERT2(!CPHObject::IsFreezed(),"can not deactivate freezed !!!");
	ZeroCallbacks();
	VERIFY(ph_world&&ph_world->Exist());
	if(isFullActive())
	{
		vis_update_deactivate();
		CPHObject::activate();
		ph_world->Freeze();
		CPHObject::UnFreeze();
		ph_world->StepTouch();
		ph_world->UnFreeze();
		//Fmatrix m;
		//InterpolateGlobalTransform(&m);
	}
	spatial_unregister();
	
	vis_update_activate();
	//if(ref_object && !CPHObject::is_active() && m_active_count == 0)
	//{
	//	ref_object->processing_activate();
	//}
	DisableObject();
	CPHObject::remove_from_recently_deactivated();
	

	ELEMENT_I i;
	for(i=elements.begin();elements.end() != i;++i)
		(*i)->Deactivate();

	JOINT_I j;
	for(j=joints.begin();joints.end() != j;++j)
		(*j)->Deactivate();

	

	if(m_space) {
		dSpaceDestroy(m_space);
		m_space=NULL;
	}
	//bActive=false;
	//bActivating=false;
	m_flags.set(flActivating,FALSE);
	m_flags.set(flActive,FALSE);
	m_traced_geoms.clear();
	CPHObject::UnsetRayMotions();
}
Пример #3
0
void CPHActivationShape::	Destroy	()
{
	VERIFY(m_geom&&m_body)				;
	spatial_unregister		()			;
	CPHObject::deactivate	()			;
	dGeomDestroyUserData	(m_geom)	;
	dGeomDestroy			(m_geom)	;
	m_geom					=NULL		;
	dBodyDestroy			(m_body)	;
	m_body					=NULL		;
}
Пример #4
0
void CObject::net_Destroy		()
{
	VERIFY						(getDestroy());
	xr_delete					(collidable.model);
	if (register_schedule())
		shedule_unregister		();

	spatial_unregister			();
//	setDestroy					(true);
	// remove visual
	cNameVisual_set				( 0 );
}
Пример #5
0
//----------------------------------------------------
CPS_Instance::~CPS_Instance					()
{
	VERIFY									(!g_bRendering);
	xr_set<CPS_Instance*>::iterator it		= g_pGamePersistent->ps_active.find(this);
	VERIFY									(it!=g_pGamePersistent->ps_active.end());
	g_pGamePersistent->ps_active.erase		(it);

	xr_vector<CPS_Instance*>::iterator it2	= std::find( g_pGamePersistent->ps_destroy.begin(),
													g_pGamePersistent->ps_destroy.end(), this);

	VERIFY									(it2==g_pGamePersistent->ps_destroy.end());

	spatial_unregister						();
	shedule_unregister						();
}
Пример #6
0
void	CGlow::set_active		(bool a)				
{
	if (a)
	{
		if (flags.bActive)					return;
		flags.bActive						= true;
		spatial_register					();
	}
	else
	{
		if (!flags.bActive)					return;
		flags.bActive						= false;
		spatial_unregister					();
	}
}
Пример #7
0
CObject* CObject::H_SetParent	(CObject* new_parent, bool just_before_destroy)
{
	if (new_parent==Parent)	return new_parent;

	CObject* old_parent	= Parent; 
	
	VERIFY2((new_parent==0)||(old_parent==0),"Before set parent - execute H_SetParent(0)");

	// if (Parent) Parent->H_ChildRemove	(this);
	if (0==old_parent)	OnH_B_Chield		();	// before attach
	else				OnH_B_Independent	(just_before_destroy); // before detach
	if (new_parent)		spatial_unregister	();
	else				spatial_register	();
	Parent				= new_parent;
	if (0==old_parent)	OnH_A_Chield		();	// after attach
	else				OnH_A_Independent	(); // after detach
	// if (Parent)	Parent->H_ChildAdd		(this);
	MakeMeCrow			();
	return				old_parent;
}
Пример #8
0
ISpatial::~ISpatial			(void)
{
	spatial_unregister		();
}