Panda3D
bulletMinkowskiSumShape.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 bulletMinkowskiSumShape.h
10  * @author enn0x
11  * @date 2013-08-15
12  */
13 
14 #ifndef __BULLET_MINKOWSKI_SUM_SHAPE_H__
15 #define __BULLET_MINKOWSKI_SUM_SHAPE_H__
16 
17 #include "pandabase.h"
18 
19 #include "bullet_includes.h"
20 #include "bullet_utils.h"
21 #include "bulletShape.h"
22 
23 #include "transformState.h"
24 
25 /**
26  *
27  */
28 class EXPCL_PANDABULLET BulletMinkowskiSumShape : public BulletShape {
29 private:
30  // Only used by make_from_bam
31  INLINE BulletMinkowskiSumShape();
32 
33 PUBLISHED:
34  explicit BulletMinkowskiSumShape(const BulletShape *shape_a, const BulletShape *shape_b);
36  INLINE ~BulletMinkowskiSumShape();
37 
38  void set_transform_a(const TransformState *ts);
39  void set_transform_b(const TransformState *ts);
40  CPT(TransformState) get_transform_a() const;
41  CPT(TransformState) get_transform_b() const;
42 
43  INLINE const BulletShape *get_shape_a() const;
44  INLINE const BulletShape *get_shape_b() const;
45 
46  MAKE_PROPERTY(transform_a, get_transform_a, set_transform_a);
47  MAKE_PROPERTY(transform_b, get_transform_b, set_transform_b);
48  MAKE_PROPERTY(shape_a, get_shape_a);
49  MAKE_PROPERTY(shape_b, get_shape_b);
50 
51 public:
52  virtual btCollisionShape *ptr() const;
53 
54 private:
55  btMinkowskiSumShape *_shape;
56 
57  CPT(BulletShape) _shape_a;
58  CPT(BulletShape) _shape_b;
59 
60  // This is stored temporarily during read.
61  PN_stdfloat _margin;
62 
63 public:
64  static void register_with_read_factory();
65  virtual void write_datagram(BamWriter *manager, Datagram &dg);
67  BamReader *manager);
68  virtual bool require_fully_complete() const;
69 
70 protected:
71  static TypedWritable *make_from_bam(const FactoryParams &params);
72  void fillin(DatagramIterator &scan, BamReader *manager);
73 
74 public:
75  static TypeHandle get_class_type() {
76  return _type_handle;
77  }
78  static void init_type() {
79  BulletShape::init_type();
80  register_type(_type_handle, "BulletMinkowskiSumShape",
81  BulletShape::get_class_type());
82  }
83  virtual TypeHandle get_type() const {
84  return get_class_type();
85  }
86  virtual TypeHandle force_init_type() {
87  init_type();
88  return get_class_type();
89  }
90 
91 private:
92  static TypeHandle _type_handle;
93 };
94 
96 
97 #endif // __BULLET_MINKOWSKI_SUM_SHAPE_H__
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DatagramIterator
A class to retrieve the individual data elements previously stored in a Datagram.
Definition: datagramIterator.h:27
TypedWritable::complete_pointers
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
Definition: typedWritable.cxx:81
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
BamReader
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
BamWriter
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
bulletMinkowskiSumShape.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bullet_includes.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypedWritable
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
Datagram
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
BulletShape
Definition: bulletShape.h:27
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
TypedWritable::require_fully_complete
virtual bool require_fully_complete() const
Some objects require all of their nested pointers to have been completed before the objects themselve...
Definition: typedWritable.cxx:92
FactoryParams
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
transformState.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypedWritable::write_datagram
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition: typedWritable.cxx:54
bullet_utils.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TransformState
Indicates a coordinate-system transform on vertices.
Definition: transformState.h:54
plist
This is our own Panda specialization on the default STL list.
Definition: plist.h:35
BulletMinkowskiSumShape
Definition: bulletMinkowskiSumShape.h:28
bulletShape.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypedWritable::fillin
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...
Definition: typedWritable.cxx:103