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