本文整理汇总了C++中TransformComponent::getTransformation方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformComponent::getTransformation方法的具体用法?C++ TransformComponent::getTransformation怎么用?C++ TransformComponent::getTransformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformComponent
的用法示例。
在下文中一共展示了TransformComponent::getTransformation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendCamInformation
void CameraComponent::sendCamInformation( GeneralGlWindow * window )
{
glm::vec3 from = glm::vec3();
glm::vec3 to = glm::vec3(1,0,0);
glm::vec3 up = glm::vec3(0,1,0);
TransformComponent * trans = parent->getComponent<TransformComponent>();
if( trans != nullptr )
{
from = glm::vec3( trans->getTransformation() * glm::vec4( from, 1 ) );
to = glm::vec3( trans->getTransformation() * glm::vec4( to, 1 ) );
up = glm::vec3( trans->getRotationMatrix() * glm::vec4( up, 1 ) );
}
glm::mat4 camcam = glm::perspective(fov, aspect, camNear, camFar) * glm::lookAt( from, to, up );
window->setUniformParameter( "mvp", GeneralGlWindow::PT_MAT4, (float*)&camcam );
}
示例2: startRun
void OcculusCameraComponent::startRun( int run )
{
//OcculusStuff
ovrEyeType eye = hmd->EyeRenderOrder[run];
ovrPosef eyePose = headPoses[ eye ];
OVR::Quatf orientation = OVR::Quatf(eyePose.Orientation);
glm::quat orient = fromOVR( orientation );
glm::mat4 orientTransform = glm::mat4_cast( orient );
// * Test code *
// Assign quaternion result directly to view (translation is ignored).
Graphics * g = parent->getStage()->getGame()->getGraphicsHandle();
g->setFrameBuffer( renderTarget );
g->setViewport( EyeRenderViewport[eye].Pos.x, EyeRenderViewport[eye].Pos.y, EyeRenderViewport[eye].Size.w, EyeRenderViewport[eye].Size.h );
//OVR::Matrix4f view = OVR::Matrix4f(orientation.Inverted()) * OVR::Matrix4f::Translation(-WorldEyePosition);
//pRender->SetViewport(); pRender->SetProjection(proj);
//pRoomScene->Render(pRender, Matrix4f::Translation(EyeRenderDesc[eye].ViewAdjust) * view);
TransformComponent * trans = parent->getComponent<TransformComponent>();
glm::vec3 eyepos = 20.0f*fromOVR(eyePose.Position);
//OVR::Vector3f shiftedEyePos = OVR::Vector3f( trans->getTranslation().x, trans->getTranslation().y, trans->getTranslation().z ) + eyePose.Position;
glm::vec3 from = glm::vec3();
glm::vec3 to = glm::vec3(0,0,-1);
glm::vec3 up = glm::vec3(0,1,0);
//TransformComponent * trans = parent->getComponent<TransformComponent>();
if( trans != nullptr )
{
from = glm::vec3( trans->getTransformation() * orientTransform * glm::vec4( from, 1 ) );
to = glm::vec3( trans->getTransformation() * orientTransform * glm::vec4( to, 1 ) );
up = glm::vec3( trans->getRotationMatrix() * orientTransform * glm::vec4( up, 1 ) );
}
glm::mat4 camcam = glm::perspective(fov, aspect, camNear, camFar) * glm::lookAt( from + eyepos, to + eyepos, up );
Shader::setGlobalUniformParameter( "mvp", ParameterType::PT_MAT4, &camcam );
}
示例3: startRun
void CameraComponent::startRun( int run )
{
run;
Graphics * g = parent->getStage()->getGame()->getGraphicsHandle();
g->setViewport( 0, 0, g->getWidth(), g->getHeight() );
glm::vec3 from = glm::vec3();
glm::vec3 to = glm::vec3(0,0,-1);
glm::vec3 up = glm::vec3(0,1,0);
aspect = float( g->getWidth() )/ g->getHeight();
TransformComponent * trans = parent->getComponent<TransformComponent>();
if( trans != nullptr )
{
from = glm::vec3( trans->getTransformation() * glm::vec4( from, 1 ) );
to = glm::vec3( trans->getTransformation() * glm::vec4( to, 1 ) );
up = glm::vec3( trans->getRotationMatrix() * glm::vec4( up, 1 ) );
}
//std::cout << "<" << from.x << ", " << from.y << ", " << from.z << "> <" << to.x << ", " << to.y << ", " << to.z << "> <" << up.x << ", " << up.y << ", " << up.z << ">" << std::endl;
glm::mat4 camcam = glm::perspective(fov, aspect, camNear, camFar) * glm::lookAt( from, to, up );
Shader::setGlobalUniformParameter( "mvp", ParameterType::PT_MAT4, &camcam );
}