Panda3D
 All Classes Functions Variables Enumerations
selectiveChildNode.h
1 // Filename: selectiveChildNode.h
2 // Created by: drose (06Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef SELECTIVECHILDNODE_H
16 #define SELECTIVECHILDNODE_H
17 
18 #include "pandabase.h"
19 
20 #include "pandaNode.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : SelectiveChildNode
24 // Description : A base class for nodes like LODNode and SequenceNode
25 // that select only one visible child at a time.
26 ////////////////////////////////////////////////////////////////////
27 class EXPCL_PANDA_PGRAPHNODES SelectiveChildNode : public PandaNode {
28 PUBLISHED:
29  INLINE SelectiveChildNode(const string &name);
30 
31 protected:
32  INLINE SelectiveChildNode(const SelectiveChildNode &copy);
33 
34 public:
35  virtual bool has_selective_visibility() const;
36  virtual int get_first_visible_child() const;
37  virtual int get_next_visible_child(int n) const;
38 
39 protected:
40  INLINE void select_child(int n);
41 
42 private:
43  // Not sure if this should be cycled or not. It's not exactly
44  // thread-safe not to cycle it, but it doesn't really need the full
45  // pipeline control. It's probably a problem in the non-thread-safe
46  // design; need to rethink the design a bit.
47  int _selected_child;
48 
49 public:
50  static TypeHandle get_class_type() {
51  return _type_handle;
52  }
53  static void init_type() {
54  PandaNode::init_type();
55  register_type(_type_handle, "SelectiveChildNode",
56  PandaNode::get_class_type());
57  }
58  virtual TypeHandle get_type() const {
59  return get_class_type();
60  }
61  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
62 
63 private:
64  static TypeHandle _type_handle;
65 };
66 
67 #include "selectiveChildNode.I"
68 
69 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
A base class for nodes like LODNode and SequenceNode that select only one visible child at a time...
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:530
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:500
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:515
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85