Panda3D
selectiveChildNode.h
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 selectiveChildNode.h
10  * @author drose
11  * @date 2002-03-06
12  */
13 
14 #ifndef SELECTIVECHILDNODE_H
15 #define SELECTIVECHILDNODE_H
16 
17 #include "pandabase.h"
18 
19 #include "pandaNode.h"
20 
21 /**
22  * A base class for nodes like LODNode and SequenceNode that select only one
23  * visible child at a time.
24  */
25 class EXPCL_PANDA_PGRAPHNODES SelectiveChildNode : public PandaNode {
26 PUBLISHED:
27  INLINE explicit SelectiveChildNode(const std::string &name);
28 
29 protected:
30  INLINE SelectiveChildNode(const SelectiveChildNode &copy);
31 
32 public:
33  virtual bool has_selective_visibility() const;
34  virtual int get_first_visible_child() const;
35  virtual int get_next_visible_child(int n) const;
36 
37 protected:
38  INLINE void select_child(int n);
39 
40 private:
41  // Not sure if this should be cycled or not. It's not exactly thread-safe
42  // not to cycle it, but it doesn't really need the full pipeline control.
43  // It's probably a problem in the non-thread-safe design; need to rethink
44  // the design a bit.
45  int _selected_child;
46 
47 public:
48  static TypeHandle get_class_type() {
49  return _type_handle;
50  }
51  static void init_type() {
52  PandaNode::init_type();
53  register_type(_type_handle, "SelectiveChildNode",
54  PandaNode::get_class_type());
55  }
56  virtual TypeHandle get_type() const {
57  return get_class_type();
58  }
59  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
60 
61 private:
62  static TypeHandle _type_handle;
63 };
64 
65 #include "selectiveChildNode.I"
66 
67 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual int get_first_visible_child() const
Returns the index number of the first visible child of this node, or a number >= get_num_children() i...
Definition: pandaNode.cxx:421
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool has_selective_visibility() const
Should be overridden by derived classes to return true if this kind of node has some restrictions on ...
Definition: pandaNode.cxx:409
A base class for nodes like LODNode and SequenceNode that select only one visible child at a time.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
virtual int get_next_visible_child(int n) const
Returns the index number of the next visible child of this node following the indicated child,...
Definition: pandaNode.cxx:432