本文整理汇总了C++中Transforms::getWorldScale方法的典型用法代码示例。如果您正苦于以下问题:C++ Transforms::getWorldScale方法的具体用法?C++ Transforms::getWorldScale怎么用?C++ Transforms::getWorldScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transforms
的用法示例。
在下文中一共展示了Transforms::getWorldScale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: translate
void Transforms::translate(const Vector3& d, tTransformSpace relativeTo)
{
Vector3 adjusted;
switch(relativeTo)
{
case TS_LOCAL:
// Position is relative to parent so transform downwards
m_position += m_orientation * d;
break;
case TS_PARENT:
m_position += d;
break;
case TS_WORLD:
{
// Position is relative to parent so transform upwards
Transforms* pParent = getTransforms();
if (pParent)
m_position += (pParent->getWorldOrientation().Inverse() * d) / pParent->getWorldScale();
else
m_position += d;
break;
}
}
needUpdate();
}
示例2: GetPtr
Handle<Value> Transforms_GetWorldScale(Local<String> property, const AccessorInfo &info)
{
HandleScope handle_scope;
Transforms* ptr = GetPtr(info.This());
assert(ptr);
return handle_scope.Close(toJavaScript(ptr->getWorldScale()));
}
示例3: update
void Transforms::update()
{
if (!m_bDirty)
return;
Transforms* pParent = getTransforms();
if (pParent)
{
// Update orientation
const Quaternion& parentOrientation = pParent->getWorldOrientation();
if (m_bInheritOrientation)
{
// Combine orientation with that of parent
m_fullOrientation = parentOrientation * m_orientation;
m_fullOrientation.normalise();
}
else
{
// No inheritence
m_fullOrientation = m_orientation;
}
// Update scale
const Vector3& parentScale = pParent->getWorldScale();
if (m_bInheritScale)
{
// Scale own position by parent scale, NB just combine
// as equivalent axes, no shearing
m_fullScale = parentScale * m_scale;
}
else
{
// No inheritence
m_fullScale = m_scale;
}
// Change position vector based on parent's orientation & scale
m_fullPosition = parentOrientation * (parentScale * m_position);
// Add altered position vector to parents
m_fullPosition += pParent->getWorldPosition();
}
else
{
// No parent
m_fullPosition = m_position;
m_fullOrientation = m_orientation;
m_fullScale = m_scale;
}
m_bDirty = false;
}