Panda3D
bulletBoxShape.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 bulletBoxShape.h
10  * @author enn0x
11  * @date 2010-01-24
12  */
13 
14 #ifndef __BULLET_BOX_SHAPE_H__
15 #define __BULLET_BOX_SHAPE_H__
16 
17 #include "pandabase.h"
18 
19 #include "bullet_includes.h"
20 #include "bulletShape.h"
21 
22 #include "luse.h"
23 
24 #include "collisionBox.h"
25 
26 /**
27  *
28  */
29 class EXPCL_PANDABULLET BulletBoxShape : public BulletShape {
30 private:
31  // Only used by make_from_bam
32  INLINE BulletBoxShape();
33 
34 PUBLISHED:
35  explicit BulletBoxShape(const LVecBase3 &halfExtents);
36  BulletBoxShape(const BulletBoxShape &copy);
37  INLINE ~BulletBoxShape();
38 
39  LVecBase3 get_half_extents_without_margin() const;
40  LVecBase3 get_half_extents_with_margin() const;
41 
42  static BulletBoxShape *make_from_solid(const CollisionBox *solid);
43 
44  MAKE_PROPERTY(half_extents_with_margin, get_half_extents_with_margin);
45  MAKE_PROPERTY(half_extents_without_margin, get_half_extents_without_margin);
46 
47 public:
48  virtual btCollisionShape *ptr() const;
49 
50 private:
51  btBoxShape *_shape;
52  LVecBase3 _half_extents;
53 
54 public:
55  static void register_with_read_factory();
56  virtual void write_datagram(BamWriter *manager, Datagram &dg);
57 
58 protected:
59  static TypedWritable *make_from_bam(const FactoryParams &params);
60  void fillin(DatagramIterator &scan, BamReader *manager);
61 
62 public:
63  static TypeHandle get_class_type() {
64  return _type_handle;
65  }
66  static void init_type() {
67  BulletShape::init_type();
68  register_type(_type_handle, "BulletBoxShape",
69  BulletShape::get_class_type());
70  }
71  virtual TypeHandle get_type() const {
72  return get_class_type();
73  }
74  virtual TypeHandle force_init_type() {
75  init_type();
76  return get_class_type();
77  }
78 
79 private:
80  static TypeHandle _type_handle;
81 };
82 
83 #include "bulletBoxShape.I"
84 
85 #endif // __BULLET_BOX_SHAPE_H__
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A cuboid collision volume or object.
Definition: collisionBox.h:27
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
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...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
Definition: factoryParams.h:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class to retrieve the individual data elements previously stored in a Datagram.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38