Panda3D
cLwoLayer.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 cLwoLayer.cxx
10  * @author drose
11  * @date 2001-04-25
12  */
13 
14 #include "cLwoLayer.h"
15 #include "lwoToEggConverter.h"
16 
17 #include "eggData.h"
18 
19 
20 /**
21  * Creates the egg structures associated with this Lightwave object.
22  */
23 void CLwoLayer::
25  _egg_group = new EggGroup(_layer->_name);
26 
27  if (_layer->_pivot != LPoint3::zero()) {
28  // If we have a nonzero pivot point, that's a translation transform.
29  LPoint3d translate = LCAST(double, _layer->_pivot);
30  _egg_group->set_transform3d(LMatrix4d::translate_mat(translate));
31  _egg_group->set_group_type(EggGroup::GT_instance);
32  }
33 }
34 
35 /**
36  * Connects all the egg structures together.
37  */
38 void CLwoLayer::
40  if (_layer->_parent != -1) {
41  const CLwoLayer *parent = _converter->get_layer(_layer->_parent);
42  if (parent != nullptr) {
43  parent->_egg_group->add_child(_egg_group.p());
44  return;
45  }
46 
47  nout << "No layer found with number " << _layer->_parent
48  << "; cannot parent layer " << _layer->_number << " properly.\n";
49  }
50 
51  _converter->get_egg_data()->add_child(_egg_group.p());
52 }
EggData * get_egg_data()
Returns the EggData structure.
void make_egg()
Creates the egg structures associated with this Lightwave object.
Definition: cLwoLayer.cxx:24
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition: eggGroup.h:34
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class is a wrapper around LwoLayer and stores additional information useful during the conversio...
Definition: cLwoLayer.h:29
CLwoLayer * get_layer(int number) const
Returns a pointer to the layer with the given index number, or NULL if there is no such layer.
EggNode * add_child(EggNode *node)
Adds the indicated child to the group and returns it.
void connect_egg()
Connects all the egg structures together.
Definition: cLwoLayer.cxx:39
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.