这篇教程C++ GetAspectRatio函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetAspectRatio函数的典型用法代码示例。如果您正苦于以下问题:C++ GetAspectRatio函数的具体用法?C++ GetAspectRatio怎么用?C++ GetAspectRatio使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetAspectRatio函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: glClearColorvoid VimridViewer::Render(){ this->GlutApplication::Render(); // Use dark gray which is good for stereo. glClearColor(0.2, 0.2, 0.2, 1.0); if (IsStereoEnabled()) { RenderStereoBuffer(GL_BACK_LEFT); RenderStereoBuffer(GL_BACK_RIGHT); } else { glDrawBuffer(GL_BACK); glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Set a normal frustum for non-stereo viewers. glFrustum( -1.0, 1.0, -GetAspectRatio(), GetAspectRatio(), GetFrustumNearClip(), GetFrustumFarClip()); RenderDelegate(); } FinishRender();}
开发者ID:nbolton,项目名称:vimrid,代码行数:32,
示例2: Window3GeometryShadersWindow::GeometryShadersWindow(Parameters& parameters) : Window3(parameters){ if (!SetEnvironment() || !CreateScene()) { parameters.created = false; return; } mEngine->SetClearColor({ 1.0f, 1.0f, 1.0f, 1.0f }); InitializeCamera(); mCamera->SetFrustum(60.0f, GetAspectRatio(), 0.1f, 100.0f); Vector4<float> camPosition{ 2.8f, 0.0f, 0.0f, 1.0f }; Vector4<float> camDVector{ -1.0f, 0.0f, 0.0f, 0.0f }; Vector4<float> camUVector{ 0.0f, 0.0f, 1.0f, 0.0f }; Vector4<float> camRVector = Cross(camDVector, camUVector); mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector);#if defined(SAVE_RENDERING_TO_DISK) mTarget = std::make_shared<DrawTarget>(1, DF_R8G8B8A8_UNORM, mXSize, mYSize); mTarget->GetRTTexture(0)->SetCopyType(Resource::COPY_STAGING_TO_CPU);#endif}
开发者ID:yimogod,项目名称:gt_learn,代码行数:26,
示例3: CreateScene//----------------------------------------------------------------------------bool GelatinCube::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } CreateScene(); // Center-and-fit for camera viewing. mScene->Update(); mTrnNode->LocalTransform.SetTranslate(-mScene->WorldBound.GetCenter()); mCamera->SetFrustum(60.0f, GetAspectRatio(), 0.1f, 100.0f); AVector camDVector(0.0f, 1.0f, 0.0f); AVector camUVector(0.0f, 0.0f, 1.0f); AVector camRVector = camDVector.Cross(camUVector); APoint camPosition = APoint::ORIGIN - 2.0f*mScene->WorldBound.GetRadius()*camDVector; mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); // Initial update of objects. mScene->Update(); // Initial culling of scene. mCuller.SetCamera(mCamera); mCuller.ComputeVisibleSet(mScene); // Sort the box faces based on current camera parameters. mBox->SortFaces(mCamera->GetDVector()); InitializeCameraMotion(0.01f, 0.001f); InitializeObjectMotion(mScene); return true;}
开发者ID:vijaynerella,项目名称:GeometricTools,代码行数:35,
示例4: XMMatrixPerspectiveFovLHvoid WavesApp::OnResize(){ D3DApp::OnResize(); // The window resized, so update the aspect ratio and recompute the projection matrix. XMMATRIX P = XMMatrixPerspectiveFovLH(0.25f*MathHelper::PI/* 90度视角 */, GetAspectRatio(), 1.0f, 1000.0f); XMStoreFloat4x4(&m_projMaxtrix, P);}
开发者ID:wjingzhe,项目名称:DX11,代码行数:7,
示例5: GetAspectRatio//----------------------------------------------------------------------------bool Terrains::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } // Set up the camera. Position the camera in the middle of page[0][0]. // Orient it to look diagonally across the terrain pages. mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 1500.0f); APoint camPosition(64.0f, 64.0f, mHeightAboveTerrain); AVector camDVector(Mathf::INV_SQRT_2, Mathf::INV_SQRT_2, 0.0f); AVector camUVector(0.0f, 0.0f, 1.0f); AVector camRVector = camDVector.Cross(camUVector); mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); CreateScene(); // Initial update of objects. mScene->Update(); // Initial culling of scene. mCuller.SetCamera(mCamera); mCuller.ComputeVisibleSet(mScene); InitializeCameraMotion(1.0f, 0.01f); MoveForward(); return true;}
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:30,
示例6: GetAspectRatio//----------------------------------------------------------------------------bool NonuniformScale::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } // Set up the camera. mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 100.0f); float cs = 0.866025f, sn = 0.5f; APoint camPosition(0.0f, -4.0f, 2.0f); AVector camDVector(0.0f, cs, -sn); AVector camUVector(0.0f, sn, cs); AVector camRVector = camDVector.Cross(camUVector); mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); CreateScene(); // Initial update of objects. mScene->Update(); // Initial culling of scene. mCuller.SetCamera(mCamera); mCuller.ComputeVisibleSet(mScene); InitializeCameraMotion(0.01f, 0.001f); InitializeObjectMotion(mScene); return true;}
开发者ID:rasslingcats,项目名称:calico,代码行数:30,
示例7: GetAspectRatiovoid TopicApp::OnResize(){ DXApp::OnResize(); // The window resized, so update the aspect ratio and recompute the projection matrix. m_cam.setLens(0.25f*MathHelper::Pi, GetAspectRatio(), 1.0f, 1000.0f);}
开发者ID:madmaurice,项目名称:sandbox,代码行数:7,
示例8: GetAspectRatio//----------------------------------------------------------------------------bool ReflectionsAndShadows::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } // Set up the camera. mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 1000.0f); APoint camPosition(180.0f, 0.0f, 23.0f); AVector camDVector(-1.0f, 0.0f, 0.0f); AVector camUVector(0.0f, 0.0f, 1.0f); AVector camRVector = camDVector.Cross(camUVector); mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); CreateScene (); // Initial update of objects. mScene->Update(); mBiped->Update(mUpdateTime); // Initial culling of scene, mSceneCuller.SetCamera(mCamera); mSceneCuller.ComputeVisibleSet(mScene); mBipedCuller.SetCamera(mCamera); mBipedCuller.ComputeVisibleSet(mBiped); InitializeCameraMotion(0.1f, 0.01f); InitializeObjectMotion(mScene); return true;}
开发者ID:rasslingcats,项目名称:calico,代码行数:32,
示例9: CreateScene//----------------------------------------------------------------------------bool BlendedAnimations::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } CreateScene(); // Center-and-fit for camera viewing. mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 1000.0f); APoint camPosition(-60.0f, -60.0f, 90.0f); AVector camDVector(1.0f, 1.0f, -1.0f); camDVector.Normalize(); AVector camUVector(0.5f, 0.5f, 1.0f); camUVector.Normalize(); AVector camRVector = camDVector.Cross(camUVector); mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); // Initial update of objects. mScene->Update(mAnimTime); InitializeCameraMotion(0.01f, 0.01f); InitializeObjectMotion(mScene); return true;}
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:27,
示例10: CreateScene//----------------------------------------------------------------------------bool SphereMaps::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } CreateScene(); // Center-and-fit for camera viewing. mScene->Update(); mTrnNode->LocalTransform.SetTranslate(-mScene->WorldBound.GetCenter()); mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 1000.0f); AVector camDVector(0.0f, 1.0f, 0.0f); AVector camUVector(0.0f, 0.0f, 1.0f); AVector camRVector = camDVector.Cross(camUVector); APoint camPosition = APoint::ORIGIN - 3.0f*mScene->WorldBound.GetRadius()*camDVector; mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); // Initial update of objects. mScene->Update(); CopyNormalToTCoord1(mScene); // Initial culling of scene. mCuller.SetCamera(mCamera); mCuller.ComputeVisibleSet(mScene); InitializeCameraMotion(0.001f, 0.001f); InitializeObjectMotion(mScene); return true;}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:33,
示例11: CreateScene//----------------------------------------------------------------------------bool FreeFormDeformation::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } // Set up the scene graph. CreateScene(); // Center-and-fit mesh for viewing by camera mMesh->Update(); mTrnNode->LocalTransform.SetTranslate(-mScene->WorldBound.GetCenter()); mCamera->SetFrustum(60.0f, GetAspectRatio(), 0.1f, 100.0f); AVector camDVector(0.0f, 0.0f, 1.0f); AVector camUVector(0.0f, 1.0f, 0.0f); AVector camRVector = camDVector.Cross(camUVector); APoint camPosition = APoint::ORIGIN - 2.5f*mScene->WorldBound.GetRadius()*camDVector; mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); // Initial update of objects. mScene->Update(); // Initial culling of scene. mCuller.SetCamera(mCamera); mCuller.ComputeVisibleSet(mScene); InitializeCameraMotion(0.01f, 0.02f); InitializeObjectMotion(mScene); return true;}
开发者ID:vijaynerella,项目名称:GeometricTools,代码行数:33,
示例12: CreateScene//----------------------------------------------------------------------------bool WaterDropFormation::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } CreateScene(); // Center-and-fit for camera viewing. mScene->Update(); mTrnNode->LocalTransform.SetTranslate(-mScene->WorldBound.GetCenter()); mCamera->SetFrustum(60.0f, GetAspectRatio(), 0.1f, 1000.0f); float angle = 0.01f*Mathf::PI; float cs = Mathf::Cos(angle), sn = Mathf::Sin(angle); AVector camDVector(-cs, 0.0f, -sn); AVector camUVector(sn, 0.0f, -cs); AVector camRVector = camDVector.Cross(camUVector); APoint camPosition = APoint::ORIGIN - 0.9f*mScene->WorldBound.GetRadius()*camDVector; mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); // Initial update of objects. mScene->Update(); // Initial culling of scene. mCuller.SetCamera(mCamera); mCuller.ComputeVisibleSet(mScene); InitializeCameraMotion(0.01f, 0.001f); InitializeObjectMotion(mScene); mLastSeconds = (float)GetTimeInSeconds(); return true;}
开发者ID:dodong471520,项目名称:WildMagic,代码行数:36,
示例13: GetAspectRatio//----------------------------------------------------------------------------bool BouncingSpheres::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } // Set up the camera. mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 1000.0f); float angle = 0.02f*Mathf::PI; float cs = Mathf::Cos(angle), sn = Mathf::Sin(angle); APoint camPosition(27.5f, 8.0f, 8.9f); AVector camDVector(-cs, 0.0f, -sn); AVector camUVector(-sn, 0.0f, cs); AVector camRVector = camDVector.Cross(camUVector); mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); CreateScene(); // Initial update of objects. mScene->Update(); // Initialize balls with correct transformations. PhysicsTick(); // Initial culling of scene. mCuller.SetCamera(mCamera); mCuller.ComputeVisibleSet(mScene); return true;}
开发者ID:rasslingcats,项目名称:calico,代码行数:31,
示例14: GetAspectRatio//----------------------------------------------------------------------------bool RoughPlaneSolidBox::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } // Set up the camera. mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 100.0f); float angle = 0.1f*Mathf::PI; float cs = Mathf::Cos(angle), sn = Mathf::Sin(angle); APoint camPosition(17.695415f, 0.0f, 6.4494629f); AVector camDVector(-cs, 0.0f, -sn); AVector camUVector(-sn, 0.0f, cs); AVector camRVector = camDVector.Cross(camUVector); mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); InitializeModule(); CreateScene(); // Initial update of objects. mScene->Update(); // Initial culling of scene. mCuller.SetCamera(mCamera); mCuller.ComputeVisibleSet(mScene); InitializeCameraMotion(0.001f, 0.001f); InitializeObjectMotion(mScene); return true;}
开发者ID:2asoft,项目名称:GeometricTools,代码行数:32,
示例15: pos bool Camera::ObjectFrustumCulling( const RenderObject& obj ) { const AABB& aabb = obj.m_worldAABB; //物体坐标转换到相机空间进行裁减 VEC4 pos(aabb.GetCenter(), 1.0f); Common::Transform_Vec4_By_Mat44(pos, pos, GetViewMatrix()); float n = GetNearClip(); float f = GetFarClip(); float fov = GetFov(); float half_w = n * std::tan(fov/2); float half_h = half_w / GetAspectRatio(); //检测前后面 if(-pos.z+aabb.m_boundingRadius <= n || -pos.z-aabb.m_boundingRadius >= f) return true; //检测左右面 float planeX = half_w * pos.z / -n; if(pos.x - planeX >= aabb.m_boundingRadius || pos.x + aabb.m_boundingRadius <= -planeX) return true; //检测上下面 float planeY = half_h * pos.z / -n; if(pos.y - planeY >= aabb.m_boundingRadius || pos.y + aabb.m_boundingRadius <= -planeY) return true; return false; }
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:32,
示例16: GetClearColorvoid Camera::FillXMLInfo(XMLNode *xmlInfo) const{ Component::FillXMLInfo(xmlInfo); xmlInfo->SetTagName("Camera"); xmlInfo->SetColor("ClearColor", GetClearColor()); xmlInfo->SetFloat("ZNear", GetZNear()); xmlInfo->SetFloat("ZFar", GetZFar()); xmlInfo->SetEnum("ProjectionMode", ProjectionMode_GetNamesVector(), ProjectionMode_GetIndexFromValue(m_projMode), {XMLProperty::Readonly}); xmlInfo->SetFloat("AspectRatio", GetAspectRatio()); if (GetProjectionMode() == ProjectionMode::Orthographic) { xmlInfo->SetFloat("OrthoHeight", GetOrthoHeight()); xmlInfo->SetFloat("FOVDegrees", GetFovDegrees(), {XMLProperty::Hidden}); } else { xmlInfo->SetFloat("OrthoHeight", GetOrthoHeight(), {XMLProperty::Hidden}); xmlInfo->SetFloat("FOVDegrees", GetFovDegrees()); }}
开发者ID:sephirot47,项目名称:Bang,代码行数:25,
示例17: GetAspectRatio//----------------------------------------------------------------------------bool IntersectConvexPolyhedra::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } // Set up the camera. mCamera->SetFrustum(60.0f, GetAspectRatio(), 0.1f, 1000.0f); APoint camPosition(16.0f, 0.0f, 0.0f); AVector camDVector(-1.0f, 0.0f, 0.0f); AVector camUVector(0.0f, 0.0f, 1.0f); AVector camRVector = camDVector.Cross(camUVector); mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); CreateScene(); // Initial update of objects. mScene->Update(); // Initial culling of scene. mCuller.SetCamera(mCamera); mCuller.ComputeVisibleSet(mScene); InitializeCameraMotion(0.01f, 0.001f); InitializeObjectMotion(mScene); return true;}
开发者ID:rasslingcats,项目名称:calico,代码行数:29,
示例18: CreateScene//----------------------------------------------------------------------------bool ScreenPolygons::OnInitialize (){ if (!WindowApplication3::OnInitialize()) { return false; } CreateScene(); // Set up the camera. mCamera->SetFrustum(60.0f, GetAspectRatio(), 1.0f, 1000.0f); APoint camPosition(80.0f, 0.0f, 23.0f); AVector camDVector(-1.0f, 0.0f, 0.0f); AVector camUVector(0.0f, 0.0f, 1.0f); AVector camRVector = camDVector.Cross(camUVector); mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); // Initial update of objects. mScene->Update(); mCuller.SetCamera(mCamera); mCuller.ComputeVisibleSet(mScene); InitializeCameraMotion(0.01f, 0.01f); InitializeObjectMotion(mScene); return true;}
开发者ID:bhlzlx,项目名称:WildMagic,代码行数:27,
示例19: GetAspectRatiovoid Application::OnResize(){ DirectXApp::OnResize(); //DirectX::XMMATRIX P = DirectX::XMMatrixOrthographicLH(m_ScreenWidth, m_ScreenHeight, 1.0f, 1000.0f); DirectX::XMMATRIX P = DirectX::XMMatrixPerspectiveFovLH( 0.25f * DirectX::XM_PI, GetAspectRatio(), 1.0f, 10000.0f); XMStoreFloat4x4(&m_Proj, P);}
开发者ID:Shadow864,项目名称:DirectX11,代码行数:9,
示例20: CalcNormalDisplayRectvoid CComboRenderer::ManageDisplay(){ const RECT& rv = g_graphicsContext.GetViewWindow(); float fScreenWidth = (float)rv.right - rv.left; float fScreenHeight = (float)rv.bottom - rv.top; float fOffsetX1 = (float)rv.left; float fOffsetY1 = (float)rv.top; float fPixelRatio = CDisplaySettings::Get().GetPixelRatio(); float fMaxScreenWidth = (float)CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution()).iWidth; float fMaxScreenHeight = (float)CDisplaySettings::Get().GetResolutionInfo(g_graphicsContext.GetVideoResolution()).iHeight; if (fOffsetX1 < 0) fOffsetX1 = 0; if (fOffsetY1 < 0) fOffsetY1 = 0; if (fScreenWidth + fOffsetX1 > fMaxScreenWidth) fScreenWidth = fMaxScreenWidth - fOffsetX1; if (fScreenHeight + fOffsetY1 > fMaxScreenHeight) fScreenHeight = fMaxScreenHeight - fOffsetY1; // Correct for HDTV_1080i -> 540p if (GetResolution() == HDTV_1080i) { fOffsetY1 /= 2; fScreenHeight /= 2; fPixelRatio *= 2; } // source rect rs.left = CMediaSettings::Get().GetCurrentVideoSettings().m_CropLeft; rs.top = CMediaSettings::Get().GetCurrentVideoSettings().m_CropTop; rs.right = m_iSourceWidth - CMediaSettings::Get().GetCurrentVideoSettings().m_CropRight; rs.bottom = m_iSourceHeight - CMediaSettings::Get().GetCurrentVideoSettings().m_CropBottom; CalcNormalDisplayRect(fOffsetX1, fOffsetY1, fScreenWidth, fScreenHeight, GetAspectRatio() * fPixelRatio, CDisplaySettings::Get().GetZoomAmount()); // check whether we need to alter our source rect if (rd.left < fOffsetX1 || rd.right > fOffsetX1 + fScreenWidth) { // wants to be wider than we allow, so fix float fRequiredWidth = (float)rd.right - rd.left; if (rs.right <= rs.left) rs.right = rs.left+1; float fHorizScale = fRequiredWidth / (float)(rs.right - rs.left); float fNewWidth = fScreenWidth / fHorizScale; rs.left = (rs.right - rs.left - (int)fNewWidth) / 2; rs.right = rs.left + (int)fNewWidth; rd.left = (int)fOffsetX1; rd.right = (int)(fOffsetX1 + fScreenWidth); } if (rd.top < fOffsetY1 || rd.bottom > fOffsetY1 + fScreenHeight) { // wants to be wider than we allow, so fix float fRequiredHeight = (float)rd.bottom - rd.top; if (rs.bottom <= rs.top) rs.bottom = rs.top+1; float fVertScale = fRequiredHeight / (float)(rs.bottom - rs.top); float fNewHeight = fScreenHeight / fVertScale; rs.top = (rs.bottom - rs.top - (int)fNewHeight) / 2; rs.bottom = rs.top + (int)fNewHeight; rd.top = (int)fOffsetY1; rd.bottom = (int)(fOffsetY1 + fScreenHeight); }}
开发者ID:DJMatty,项目名称:xbmc,代码行数:57,
示例21: GetAspectRatio//----------------------------------------------------------------------------void PerformanceAMDWindow::CreateCamera(){ mCamera.SetFrustum(60.0f, GetAspectRatio(), 0.01f, 100.0f); Vector4<float> camPosition(0.0f, 0.0f, 4.0f, 1.0f); Vector4<float> camDVector(0.0f, 0.0f, -1.0f, 0.0f); Vector4<float> camUVector(0.0f, 1.0f, 0.0f, 0.0f); Vector4<float> camRVector = Cross(camDVector, camUVector); mCamera.SetFrame(camPosition, camDVector, camUVector, camRVector); EnableCameraMotion(0.005f, 0.002f, 2.0f, 2.0f);}
开发者ID:rin-23,项目名称:OculusProjects,代码行数:11,
示例22: GetAspectRatiovoid FCameraDetails::UpdateAspectTextFromProperty(){ // Called whenever the actual aspect ratio property changes - clears the text box if the value no longer matches the current text TOptional<float> Value = GetAspectRatio(); if (!Value.IsSet() || Value.GetValue() < LastParsedAspectRatioValue - DELTA || Value.GetValue() > LastParsedAspectRatioValue + DELTA) { LastParsedAspectRatioValue = -1.0f; if (!AspectTextBox->GetText().IsEmpty()) { AspectTextBox->SetText(FText::GetEmpty()); } }}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:13,
示例23: CloneIntovoid Camera::CloneInto(ICloneable *clone) const{ Component::CloneInto(clone); Camera *cam = static_cast<Camera*>(clone); cam->SetZFar(GetZFar()); cam->SetZNear(GetZNear()); cam->SetClearColor(GetClearColor()); cam->SetFovDegrees(GetFovDegrees()); cam->SetOrthoHeight(GetOrthoHeight()); cam->SetAspectRatio(GetAspectRatio()); cam->SetProjectionMode(GetProjectionMode()); cam->SetAutoUpdateAspectRatio(GetAutoUpdateAspectRatio());}
开发者ID:sephirot47,项目名称:Bang,代码行数:13,
示例24: GetNearClip void Camera::_BuildProjMatrix() { /* 这是第一个版本的透视投影矩阵,即"蛮干"求解法. 它的缺陷在于为了变换出xy坐标都在[-1, 1]的CVV空间, 必须满足以下条件: 1.视距d=1. 2.fov=90度. 3.视口AspectRatio=1. 否则变换不出CVV. MatProj = ( 1, 0, 0, 0 0, 1, 0, 0 0, 0, 1, 0 0, 0, 1/d, 0 ) 投影变换加齐次除法后: x' = x * d / z, y' = y * d / z */ //普适版投影矩阵.推导见: http://blog.csdn.net/popy007/article/details/1797121 float r,l,t,b; r = m_nearClip*tanf(m_fov/2); l = -r; t = r/m_aspectRatio; b= -t; m_matProj.m00 = 2*m_nearClip/(r-l); m_matProj.m01 = 0; m_matProj.m02 = (r+l)/(r-l); m_matProj.m03 = 0; m_matProj.m10 = 0; m_matProj.m11 = 2*m_nearClip/(t-b); m_matProj.m12 = (t+b)/(t-b); m_matProj.m13 = 0; m_matProj.m20 = 0; m_matProj.m21 = 0; m_matProj.m22 = -(m_farClip+m_nearClip)/(m_farClip-m_nearClip); m_matProj.m23 = -2*m_farClip*m_nearClip/(m_farClip-m_nearClip); m_matProj.m30 = 0; m_matProj.m31 = 0; m_matProj.m32 = -1; m_matProj.m33 = 0; m_matInvProj = m_matProj.Inverse(); m_imagePlane_r = GetNearClip() * tanf(GetFov() / 2); m_imagePlane_t = m_imagePlane_r / GetAspectRatio(); }
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:50,
示例25: CalcNormalDisplayRectvoid CLinuxRenderer::ManageDisplay(){ const RECT& rv = g_graphicsContext.GetViewWindow(); float fScreenWidth = (float)rv.right - rv.left; float fScreenHeight = (float)rv.bottom - rv.top; float fOffsetX1 = (float)rv.left; float fOffsetY1 = (float)rv.top; // source rect rs.left = g_stSettings.m_currentVideoSettings.m_CropLeft; rs.top = g_stSettings.m_currentVideoSettings.m_CropTop; rs.right = m_iSourceWidth - g_stSettings.m_currentVideoSettings.m_CropRight; rs.bottom = m_iSourceHeight - g_stSettings.m_currentVideoSettings.m_CropBottom; CalcNormalDisplayRect(fOffsetX1, fOffsetY1, fScreenWidth, fScreenHeight, GetAspectRatio() * g_stSettings.m_fPixelRatio, g_stSettings.m_fZoomAmount);}
开发者ID:derobert,项目名称:debianlink-xbmc,代码行数:16,
示例26: GetAspectRatiovoid GeometryShadersWindow::InitializeCamera(){ mCamera->SetFrustum(60.0f, GetAspectRatio(), 0.1f, 100.0f); Vector4<float> camPosition{ 2.8f, 0.0f, 0.0f, 1.0f }; Vector4<float> camDVector{ -1.0f, 0.0f, 0.0f, 0.0f }; Vector4<float> camUVector{ 0.0f, 0.0f, 1.0f, 0.0f }; Vector4<float> camRVector = Cross(camDVector, camUVector); mCamera->SetFrame(camPosition, camDVector, camUVector, camRVector); mTranslationSpeed = 0.01f; mRotationSpeed = 0.001f; mTranslationSpeedFactor = 2.0f; mRotationSpeedFactor = 2.0f; mCameraRig.SetTranslationSpeed(mTranslationSpeed); mCameraRig.SetRotationSpeed(mRotationSpeed); mCameraRig.ComputeWorldAxes();}
开发者ID:yimogod,项目名称:gt_learn,代码行数:17,
注:本文中的GetAspectRatio函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetAt函数代码示例 C++ GetArgs函数代码示例 |