Exemplo n.º 1
0
//-------------------------------------------------------------------------------------------------------
void LightNode::Update( uint milisecon )
{
    if( isChange() || isFatherChange() || m_isLightChange )
    {
        if ( isChange() || isFatherChange() )
        {
            LocatableObject::Update( milisecon );
            vector3f ws = GetWorldScale();
            m_MaxScale = Math::GetMin( ws.m_x, Math::GetMin( ws.m_y, ws.m_z ) );
            if ( m_eLightType != LT_POINT )
            {
                m_WorldDirection = LightDirectionRaw * GetWorldRotation();
                m_WorldUp = LightUpRaw * GetWorldRotation();
            }
            CastChangedMessage();//通知子节点
            _SetChangeFlag( false );
        }
        m_isLightChange = false;
        _OnLightChangeRecaculater();//告诉自己的继承类,灯光变了
    }
}
Exemplo n.º 2
0
	//--------------------------------------------------------------------------------------------------------------------------------------
	void Model::Update( uint milisecon )
	{
		if( m_isBone && m_KeyFrame.isPlay() )
		{
			m_PassedTime += milisecon;
			m_isInview = IntersectedType::IT_NO != Engine::Instance().GetCamera()->GetFrustum().Intersect( m_BindBox );
			if ( _isInview() && m_PassedTime >= m_RefreshLimit )
			{
				//DEBUGLOG("Model reflash limit %d / second\n", 1000 / m_RefreshLimit );
				this->_BuildBones(m_PassedTime);
				m_PassedTime = 0;//m_PassedTime - m_RefreshLimit;
				_UpDataJoint();
			}
		}
		else if ( isFatherChange()
				|| m_isFroceUpdate )//父节点改变,改变包围盒和joint
		{
			_UpDataJoint();
		}
		m_isFroceUpdate = false;
	}
Exemplo n.º 3
0
	//--------------------------------------------------------------------------------------------------------------------------------------
	void LocatableModel::Update( uint milisecon )
	{
		bool islocatablechange = isChange();
		LocatableObject::Update(milisecon);
		_SetForceUpdataJoint( islocatablechange );

		if ( _isBone() && _isInview() )
		{
			vector3f disdir = GetWorldPosition() - Engine::Instance().GetCamera()->GetPosition();
			vector3f boxdiag = ( m_BindBox.GetMax() - m_BindBox.GetMin() );
			float dispow = disdir.Dot( disdir );
			float boxsize = boxdiag.Dot( boxdiag );
			_SetRefreshLimit( Utility::CaculateRefreshLimit(dispow, boxsize) );
		}
		Model::Update( milisecon );
		if ( islocatablechange 
			|| isFatherChange() )
		{
			Matrix44f* trans = (Matrix44f*)(this->Attribute( IAttributeNode::ATT_WORLDTRANSFORM ));
			m_BindBox =  NULL == trans ? m_OgiBindBox : m_OgiBindBox * *trans;
		}
	}