本文整理汇总了C++中Mat4::getRotationPart方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4::getRotationPart方法的具体用法?C++ Mat4::getRotationPart怎么用?C++ Mat4::getRotationPart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4
的用法示例。
在下文中一共展示了Mat4::getRotationPart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visit
void visit(const TRenderableVariableTemplate& rvar)
{
typedef typename TRenderableVariableTemplate::Type DataType;
const GlProgramVariable& glvar = rvar.getGlProgramVariable();
// Array size
U arraySize;
if(rvar.isInstanced())
{
arraySize = std::min<U>(m_instanceCount, glvar.getArraySize());
}
else
{
arraySize = glvar.getArraySize();
}
// Set uniform
//
Bool hasWorldTrfs = m_renderable->getHasWorldTransforms();
const Mat4& vp = m_fr->getViewProjectionMatrix();
const Mat4& v = m_fr->getViewMatrix();
switch(rvar.getBuildinId())
{
case BuildinMaterialVariableId::NO_BUILDIN:
uniSet<DataType>(glvar, rvar.begin(), arraySize);
break;
case BuildinMaterialVariableId::MVP_MATRIX:
if(hasWorldTrfs)
{
Mat4* mvp = m_drawer->m_r->getSceneGraph().getFrameAllocator().
newInstance<Mat4>(arraySize);
for(U i = 0; i < arraySize; i++)
{
Transform worldTrf;
m_renderable->getRenderWorldTransform(
m_visibleNode->getSpatialIndex(i), worldTrf);
mvp[i] = vp * Mat4(worldTrf);
}
uniSet(glvar, &mvp[0], arraySize);
}
else
{
ANKI_ASSERT(arraySize == 1 && "Shouldn't instance that one");
uniSet(glvar, &vp, 1);
}
break;
case BuildinMaterialVariableId::MV_MATRIX:
{
ANKI_ASSERT(hasWorldTrfs);
Mat4* mv = m_drawer->m_r->getSceneGraph().getFrameAllocator().
newInstance<Mat4>(arraySize);
for(U i = 0; i < arraySize; i++)
{
Transform worldTrf;
m_renderable->getRenderWorldTransform(
m_visibleNode->getSpatialIndex(i), worldTrf);
mv[i] = v * Mat4(worldTrf);
}
uniSet(glvar, &mv[0], arraySize);
}
break;
case BuildinMaterialVariableId::VP_MATRIX:
uniSet(glvar, &vp, 1);
break;
case BuildinMaterialVariableId::NORMAL_MATRIX:
if(hasWorldTrfs)
{
Mat3* normMats =
m_drawer->m_r->getSceneGraph().getFrameAllocator().
newInstance<Mat3>(arraySize);
for(U i = 0; i < arraySize; i++)
{
Transform worldTrf;
m_renderable->getRenderWorldTransform(
m_visibleNode->getSpatialIndex(i), worldTrf);
Mat4 mv = v * Mat4(worldTrf);
normMats[i] = mv.getRotationPart();
normMats[i].reorthogonalize();
}
uniSet(glvar, &normMats[0], arraySize);
}
else
{
ANKI_ASSERT(arraySize == 1
&& "Having that instanced doesn't make sense");
Mat3 normMat = v.getRotationPart();
//.........这里部分代码省略.........