Panda3D
Loading...
Searching...
No Matches
stTree.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 stTree.h
10 * @author drose
11 * @date 2010-10-06
12 */
13
14#ifndef STTREE_H
15#define STTREE_H
16
17#include "pandabase.h"
18#include "typedReferenceCount.h"
19#include "namable.h"
20#include "speedtree_api.h"
21
22class SpeedTreeNode;
23
24/**
25 * Encapsulates a single tree model in the SpeedTree library, as loaded from
26 * an SRT file.
27 */
28class EXPCL_PANDASPEEDTREE STTree : public TypedReferenceCount, public Namable {
29PUBLISHED:
30 STTree(const Filename &fullpath);
31 STTree(const STTree &copy) = delete;
32
33PUBLISHED:
34 INLINE const Filename &get_fullpath() const;
35
36 INLINE bool is_valid() const;
37
38 virtual void output(std::ostream &out) const;
39
40public:
41 INLINE const SpeedTree::CTreeRender *get_tree() const;
42 INLINE SpeedTree::CTreeRender *modify_tree();
43
44private:
45 Filename _fullpath;
46 bool _is_valid;
47 SpeedTree::CTreeRender _tree;
48
49public:
50 static TypeHandle get_class_type() {
51 return _type_handle;
52 }
53 static void init_type() {
54 TypedReferenceCount::init_type();
55 register_type(_type_handle, "STTree",
56 TypedReferenceCount::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
63private:
64 static TypeHandle _type_handle;
65};
66
67INLINE std::ostream &operator << (std::ostream &out, const STTree &tree) {
68 tree.output(out);
69 return out;
70}
71
72#include "stTree.I"
73
74#endif
The name of a file, such as a texture file or an Egg file.
Definition filename.h:44
A base class for all things which can have a name.
Definition namable.h:26
void output(std::ostream &out) const
Outputs the Namable.
Definition namable.I:61
Encapsulates a single tree model in the SpeedTree library, as loaded from an SRT file.
Definition stTree.h:28
Interfaces with the SpeedTree library to render SpeedTree objects, especially trees,...
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.