Panda3D
nodeVertexTransform.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file nodeVertexTransform.cxx
10  * @author drose
11  * @date 2007-02-22
12  */
13 
14 #include "nodeVertexTransform.h"
15 
16 TypeHandle NodeVertexTransform::_type_handle;
17 
18 /**
19  *
20  */
21 NodeVertexTransform::
22 NodeVertexTransform(const PandaNode *node,
23  const VertexTransform *prev) :
24  _node(node),
25  _prev(prev)
26 {
27 }
28 
29 /**
30  * Returns the transform of the associated node, composed with the previous
31  * VertexTransform if any, expressed as a matrix.
32  */
34 get_matrix(LMatrix4 &matrix) const {
35  if (_prev != nullptr) {
36  LMatrix4 prev_matrix;
37  _prev->get_matrix(prev_matrix);
38  matrix.multiply(_node->get_transform()->get_mat(), prev_matrix);
39 
40  } else {
41  matrix = _node->get_transform()->get_mat();
42  }
43 }
44 
45 /**
46  *
47  */
48 void NodeVertexTransform::
49 output(std::ostream &out) const {
50  if (_prev != nullptr) {
51  _prev->output(out);
52  out << " * ";
53  }
54 
55  out << "NodeVertexTransform(" << _node->get_name() << ")";
56 }
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
This is an abstract base class that holds a pointer to some transform, computed in some arbitrary way...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void get_matrix(LMatrix4 &matrix) const
Returns the transform of the associated node, composed with the previous VertexTransform if any,...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81