Panda3D
Loading...
Searching...
No Matches
physicalNode.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 physicalNode.h
10 * @author charles
11 * @date 2000-08-01
12 */
13
14#ifndef PHYSICALNODE_H
15#define PHYSICALNODE_H
16
17#include "pandabase.h"
18#include "pandaNode.h"
19
20#include "pvector.h"
21
22#include "physical.h"
23#include "config_physics.h"
24
25/**
26 * Graph node that encapsulated a series of physical objects
27 */
28class EXPCL_PANDA_PHYSICS PhysicalNode : public PandaNode {
29PUBLISHED:
30 explicit PhysicalNode(const std::string &name);
31 INLINE void clear();
32 INLINE Physical *get_physical(size_t index) const;
33 INLINE size_t get_num_physicals() const;
34 MAKE_SEQ(get_physicals, get_num_physicals, get_physical);
35 INLINE void add_physical(Physical *physical);
36
37 void add_physicals_from(const PhysicalNode &other);
38 void set_physical(size_t index, Physical *physical);
39 void insert_physical(size_t index, Physical *physical);
40 void remove_physical(Physical *physical);
41 void remove_physical(size_t index);
42
43 MAKE_SEQ_PROPERTY(physicals, get_num_physicals, get_physical, set_physical,
44 remove_physical, insert_physical);
45
46 virtual void write(std::ostream &out, int indent=0) const;
47
48public:
49 virtual ~PhysicalNode();
50 virtual bool safe_to_flatten() const { return false; }
51 virtual PandaNode *make_copy() const;
52
53protected:
54 PhysicalNode(const PhysicalNode &copy);
55
56private:
57 typedef pvector<PT(Physical)> PhysicalsVector;
58 PhysicalsVector _physicals;
59
60public:
61 static TypeHandle get_class_type() {
62 return _type_handle;
63 }
64 static void init_type() {
65 PandaNode::init_type();
66 register_type(_type_handle, "PhysicalNode",
67 PandaNode::get_class_type());
68 }
69 virtual TypeHandle get_type() const {
70 return get_class_type();
71 }
72 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
73
74private:
75 static TypeHandle _type_handle;
76};
77
78#include "physicalNode.I"
79
80#endif // PHYSICALNODE_H
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
Graph node that encapsulated a series of physical objects.
virtual bool safe_to_flatten() const
Returns true if it is generally safe to flatten out this particular kind of PandaNode by duplicating ...
Defines a set of physically modeled attributes.
Definition physical.h:37
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
This is our own Panda specialization on the default STL vector.
Definition pvector.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition indent.cxx:20
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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(),...