Panda3D
stTree.h
1 // Filename: stTree.h
2 // Created by: drose (06Oct10)
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 STTREE_H
16 #define STTREE_H
17 
18 #include "pandabase.h"
19 #include "typedReferenceCount.h"
20 #include "namable.h"
21 #include "speedtree_api.h"
22 
23 class SpeedTreeNode;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : STTree
27 // Description : Encapsulates a single tree model in the SpeedTree
28 // library, as loaded from an SRT file.
29 ////////////////////////////////////////////////////////////////////
30 class EXPCL_PANDASPEEDTREE STTree : public TypedReferenceCount, public Namable {
31 PUBLISHED:
32  STTree(const Filename &fullpath);
33 private:
34  STTree(const STTree &copy);
35 
36 PUBLISHED:
37  INLINE const Filename &get_fullpath() const;
38 
39  INLINE bool is_valid() const;
40 
41  virtual void output(ostream &out) const;
42 
43 public:
44  INLINE const SpeedTree::CTreeRender *get_tree() const;
45  INLINE SpeedTree::CTreeRender *modify_tree();
46 
47 private:
48  Filename _fullpath;
49  bool _is_valid;
50  SpeedTree::CTreeRender _tree;
51 
52 public:
53  static TypeHandle get_class_type() {
54  return _type_handle;
55  }
56  static void init_type() {
57  TypedReferenceCount::init_type();
58  register_type(_type_handle, "STTree",
59  TypedReferenceCount::get_class_type());
60  }
61  virtual TypeHandle get_type() const {
62  return get_class_type();
63  }
64  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
65 
66 private:
67  static TypeHandle _type_handle;
68 };
69 
70 INLINE ostream &operator << (ostream &out, const STTree &tree) {
71  tree.output(out);
72  return out;
73 }
74 
75 #include "stTree.I"
76 
77 #endif
void output(ostream &out) const
Outputs the Namable.
Definition: namable.I:97
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
A base class for all things which can have a name.
Definition: namable.h:29
The name of a file, such as a texture file or an Egg file.
Definition: filename.h:44
Interfaces with the SpeedTree library to render SpeedTree objects, especially trees, within the Panda3D scene graph.
Definition: speedTreeNode.h:54
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
Encapsulates a single tree model in the SpeedTree library, as loaded from an SRT file.
Definition: stTree.h:30