本文整理汇总了C++中Matrix::CreateTranslationMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix::CreateTranslationMatrix方法的具体用法?C++ Matrix::CreateTranslationMatrix怎么用?C++ Matrix::CreateTranslationMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix
的用法示例。
在下文中一共展示了Matrix::CreateTranslationMatrix方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: int
void Storm3D_Bone::TransformBones(std::vector<Storm3D_Bone*> *bones)
{
Matrix t;
for(unsigned int index = 0; index < bones->size(); ++index)
{
Storm3D_Bone *b = (*bones)[index];
if(b->useForceTransform)
{
b->model_tm.CreateRotationMatrix(b->forceRotation);
t.CreateTranslationMatrix(b->forcePosition);
//b->model_tm = t;
b->model_tm.Multiply(t);
}
else
{
b->model_tm.CreateRotationMatrix(b->current_rotation);
t.CreateTranslationMatrix(b->current_position);
b->model_tm.Multiply(t);
// Apply hierarchy
if(b->parent_index != -1)
{
assert(b->parent_index < int(index));
b->model_tm.Multiply((*bones)[b->parent_index]->model_tm);
}
}
b->global_tm_ok = false;
b->vertex_tm_ok = false;
b->InformChangeToChilds();
}
for(unsigned int index = 0; index < bones->size(); ++index)
{
Storm3D_Bone *b = (*bones)[index];
b->global_tm_ok = false;
b->vertex_tm_ok = false;
// Temp
b->current_rotation = b->rotation;
b->InformChangeToChilds();
}
}
示例2:
/*!
\param position bone position
\param rotation bone rotation
\param model_position parent model position
\param model_rotation parent model rotation
*/
void Storm3D_Bone::SetOriginalProperties(const Vector &position, const Rotation &rotation, const Vector &model_position, const Rotation &model_rotation)
{
this->position = position;
this->rotation = rotation;
// We need original orientations inverse to create vertex tm
Matrix r;
r.CreateRotationMatrix(model_rotation);
Matrix t;
t.CreateTranslationMatrix(model_position);
original_inverse_tm = r * t;
original_inverse_tm.Inverse();
}
示例3: tick
void tick() {
static float angle = 0.0f;
static Vector oldPosition(0.0f, 0.0f, 0.0f);
angle += 0.01f;
if(m_effect.get()) {
Vector position;
Vector velocity;
switch(m_movementType) {
case EMITTER_MOVE_NONE:
{
position = Vector(0.0f, 0.0f, 0.0f);
velocity = Vector(0.0f, 0.0f, 0.0f);
} break;
case EMITTER_MOVE_CIRCULAR:
{
position.x = sin(angle) * 10.0f;
position.z = cos(angle) * 10.0f + 10.0f;
position.y = (sin(angle) + cos(angle)) * 5.0f;
velocity = position - oldPosition;
oldPosition = position;
} break;
}
Matrix tm;
//calcFacingMatrix(tm, velocity);
tm.CreateTranslationMatrix(position);
m_effect->setTM(tm);
m_effect->setVelocity(velocity);
}
m_particleSystemManager->tick();
}