本文整理汇总了C++中Matrix4::GetTranslation方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4::GetTranslation方法的具体用法?C++ Matrix4::GetTranslation怎么用?C++ Matrix4::GetTranslation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4
的用法示例。
在下文中一共展示了Matrix4::GetTranslation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
///////////////////////////////////////////////////////////////////////
/// Called every frame to render
///////////////////////////////////////////////////////////////////////
void VCNRenderNode::Render() const
{
if (!mActive || !mRender)
return;
// Let the base class do its stuff
VCNNode::Render();
// Check if we are in the view frustum
if ( IsInFrustum() )
{
// Trace the object being rendered
//GPU_PROFILE_OBJECT_BLOCK( GetTag().c_str() );
// Tell the transform manager what the new current transform is
VCNXformCore::GetInstance()->SetWorldTransform( mWorld );
VCNMaterialCore* materialCore = VCNMaterialCore::GetInstance();
// Set the current material
materialCore->SelectMaterial( mMaterialID );
VCNMesh* mesh = VCNResourceCore::GetInstance()->GetResource<VCNMesh>( mMeshID );
if ( const VCND3DAnimator* anim = GetComponent<VCND3DAnimator>() )
{
mesh->SetBoneTransforms( anim->GetTransformPtr() );
}
VCNNode* parent = VCNNodeCore::GetInstance()->GetNode(GetParent());
VCNMaterial* material = materialCore->GetCurrentMaterial();
VCNEffectParamSet& params = material->GetEffectParamSet();
params.AddFloat(VCNTXT("Selected"), (IsSelected() || parent->IsSelected()) ? 1.0f : 0.0f);
// Render the mesh
VCNEffectCore::GetInstance()->RenderMesh( mMeshID, mBoundingSphere );
mesh->SetBoneTransforms( nullptr );
#if !defined( FINAL )
// Render the frame of the node
if ( InputManager::GetInstance().IsKeyPressed( KEY_F ) )
{
const Matrix4 nodeFrame = GetWorldTransformation();
const Vector3 center = nodeFrame.GetTranslation();
VCNRenderCore::GetInstance()->DrawLine( center, center + nodeFrame.GetXAxis().Normalized(), VCNColor(1.0f, 0.0f, 0.0f) );
VCNRenderCore::GetInstance()->DrawLine( center, center + nodeFrame.GetYAxis().Normalized(), VCNColor(0.0f, 1.0f, 0.0f) );
VCNRenderCore::GetInstance()->DrawLine( center, center + nodeFrame.GetZAxis().Normalized(), VCNColor(0.0f, 0.0f, 1.0f) );
}
#endif
}
}
示例2: DrawArrow
void BatchRenderer::DrawArrow( const Matrix4& arrowTransform, const FColor& color, FLOAT arrowLength, FLOAT headSize )
{
mxSWIPED("Unreal Engine 3");
const Vec3D origin = arrowTransform.GetTranslation();
const Vec3D endPoint = arrowTransform.TransformVector(Vec3D( arrowLength, 0.0f, 0.0f ));
const FLOAT headScale = 0.5f;
const FColor& startColor = FColor::WHITE;
const FColor& endColor = color;
this->DrawLine3D( origin, endPoint, startColor, endColor );
this->DrawLine3D( endPoint, arrowTransform.TransformVector(Vec3D( arrowLength-headSize, +headSize*headScale, +headSize*headScale )), startColor, endColor );
this->DrawLine3D( endPoint, arrowTransform.TransformVector(Vec3D( arrowLength-headSize, +headSize*headScale, -headSize*headScale )), startColor, endColor );
this->DrawLine3D( endPoint, arrowTransform.TransformVector(Vec3D( arrowLength-headSize, -headSize*headScale, +headSize*headScale )), startColor, endColor );
this->DrawLine3D( endPoint, arrowTransform.TransformVector(Vec3D( arrowLength-headSize, -headSize*headScale, -headSize*headScale )), startColor, endColor );
}
示例3: Draw
void Draw( BatchRenderer & batchRenderer, const Matrix4& transform, const FColor& color )
{
const Vec3D apex = transform.TransformVector( arrowHeadVertex );
// draw the 'stem'
batchRenderer.DrawLine3D( transform.GetTranslation(), apex, FColor::WHITE, color );
// draw the arrow head
for( UINT iSegment = 0 ; iSegment < AXIS_ARROW_SEGMENTS ; iSegment++ )
{
const Vec3D& p0 = transform.TransformVector( arrowVertices[ iSegment ] );
const Vec3D& p1 = transform.TransformVector( arrowVertices[ iSegment + 1 ] );
// Draw the base triangle of the cone.
// NOTE: no need because we disabled backface culling
//batchRenderer.DrawSolidTriangle3D( p0,p1,arrowBaseVertex,color );
// Draw the top triangle of the cone.
batchRenderer.DrawSolidTriangle3D( p0, p1, apex, color );
}
}