Panda3D

animChannel.cxx

00001 // Filename: animChannel.cxx
00002 // Created by:  drose (11May00)
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 
00016 #include "animChannel.h"
00017 
00018 #include "compose_matrix.h"
00019 
00020 // Tell GCC that we'll take care of the instantiation explicitly here.
00021 #ifdef __GNUC__
00022 #pragma implementation
00023 #endif
00024 
00025 ////////////////////////////////////////////////////////////////////
00026 //     Function: ACMatrixSwitchType::output_value
00027 //       Access: Public, Static
00028 //  Description: Outputs a very brief description of a matrix.
00029 ////////////////////////////////////////////////////////////////////
00030 void ACMatrixSwitchType::
00031 output_value(ostream &out, const ACMatrixSwitchType::ValueType &value) {
00032   LVecBase3 scale, shear, hpr, translate;
00033   if (decompose_matrix(value, scale, shear, hpr, translate)) {
00034     if (!scale.almost_equal(LVecBase3(1.0f, 1.0f, 1.0f))) {
00035       if (IS_NEARLY_EQUAL(scale[0], scale[1]) &&
00036           IS_NEARLY_EQUAL(scale[1], scale[2])) {
00037         out << " scale " << scale[0];
00038       } else {
00039         out << " scale " << scale;
00040       }
00041     }
00042     if (!shear.almost_equal(LVecBase3(0.0f, 0.0f, 0.0f))) {
00043       out << " shear " << shear;
00044     }
00045 
00046     if (!hpr.almost_equal(LVecBase3(0.0f, 0.0f, 0.0f))) {
00047       out << " hpr " << hpr;
00048     }
00049 
00050     if (!translate.almost_equal(LVecBase3(0.0f, 0.0f, 0.0f))) {
00051       out << " trans " << translate;
00052     }
00053 
00054   } else {
00055     out << " mat " << value;
00056   }
00057 }
00058 
 All Classes Functions Variables Enumerations