Skip to content

Commit

Permalink
Added support for CoordinateFrame to ComputeTransform visitor.
Browse files Browse the repository at this point in the history
  • Loading branch information
robertosfield committed Dec 13, 2024
1 parent 6314667 commit 130761e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/vsg/maths/transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,12 @@ namespace vsg
/// usage: auto matrix = vsg::visit<vsg::ComputeTransform>(nodePath).matrix;
struct VSG_DECLSPEC ComputeTransform : public ConstVisitor
{
dvec3 origin;
dmat4 matrix;

void apply(const Transform& transform) override;
void apply(const MatrixTransform& mt) override;
void apply(const CoordinateFrame& cf) override;
void apply(const Camera& camera) override;
};

Expand Down
7 changes: 7 additions & 0 deletions src/vsg/maths/maths_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/io/Options.h>
#include <vsg/maths/transform.h>
#include <vsg/nodes/MatrixTransform.h>
#include <vsg/nodes/CoordinateFrame.h>

using namespace vsg;

Expand Down Expand Up @@ -441,6 +442,12 @@ void ComputeTransform::apply(const MatrixTransform& mt)
matrix = matrix * mt.matrix;
}

void ComputeTransform::apply(const CoordinateFrame& cf)
{
origin = cf.origin;
matrix = vsg::rotate(cf.rotation);
}

void ComputeTransform::apply(const Camera& camera)
{
if (camera.viewMatrix)
Expand Down

0 comments on commit 130761e

Please sign in to comment.