コード例 #1
0
ファイル: EntityObject.cpp プロジェクト: joewan/pycmake
void CEntityObject::OnXForm( CEntity* pEntity )
{
	UpdateWorldTM(pEntity);

	if (!m_worldTM.IsValid())
	{
		EntityWarning("CEntityObject::OnXForm: Invalid world matrix: %s", pEntity->GetEntityTextDescription());
		return;
	}

	if (pLight)
	{
		ILightSource* pLightSource = pLight;
		// Update light positions.
		CDLight* pDLight = &pLightSource->GetLightProperties();

		pDLight->SetPosition( m_worldTM.GetTranslation());
		pDLight->SetMatrix(m_worldTM);
		pDLight->m_sName     = pEntity->GetName(); // For debugging only.
		pDLight->m_nEntityId = pEntity->GetId();
		pEntity->UpdateLightClipBounds(*pDLight);
		pLightSource->SetMatrix(m_worldTM);
		pLight->SetSrcEntity(pEntity);
	}
	else if (pChildRenderNode)
	{
		pChildRenderNode->SetMatrix( m_worldTM );
	}
}
コード例 #2
0
ファイル: ItemEffect.cpp プロジェクト: AiYong/CryGame
//------------------------------------------------------------------------
void CItem::SetLightRadius(float radius, uint32 id)
{
	TEffectInfoMap::const_iterator it = m_effects.find(id);
	if (it == m_effects.end()) 
		return;

	const SEffectInfo &info = it->second;
	SEntitySlotInfo slotInfo;
	ILightSource* pLightSource = 0;

	if (info.slot != -1)
	{
		if (GetEntity()->GetSlotInfo(info.slot, slotInfo) && slotInfo.pLight)
			pLightSource = static_cast<ILightSource*>(slotInfo.pLight);
	}
	else if (info.characterSlot != -1)
	{
		if (GetEntity()->GetSlotInfo(info.characterSlot, slotInfo) && slotInfo.pCharacter)
		{ 
			IAttachmentManager *pAttachmentManager = slotInfo.pCharacter->GetIAttachmentManager();
			IAttachment *pAttachment = pAttachmentManager->GetInterfaceByName(info.helper.c_str());
			if (pAttachment)
			{
				CLightAttachment *pLightAttachment = static_cast<CLightAttachment *>(pAttachment->GetIAttachmentObject());
				if (pLightAttachment)
					pLightSource = pLightAttachment->GetLightSource();
			}
		}
	}

	if (pLightSource)
	{
		CDLight& light = pLightSource->GetLightProperties();
		light.m_fRadius = radius;
		pLightSource->SetLightProperties(light);
	}
}