本文整理汇总了C++中GfMatrix4d::ExtractTranslation方法的典型用法代码示例。如果您正苦于以下问题:C++ GfMatrix4d::ExtractTranslation方法的具体用法?C++ GfMatrix4d::ExtractTranslation怎么用?C++ GfMatrix4d::ExtractTranslation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GfMatrix4d
的用法示例。
在下文中一共展示了GfMatrix4d::ExtractTranslation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: c
GlfSimpleLight
HdStLight::_ApproximateAreaLight(SdfPath const &id,
HdSceneDelegate *sceneDelegate)
{
// Get the color of the light
GfVec3f hdc = sceneDelegate->GetLightParamValue(id, HdStLightTokens->color)
.Get<GfVec3f>();
// Extract intensity
float intensity =
sceneDelegate->GetLightParamValue(id, HdLightTokens->intensity)
.Get<float>();
// Extract the exposure of the light
float exposure =
sceneDelegate->GetLightParamValue(id, HdLightTokens->exposure)
.Get<float>();
intensity *= powf(2.0f, GfClamp(exposure, -50.0f, 50.0f));
// Calculate the final color of the light
GfVec4f c(hdc[0]*intensity, hdc[1]*intensity, hdc[2]*intensity, 1.0f);
// Get the transform of the light
GfMatrix4d transform = _params[HdTokens->transform].Get<GfMatrix4d>();
GfVec3d hdp = transform.ExtractTranslation();
GfVec4f p = GfVec4f(hdp[0], hdp[1], hdp[2], 1.0f);
// Create the Glf Simple Light object that will be used by the rest
// of the pipeline. No support for shadows for this translated light.
GlfSimpleLight l;
l.SetPosition(p);
l.SetDiffuse(c);
l.SetHasShadow(false);
return l;
}
示例2: flip
void
GfFrustum::SetPositionAndRotationFromMatrix(
const GfMatrix4d &camToWorldXf)
{
// First conform matrix to be...
GfMatrix4d conformedXf = camToWorldXf;
// ... right handed
if (!conformedXf.IsRightHanded()) {
static GfMatrix4d flip(GfVec4d(-1.0, 1.0, 1.0, 1.0));
conformedXf = flip * conformedXf;
}
// ... and orthonormal
conformedXf.Orthonormalize();
SetRotation(conformedXf.ExtractRotation());
SetPosition(conformedXf.ExtractTranslation());
}