Beispiel #1
0
// Qt Streams
QDebug operator<<(QDebug dbg, const Transform3D &transform)
{
  dbg << "Transform3D\n{\n";
  dbg << "Position: <" << transform.translation().x() << ", " << transform.translation().y() << ", " << transform.translation().z() << ">\n";
  dbg << "Scale: <" << transform.scale().x() << ", " << transform.scale().y() << ", " << transform.scale().z() << ">\n";
  dbg << "Rotation: <" << transform.rotation().x() << ", " << transform.rotation().y() << ", " << transform.rotation().z() << " | " << transform.rotation().scalar() << ">\n}";
  return dbg;
}
void DebugAttachmentSystem::updateSphere(
    DebugSphereInstance &               sphere,
    const std::shared_ptr<Attachment> & attachment,
    const Transform3D &                 transform)
{
    sphere.setTransform(Transform3D::fromPose(attachment->worldPose()));
    sphere.setColor({0.3f, 1.0f, 0.3});
    sphere.setVisible(false);
    sphere.setRadius(transform.scale());
}
Beispiel #3
0
Transform3D Transform3D::interpolated(const Transform3D & other, float v) const
{
    Transform3D result;

    result.setOrientation(glm::slerp(m_orientation, other.orientation(), v));
    result.setPosition(glm::mix(m_position, other.position(), v));
    result.setScale(glm::mix(m_scale, other.scale(), v));
    result.setCenter(glm::mix(m_center, other.center(), v));

    return result;
}
Beispiel #4
0
void ImGuiProperty(const Transform3D &transform3D) {
    auto position = transform3D.position();
    auto center = transform3D.center();
    auto scale = transform3D.scale();
    auto orientation = transform3D.orientation();

    ImGui::InputFloat3("Position", &position[0]);
    ImGui::InputFloat3("Center", &center[0]);
    ImGui::InputFloat("Scale", &scale);
    ImGui::InputFloat4("Orientation", &orientation[0]);
}
void DebugAttachmentSystem::updatePose(
    DebugPoseInstance &                 pose,
    const std::shared_ptr<Attachment> & attachment,
    const Transform3D &                 transform)
{
    auto transform2 = transform;

    transform2.setScale(transform.scale() * 20.0f);
    pose.setTransform(transform);
    pose.setVisible(true);
}
Beispiel #6
0
void ImGuiProperty(Transform3D &transform3D) {
    auto position = transform3D.position();
    auto center = transform3D.center();
    auto scale = transform3D.scale();
    auto orientation = transform3D.orientation();

    if (ImGui::InputFloat3("Position", &position[0]))
        transform3D.setPosition(position);
    if (ImGui::InputFloat3("Center", &center[0]))
        transform3D.setCenter(position);
    if (ImGui::InputFloat("Scale", &scale)) transform3D.setScale(scale);
    if (ImGui::InputFloat4("Orientation", &orientation[0]))
        transform3D.setOrientation(orientation);
}
Beispiel #7
0
/**Create a transform representing a scale in x,y,z
 */
Transform3D createTransformScale(const Vector3D& scale_)
{
	Transform3D retval = Transform3D::Identity();
	retval.scale(scale_);
	return retval;
}