本文整理汇总了C++中Matrix4::apply方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix4::apply方法的具体用法?C++ Matrix4::apply怎么用?C++ Matrix4::apply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix4
的用法示例。
在下文中一共展示了Matrix4::apply方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cube
void DebugRenderer::cube(const Vector3& pos, const Matrix4& rot, float sideLength, const Color32& color)
{
Vector3 coords[8];
for (uint i = 0; i < 8; ++i)
coords[i] = rot.apply((m_cubeCoords[i] * sideLength)) + pos;
quad(coords[1], coords[0], coords[3], coords[2], Color32(255, 0, 0, 0));
quad(coords[4], coords[5], coords[6], coords[7], Color32(0, 255, 0, 0));
quad(coords[0], coords[1], coords[5], coords[4], Color32(0, 0, 255, 0));
quad(coords[7], coords[6], coords[2], coords[3], Color32(255, 255, 0, 0));
quad(coords[5], coords[1], coords[2], coords[6], Color32(255, 0, 255, 0));
quad(coords[0], coords[4], coords[7], coords[3], color);
}
示例2: makeNewDirection
bool Branch::makeNewDirection(float angleMul, bool hasReatchedTarget)
{
if (m_curve)
{
if (m_curveTarget == m_curveCount)
return false;
Vector3 pos = curvePos();
Vector3 direction = pos - m_position;
// rand...
float x = (s_settings->m_angle + s_settings->m_angleVariation * floatRandom()) * angleMul * 0.005f;
float y = (s_settings->m_angle + s_settings->m_angleVariation * floatRandom()) * angleMul * 0.005f;
float z = (s_settings->m_angle + s_settings->m_angleVariation * floatRandom()) * angleMul * 0.005f;
direction = direction.normalize();
direction.x += x;
direction.y += y;
direction.z += z;
m_direction = direction.normalize();
// Set next target if we reatched our target point in the curve
if (hasReatchedTarget)
++m_curveTarget;
return true;
}
Matrix4 matrix;
float angle = (s_settings->m_angle + s_settings->m_angleVariation * floatRandom()) * angleMul;
if (random() & 1)
angle = -angle;
switch (random() %3 )
{
case 0 :
{
matrix.makeXrotation(angle * (3.1415f / 180.0f));
//m_direction.y = 1.0f;
break;
}
case 1 :
{
matrix.makeYrotation(angle * (3.1415f / 180.0f));
//m_direction.z = 1.0f;
break;
}
case 2 :
{
matrix.makeZrotation(angle * (3.1415f / 180.0f));
//m_direction.x = 1.0f;
break;
}
default : ZENIC_ASSERT(false);
}
m_direction = matrix.apply(m_direction);
m_direction.y += -s_settings->m_gravity;
m_direction = m_direction.normalize();
return true;
}