Panda3D
|
00001 // Filename: cLwoLayer.cxx 00002 // Created by: drose (25Apr01) 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 "cLwoLayer.h" 00016 #include "lwoToEggConverter.h" 00017 00018 #include "eggData.h" 00019 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Function: CLwoLayer::make_egg 00023 // Access: Public 00024 // Description: Creates the egg structures associated with this 00025 // Lightwave object. 00026 //////////////////////////////////////////////////////////////////// 00027 void CLwoLayer:: 00028 make_egg() { 00029 _egg_group = new EggGroup(_layer->_name); 00030 00031 if (_layer->_pivot != LPoint3::zero()) { 00032 // If we have a nonzero pivot point, that's a translation 00033 // transform. 00034 LPoint3d translate = LCAST(double, _layer->_pivot); 00035 _egg_group->set_transform3d(LMatrix4d::translate_mat(translate)); 00036 _egg_group->set_group_type(EggGroup::GT_instance); 00037 } 00038 } 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Function: CLwoLayer::connect_egg 00042 // Access: Public 00043 // Description: Connects all the egg structures together. 00044 //////////////////////////////////////////////////////////////////// 00045 void CLwoLayer:: 00046 connect_egg() { 00047 if (_layer->_parent != -1) { 00048 const CLwoLayer *parent = _converter->get_layer(_layer->_parent); 00049 if (parent != (CLwoLayer *)NULL) { 00050 parent->_egg_group->add_child(_egg_group.p()); 00051 return; 00052 } 00053 00054 nout << "No layer found with number " << _layer->_parent 00055 << "; cannot parent layer " << _layer->_number << " properly.\n"; 00056 } 00057 00058 _converter->get_egg_data()->add_child(_egg_group.p()); 00059 } 00060