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


C++ Matrix3x4::SetScale方法代码示例

本文整理汇总了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_;
}
开发者ID:caivega,项目名称:AtomicGameEngine,代码行数:34,代码来源:Light.cpp

示例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;
}
开发者ID:EternalXY,项目名称:AtomicGameEngine,代码行数:10,代码来源:Light.cpp


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