当前位置: 首页>>代码示例>>C++>>正文


C++ MatrixF::getRightVector方法代码示例

本文整理汇总了C++中MatrixF::getRightVector方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixF::getRightVector方法的具体用法?C++ MatrixF::getRightVector怎么用?C++ MatrixF::getRightVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MatrixF的用法示例。


在下文中一共展示了MatrixF::getRightVector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mainLoop

void EditorCamera::mainLoop()
{
   if (mRenderCamera == NULL)
      return;

   mVerticalAngle = mClampF(mVerticalAngle, -4.7f, -1.7f);
   VectorF rotation = mTransform.getRotationEuler();
   rotation.y = mVerticalAngle;
   rotation.z = mHorizontalAngle;
   mTransform.setRotation(rotation);

   VectorF up(0.0f, 0.0f, 1.0f);
   Point3F look;
   Point3F cameraForward(1.0f, 0.0f, 0.0f);

   bx::vec3MulMtx(look, cameraForward, mTransform.matrix);

   if (mForwardVelocity.len() > 0.01f)
   {
      MatrixF lookMatrix;
      bx::mtxLookAt(lookMatrix, mWorldPosition, look, up);
      mWorldPosition += (lookMatrix.getForwardVector() * mForwardVelocity.x);
      mWorldPosition -= (lookMatrix.getRightVector() * mForwardVelocity.y);
      mTransform.setPosition(mWorldPosition);
   }

   bx::vec3MulMtx(look, cameraForward, mTransform.matrix);
   bx::mtxLookAt(mRenderCamera->viewMatrix, mWorldPosition, look, up);
   mRenderCamera->position = mWorldPosition;
}
开发者ID:xubingyue,项目名称:Torque6Editor,代码行数:30,代码来源:projectManager.cpp

示例2:

void OrientedBox3F::set( const MatrixF& transform, const Point3F& extents )
{
   mCenter = transform.getPosition();

   mAxes[ RightVector ] = transform.getRightVector();
   mAxes[ ForwardVector ] = transform.getForwardVector();
   mAxes[ UpVector ] = transform.getUpVector();

   mHalfExtents = extents * 0.5f;

   _initPoints();
}
开发者ID:andr3wmac,项目名称:Torque6,代码行数:12,代码来源:mOrientedBox.cpp

示例3: _setupPerFrameParameters

void AdvancedLightBinManager::_setupPerFrameParameters( const SceneRenderState *state )
{
   PROFILE_SCOPE( AdvancedLightBinManager_SetupPerFrameParameters );
   const Frustum &frustum = state->getCameraFrustum();

   MatrixF invCam( frustum.getTransform() );
   invCam.inverse();

   const Point3F *wsFrustumPoints = frustum.getPoints();
   const Point3F& cameraPos = frustum.getPosition();

   // Perform a camera offset.  We need to manually perform this offset on the sun (or vector) light's
   // polygon, which is at the far plane.
   const Point2F& projOffset = frustum.getProjectionOffset();
   Point3F cameraOffsetPos = cameraPos;
   if(!projOffset.isZero())
   {
      // First we need to calculate the offset at the near plane.  The projOffset
      // given above can be thought of a percent as it ranges from 0..1 (or 0..-1).
      F32 nearOffset = frustum.getNearRight() * projOffset.x;

      // Now given the near plane distance from the camera we can solve the right
      // triangle and calcuate the SIN theta for the offset at the near plane.
      // SIN theta = x/y
      F32 sinTheta = nearOffset / frustum.getNearDist();

      // Finally, we can calcuate the offset at the far plane, which is where our sun (or vector)
      // light's polygon is drawn.
      F32 farOffset = frustum.getFarDist() * sinTheta;

      // We can now apply this far plane offset to the far plane itself, which then compensates
      // for the project offset.
      MatrixF camTrans = frustum.getTransform();
      VectorF offset = camTrans.getRightVector();
      offset *= farOffset;
      cameraOffsetPos += offset;
   }

   // Now build the quad for drawing full-screen vector light
   // passes.... this is a volatile VB and updates every frame.
   FarFrustumQuadVert verts[4];
   {
      verts[0].point.set( wsFrustumPoints[Frustum::FarBottomLeft] - cameraPos );
      invCam.mulP( wsFrustumPoints[Frustum::FarBottomLeft], &verts[0].normal );
      verts[0].texCoord.set( -1.0, -1.0 );
      verts[0].tangent.set(wsFrustumPoints[Frustum::FarBottomLeft] - cameraOffsetPos);

      verts[1].point.set( wsFrustumPoints[Frustum::FarTopLeft] - cameraPos );
      invCam.mulP( wsFrustumPoints[Frustum::FarTopLeft], &verts[1].normal );
      verts[1].texCoord.set( -1.0, 1.0 );
      verts[1].tangent.set(wsFrustumPoints[Frustum::FarTopLeft] - cameraOffsetPos);

      verts[2].point.set( wsFrustumPoints[Frustum::FarTopRight] - cameraPos );
      invCam.mulP( wsFrustumPoints[Frustum::FarTopRight], &verts[2].normal );
      verts[2].texCoord.set( 1.0, 1.0 );
      verts[2].tangent.set(wsFrustumPoints[Frustum::FarTopRight] - cameraOffsetPos);

      verts[3].point.set( wsFrustumPoints[Frustum::FarBottomRight] - cameraPos );
      invCam.mulP( wsFrustumPoints[Frustum::FarBottomRight], &verts[3].normal );
      verts[3].texCoord.set( 1.0, -1.0 );
      verts[3].tangent.set(wsFrustumPoints[Frustum::FarBottomRight] - cameraOffsetPos);
   }
   mFarFrustumQuadVerts.set( GFX, 4 );
   dMemcpy( mFarFrustumQuadVerts.lock(), verts, sizeof( verts ) );
   mFarFrustumQuadVerts.unlock();

   PlaneF farPlane(wsFrustumPoints[Frustum::FarBottomLeft], wsFrustumPoints[Frustum::FarTopLeft], wsFrustumPoints[Frustum::FarTopRight]);
   PlaneF vsFarPlane(verts[0].normal, verts[1].normal, verts[2].normal);

   // Parameters calculated, assign them to the materials
   LightMatTable::Iterator iter = mLightMaterials.begin();
   for ( ; iter != mLightMaterials.end(); iter++ )
   {
      if ( iter->value )
         iter->value->setViewParameters(  frustum.getNearDist(), 
                                          frustum.getFarDist(), 
                                          frustum.getPosition(), 
                                          farPlane, 
                                          vsFarPlane);
   }
}
开发者ID:1414648814,项目名称:Torque3D,代码行数:81,代码来源:advancedLightBinManager.cpp


注:本文中的MatrixF::getRightVector方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。