本文整理汇总了C++中Matrix3x4::SetScale方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3x4::SetScale方法的具体用法?C++ Matrix3x4::SetScale怎么用?C++ Matrix3x4::SetScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3x4
的用法示例。
在下文中一共展示了Matrix3x4::SetScale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
const Matrix3x4& Light::GetVolumeTransform(Camera* camera)
{
if (!node_)
return Matrix3x4::IDENTITY;
switch (lightType_)
{
case LIGHT_DIRECTIONAL:
{
Matrix3x4 quadTransform;
Vector3 near, far;
// Position the directional light quad in halfway between far & near planes to prevent depth clipping
camera->GetFrustumSize(near, far);
quadTransform.SetTranslation(Vector3(0.0f, 0.0f, (camera->GetNearClip() + camera->GetFarClip()) * 0.5f));
quadTransform.SetScale(Vector3(far.x_, far.y_, 1.0f)); // Will be oversized, but doesn't matter (gets frustum clipped)
volumeTransform_ = camera->GetEffectiveWorldTransform() * quadTransform;
break;
}
case LIGHT_SPOT:
{
float yScale = tanf(fov_ * M_DEGTORAD * 0.5f) * range_;
float xScale = aspectRatio_ * yScale;
volumeTransform_ = Matrix3x4(node_->GetWorldPosition(), node_->GetWorldRotation(), Vector3(xScale, yScale, range_));
}
break;
case LIGHT_POINT:
volumeTransform_ = Matrix3x4(node_->GetWorldPosition(), Quaternion::IDENTITY, range_);
break;
}
return volumeTransform_;
}
示例2: GetFullscreenQuadTransform
Matrix3x4 Light::GetFullscreenQuadTransform(Camera* camera)
{
Matrix3x4 quadTransform;
Vector3 near, far;
// Position the directional light quad in halfway between far & near planes to prevent depth clipping
camera->GetFrustumSize(near, far);
quadTransform.SetTranslation(Vector3(0.0f, 0.0f, (camera->GetNearClip() + camera->GetFarClip()) * 0.5f));
quadTransform.SetScale(Vector3(far.x_, far.y_, 1.0f)); // Will be oversized, but doesn't matter (gets frustum clipped)
return camera->GetEffectiveWorldTransform() * quadTransform;
}