本文整理汇总了C++中TransformComponent::GetTransformation方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformComponent::GetTransformation方法的具体用法?C++ TransformComponent::GetTransformation怎么用?C++ TransformComponent::GetTransformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformComponent
的用法示例。
在下文中一共展示了TransformComponent::GetTransformation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitializeTransformComponent
bool InitializeTransformComponent(IActorComponent* cmp, ICMStream* stream)
{
TransformComponent* transformation = (TransformComponent*)cmp;
tinyxml2::XMLElement* pData = (tinyxml2::XMLElement*)stream;
tinyxml2::XMLElement* trans = pData->FirstChildElement("Position");
if(trans)
{
float x, y, z;
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != trans->QueryFloatAttribute("x", &x));
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != trans->QueryFloatAttribute("y", &y));
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != trans->QueryFloatAttribute("z", &z));
transformation->GetTransformation()->Translate(x, y, z);
}
tinyxml2::XMLElement* rot = pData->FirstChildElement("Rotation");
if(rot)
{
float x, y, z, w;
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("x", &x));
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("y", &y));
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("z", &z));
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("w", &w));
transformation->GetTransformation()->SetRotateQuat(x, y, z, w);
}
rot = pData->FirstChildElement("AxisAngle");
if(rot)
{
float x, y, z, w;
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("x", &x));
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("y", &y));
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("z", &z));
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != rot->QueryFloatAttribute("w", &w));
transformation->GetTransformation()->SetRotation(util::Vec3(x, y, z), w);
}
tinyxml2::XMLElement* scale = pData->FirstChildElement("Scale");
if(scale)
{
float x, y, z;
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != scale->QueryFloatAttribute("x", &x));
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != scale->QueryFloatAttribute("y", &y));
RETURN_IF_FAILED(tinyxml2::XML_NO_ATTRIBUTE != scale->QueryFloatAttribute("z", &z));
transformation->GetTransformation()->SetScale(x, y, z);
}
return true;
}
示例2: CmGetApp
CascadedShadowMapper::CascadedShadowMapper(UCHAR cascades)
: m_cascades(cascades), m_ppTargets(NULL), /*m_camera(1024, 1024, 0.01, 1000),*/ m_pCascadesSettings(NULL), m_ppBlurChain(NULL)
{
/*
#ifdef CSM_DEBUG
for(USHORT i = 0; i < m_cascades; ++i)
{
m_cascadeCameraActor[i] = chimera::g_pApp->GetLogic()->VCreateActor("staticcamera.xml");
std::stringstream ss;
ss << "cascadeCam";
ss << i;
m_cascadeCameraActor[i]->SetName(ss.str());
}
#endif
*/
m_intensity = util::Vec3(1,1,1);
m_ambient = util::Vec3(0.1f, 0.1f, 0.1f);
std::unique_ptr<ActorDescription> desc = CmGetApp()->VGetLogic()->VGetActorFactory()->VCreateActorDescription();
CameraComponent* cc = desc->AddComponent<CameraComponent>(CM_CMP_CAMERA);
cc->SetCamera(std::shared_ptr<ICamera>(new util::FPSCamera(1,1,1e-2f,1e3)));
TransformComponent* tc = desc->AddComponent<TransformComponent>(CM_CMP_TRANSFORM);
m_lightActorCamera = CmGetApp()->VGetLogic()->VCreateActor(std::move(desc));
//util::Vec3 lightPos(1.0f,1.3f,0.6f);
util::Vec3 lightPos(1.0f, 0.2, 0);
lightPos.Normalize();
lightPos.Scale(util::Vec3(1000.0f, 1000.0f, 1000.0f));
tc->GetTransformation()->SetTranslation(lightPos.x, lightPos.y, lightPos.z);
cc->GetCamera()->MoveToPosition(tc->GetTransformation()->GetTranslation());
m_lightActorCamera->SetName("cascadeLightCamera");
/*
m_viewActor = chimera::g_pApp->GetLogic()->VCreateActor("rendercamera.xml");
m_viewActor->SetName("cascadeViewCamera");
m_viewActor->GetComponent<chimera::TransformComponent>(chimera::TransformComponent::COMPONENT_ID).lock()->GetTransformation()->SetTranslate(0,5,-5);
m_viewActor->GetComponent<chimera::CameraComponent>(chimera::CameraComponent::COMPONENT_ID).lock()->GetCamera()->MoveToPosition(
m_viewActor->GetComponent<chimera::TransformComponent>(chimera::TransformComponent::COMPONENT_ID).lock()->GetTransformation()->GetTranslation());
*/
ADD_EVENT_LISTENER(this, &CascadedShadowMapper::SetSunPositionDelegate, CM_EVENT_SET_SUN_POSITION);
ADD_EVENT_LISTENER(this, &CascadedShadowMapper::SetSunIntensityDelegate, CM_EVENT_SET_SUN_INTENSITY);
ADD_EVENT_LISTENER(this, &CascadedShadowMapper::SetSunAmbientDelegate, CM_EVENT_SET_SUN_AMBIENT);
}