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 */
28 class 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
48 public:
49 virtual ~PhysicalNode();
50 virtual bool safe_to_flatten() const { return false; }
51 virtual PandaNode *make_copy() const;
52
53 protected:
54 PhysicalNode(const PhysicalNode &copy);
55
56 private:
57 typedef pvector<PT(Physical)> PhysicalsVector;
58 PhysicalsVector _physicals;
59
60 public:
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
74 private:
75 static TypeHandle _type_handle;
76};
77
78#include "physicalNode.I"
79
80#endif // PHYSICALNODE_H
PandaNode
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
PandaNode::make_copy
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
Definition pandaNode.cxx:481
PhysicalNode
Graph node that encapsulated a series of physical objects.
Definition physicalNode.h:28
PhysicalNode::safe_to_flatten
virtual bool safe_to_flatten() const
Returns true if it is generally safe to flatten out this particular kind of PandaNode by duplicating ...
Definition physicalNode.h:50
PhysicalNode::remove_physical
remove_physical
remove operation
Definition physicalNode.h:44
PhysicalNode::add_physicals_from
void add_physicals_from(const PhysicalNode &other)
append operation
Definition physicalNode.cxx:76
PhysicalNode::PhysicalNode
PhysicalNode(const std::string &name)
default constructor
Definition physicalNode.cxx:30
PhysicalNode::add_physical
void add_physical(Physical *physical)
Adds a Physical to this PhysicalNode.
Definition physicalNode.I:48
PhysicalNode::insert_physical
insert_physical
insert operation
Definition physicalNode.h:44
PhysicalNode::set_physical
set_physical
replace operation
Definition physicalNode.h:44
PhysicalNode::write
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition physicalNode.cxx:146
Physical
Defines a set of physically modeled attributes.
Definition physical.h:37
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
config_physics.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
indent
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition indent.cxx:20
pandaNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physicalNode.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physical.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pvector.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
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