Skip to content

Commit 130761e

Browse files
committed
Added support for CoordinateFrame to ComputeTransform visitor.
1 parent 6314667 commit 130761e

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

include/vsg/maths/transform.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,12 @@ namespace vsg
263263
/// usage: auto matrix = vsg::visit<vsg::ComputeTransform>(nodePath).matrix;
264264
struct VSG_DECLSPEC ComputeTransform : public ConstVisitor
265265
{
266+
dvec3 origin;
266267
dmat4 matrix;
267268

268269
void apply(const Transform& transform) override;
269270
void apply(const MatrixTransform& mt) override;
271+
void apply(const CoordinateFrame& cf) override;
270272
void apply(const Camera& camera) override;
271273
};
272274

src/vsg/maths/maths_transform.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1414
#include <vsg/io/Options.h>
1515
#include <vsg/maths/transform.h>
1616
#include <vsg/nodes/MatrixTransform.h>
17+
#include <vsg/nodes/CoordinateFrame.h>
1718

1819
using namespace vsg;
1920

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

445+
void ComputeTransform::apply(const CoordinateFrame& cf)
446+
{
447+
origin = cf.origin;
448+
matrix = vsg::rotate(cf.rotation);
449+
}
450+
444451
void ComputeTransform::apply(const Camera& camera)
445452
{
446453
if (camera.viewMatrix)

0 commit comments

Comments
 (0)