本文整理汇总了C++中Matrix3x4::Rotation方法的典型用法代码示例。如果您正苦于以下问题:C++ Matrix3x4::Rotation方法的具体用法?C++ Matrix3x4::Rotation怎么用?C++ Matrix3x4::Rotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3x4
的用法示例。
在下文中一共展示了Matrix3x4::Rotation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetParent
void Node::SetParent(Node* parent)
{
if (parent)
{
Matrix3x4 oldWorldTransform = GetWorldTransform();
parent->AddChild(this);
if (parent != scene_)
{
Matrix3x4 newTransform = parent->GetWorldTransform().Inverse() * oldWorldTransform;
SetTransform(newTransform.Translation(), newTransform.Rotation(), newTransform.Scale());
}
else
{
// The root node is assumed to have identity transform, so can disregard it
SetTransform(oldWorldTransform.Translation(), oldWorldTransform.Rotation(), oldWorldTransform.Scale());
}
}
}
示例2: SetParent
void Node::SetParent(Node* parent)
{
if (parent)
{
Matrix3x4 oldWorldTransform = GetWorldTransform();
parent->AddChild(this);
Matrix3x4 newTransform = parent->GetWorldTransform().Inverse() * oldWorldTransform;
SetTransform(newTransform.Translation(), newTransform.Rotation(), newTransform.Scale());
}
}
示例3: GetWorldBoundingBox
BoundingBox CollisionShape::GetWorldBoundingBox() const
{
if (shape_ && node_)
{
// Use the rigid body's world transform if possible, as it may be different from the rendering transform
RigidBody* body = GetComponent<RigidBody>();
Matrix3x4 worldTransform = body ? Matrix3x4(body->GetPosition(), body->GetRotation(), node_->GetWorldScale()) :
node_->GetWorldTransform();
Vector3 worldPosition(worldTransform * position_);
Quaternion worldRotation(worldTransform.Rotation() * rotation_);
btTransform shapeWorldTransform(ToBtQuaternion(worldRotation), ToBtVector3(worldPosition));
btVector3 aabbMin, aabbMax;
shape_->getAabb(shapeWorldTransform, aabbMin, aabbMax);
return BoundingBox(ToVector3(aabbMin), ToVector3(aabbMax));
}
else
return BoundingBox();
}
示例4: DrawDebugGeometry
void CollisionShape::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
{
if (debug && physicsWorld_ && shape_ && node_ && IsEnabledEffective())
{
physicsWorld_->SetDebugRenderer(debug);
physicsWorld_->SetDebugDepthTest(depthTest);
// Use the rigid body's world transform if possible, as it may be different from the rendering transform
Matrix3x4 worldTransform;
RigidBody* body = GetComponent<RigidBody>();
bool bodyActive = false;
if (body)
{
worldTransform = Matrix3x4(body->GetPosition(), body->GetRotation(), node_->GetWorldScale());
bodyActive = body->IsActive();
}
else
worldTransform = node_->GetWorldTransform();
Vector3 position = position_;
// For terrains, undo the height centering performed automatically by Bullet
if (shapeType_ == SHAPE_TERRAIN && geometry_)
{
HeightfieldData* heightfield = static_cast<HeightfieldData*>(geometry_.Get());
position.y_ += (heightfield->minHeight_ + heightfield->maxHeight_) * 0.5f;
}
Vector3 worldPosition(worldTransform * position);
Quaternion worldRotation(worldTransform.Rotation() * rotation_);
btDiscreteDynamicsWorld* world = physicsWorld_->GetWorld();
world->debugDrawObject(btTransform(ToBtQuaternion(worldRotation), ToBtVector3(worldPosition)), shape_, bodyActive ?
WHITE : GREEN);
physicsWorld_->SetDebugRenderer(0);
}
}