Panda3D
|
00001 // Filename: nodeVertexTransform.cxx 00002 // Created by: drose (22eb07) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "nodeVertexTransform.h" 00016 00017 TypeHandle NodeVertexTransform::_type_handle; 00018 00019 //////////////////////////////////////////////////////////////////// 00020 // Function: NodeVertexTransform::Constructor 00021 // Access: Published 00022 // Description: 00023 //////////////////////////////////////////////////////////////////// 00024 NodeVertexTransform:: 00025 NodeVertexTransform(const PandaNode *node, 00026 const VertexTransform *prev) : 00027 _node(node), 00028 _prev(prev) 00029 { 00030 } 00031 00032 //////////////////////////////////////////////////////////////////// 00033 // Function: NodeVertexTransform::get_matrix 00034 // Access: Published, Virtual 00035 // Description: Returns the transform of the associated node, 00036 // composed with the previous VertexTransform if any, 00037 // expressed as a matrix. 00038 //////////////////////////////////////////////////////////////////// 00039 void NodeVertexTransform:: 00040 get_matrix(LMatrix4 &matrix) const { 00041 if (_prev != (const VertexTransform *)NULL) { 00042 LMatrix4 prev_matrix; 00043 _prev->get_matrix(prev_matrix); 00044 matrix.multiply(_node->get_transform()->get_mat(), prev_matrix); 00045 00046 } else { 00047 matrix = _node->get_transform()->get_mat(); 00048 } 00049 } 00050 00051 //////////////////////////////////////////////////////////////////// 00052 // Function: NodeVertexTransform::output 00053 // Access: Published, Virtual 00054 // Description: 00055 //////////////////////////////////////////////////////////////////// 00056 void NodeVertexTransform:: 00057 output(ostream &out) const { 00058 if (_prev != (const VertexTransform *)NULL) { 00059 _prev->output(out); 00060 out << " * "; 00061 } 00062 00063 out << "NodeVertexTransform(" << _node->get_name() << ")"; 00064 }