本文整理汇总了C++中Matrixf::OrthoInverse方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrixf::OrthoInverse方法的具体用法?C++ Matrixf::OrthoInverse怎么用?C++ Matrixf::OrthoInverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrixf
的用法示例。
在下文中一共展示了Matrixf::OrthoInverse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
void Render(float dt)
{
static unsigned int frameIndex = 0;
frameIndex++;
ovrFrameTiming timing = ovrHmd_BeginFrame(s_hmd, 0);
// ovrSensorState ss = ovrHmd_GetSensorState(s_hmd, timing.ScanoutMidpointSeconds);
// TODO: Use this for head tracking...
// TODO: Use player height from SDK
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
// render into fbo
glBindFramebuffer(GL_FRAMEBUFFER, s_fbo);
// TODO: enable this when we have more complex rendering.
glEnable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
static float t = 0.0;
t += dt;
// clear render target
glViewport(0, 0, s_renderTargetSize.w, s_renderTargetSize.h);
glClearColor(s_clearColor.x, s_clearColor.y, s_clearColor.z, s_clearColor.w);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
for (int i = 0; i < 2; i++)
{
ovrEyeType eye = s_hmdDesc.EyeRenderOrder[i];
ovrPosef pose = ovrHmd_BeginEyeRender(s_hmd, eye);
glViewport(s_eyeTexture[eye].Header.RenderViewport.Pos.x,
s_eyeTexture[eye].Header.RenderViewport.Pos.y,
s_eyeTexture[eye].Header.RenderViewport.Size.w,
s_eyeTexture[eye].Header.RenderViewport.Size.h);
Quatf q(pose.Orientation.x, pose.Orientation.y, pose.Orientation.z, pose.Orientation.w);
Vector3f p(pose.Position.x, pose.Position.y, pose.Position.z);
Matrixf cameraMatrix = Matrixf::QuatTrans(q, s_cameraPos);
Matrixf viewCenter = cameraMatrix.OrthoInverse();
// let ovr compute projection matrix, cause it's hard.
ovrMatrix4f ovrProj = ovrMatrix4f_Projection(s_eyeRenderDesc[eye].Fov, 0.1f, 10000.0f, true);
// convert to abaci matrix
Matrixf projMatrix = Matrixf::Rows(Vector4f(ovrProj.M[0][0], ovrProj.M[0][1], ovrProj.M[0][2], ovrProj.M[0][3]),
Vector4f(ovrProj.M[1][0], ovrProj.M[1][1], ovrProj.M[1][2], ovrProj.M[1][3]),
Vector4f(ovrProj.M[2][0], ovrProj.M[2][1], ovrProj.M[2][2], ovrProj.M[2][3]),
Vector4f(ovrProj.M[3][0], ovrProj.M[3][1], ovrProj.M[3][2], ovrProj.M[3][3]));
// use EyeRenderDesc.ViewAdjust to do eye offset.
Matrixf viewMatrix = viewCenter * Matrixf::Trans(Vector3f(s_eyeRenderDesc[eye].ViewAdjust.x,
s_eyeRenderDesc[eye].ViewAdjust.y,
s_eyeRenderDesc[eye].ViewAdjust.z));
// compute model matrix for terminal
const float kTermScale = 0.001f;
const Vector3f termOrigin(-2 * kFeetToMeters, 6.75f * kFeetToMeters, -2.5 * kFeetToMeters);
Matrixf modelMatrix = Matrixf::ScaleQuatTrans(Vector3f(kTermScale, -kTermScale, kTermScale),
Quatf::AxisAngle(Vector3f(0, 1, 0), 0),
termOrigin);
RenderBegin();
RenderFloor(projMatrix, viewMatrix, 0.0f);
RenderTextBegin(projMatrix, viewMatrix, modelMatrix);
for (int j = 0; j < win_get_text_count(); j++)
{
gb::Text* text = (gb::Text*)win_get_text(j);
if (text)
{
RenderText(text->GetQuadVec());
}
}
RenderTextEnd();
RenderEnd();
ovrHmd_EndEyeRender(s_hmd, eye, pose, &s_eyeTexture[eye]);
}
ovrHmd_EndFrame(s_hmd);
}