Panda3D
bulletMultiSphereShape.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 bulletMultiSphereShape.h
10  * @author enn0x
11  * @date 2012-01-04
12  */
13 
14 #ifndef __BULLET_MULTI_SPHERE_SHAPE_H__
15 #define __BULLET_MULTI_SPHERE_SHAPE_H__
16 
17 #include "pandabase.h"
18 
19 #include "bullet_includes.h"
20 #include "bulletShape.h"
21 
22 #include "factoryParams.h"
23 #include "pta_LVecBase3.h"
24 #include "pta_stdfloat.h"
25 
26 /**
27  *
28  */
29 class EXPCL_PANDABULLET BulletMultiSphereShape : public BulletShape {
30 private:
31  BulletMultiSphereShape() : _shape(nullptr) {}
32 
33 PUBLISHED:
34  explicit BulletMultiSphereShape(const PTA_LVecBase3 &points, const PTA_stdfloat &radii);
36  void operator = (const BulletMultiSphereShape &copy);
37  INLINE ~BulletMultiSphereShape();
38 
39  int get_sphere_count() const;
40  LPoint3 get_sphere_pos(int index) const;
41  PN_stdfloat get_sphere_radius(int index) const;
42 
43  MAKE_PROPERTY(sphere_count, get_sphere_count);
44  MAKE_SEQ_PROPERTY(sphere_pos, get_sphere_count, get_sphere_pos);
45  MAKE_SEQ_PROPERTY(sphere_radius, get_sphere_count, get_sphere_radius);
46 
47 public:
48  virtual btCollisionShape *ptr() const;
49 
50 private:
51  btMultiSphereShape *_shape;
52 
53 public:
54  static void register_with_read_factory();
55  virtual void write_datagram(BamWriter *manager, Datagram &dg);
56 
57 protected:
58  static TypedWritable *make_from_bam(const FactoryParams &params);
59  void fillin(DatagramIterator &scan, BamReader *manager);
60 
61 public:
62  static TypeHandle get_class_type() {
63  return _type_handle;
64  }
65  static void init_type() {
66  BulletShape::init_type();
67  register_type(_type_handle, "BulletMultiSphereShape",
68  BulletShape::get_class_type());
69  }
70  virtual TypeHandle get_type() const {
71  return get_class_type();
72  }
73  virtual TypeHandle force_init_type() {
74  init_type();
75  return get_class_type();
76  }
77 
78 private:
79  static TypeHandle _type_handle;
80 };
81 
82 #include "bulletMultiSphereShape.I"
83 
84 #endif // __BULLET_MULTI_SPHERE_SHAPE_H__
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
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(),...
Definition: register_type.I:22