Panda3D
bulletPlaneShape.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 bulletPlaneShape.h
10  * @author enn0x
11  * @date 2010-01-23
12  */
13 
14 #ifndef __BULLET_PLANE_SHAPE_H__
15 #define __BULLET_PLANE_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 "collisionPlane.h"
24 #include "luse.h"
25 
26 /**
27  *
28  */
29 class EXPCL_PANDABULLET BulletPlaneShape : public BulletShape {
30 private:
31  // Only used by make_from_bam
32  INLINE BulletPlaneShape() : _shape(nullptr) {};
33 
34 PUBLISHED:
35  explicit BulletPlaneShape(LPlane plane);
36  explicit BulletPlaneShape(const LVector3 &normal, PN_stdfloat constant);
38  INLINE ~BulletPlaneShape();
39 
40  LPlane get_plane() const;
41  LVector3 get_plane_normal() const;
42  PN_stdfloat get_plane_constant() const;
43 
44  static BulletPlaneShape *make_from_solid(const CollisionPlane *solid);
45 
46  MAKE_PROPERTY(plane, get_plane);
47  MAKE_PROPERTY(plane_normal, get_plane_normal);
48  MAKE_PROPERTY(plane_constant, get_plane_constant);
49 
50 public:
51  virtual btCollisionShape *ptr() const;
52 
53 private:
54  btStaticPlaneShape *_shape;
55 
56 public:
57  static void register_with_read_factory();
58  virtual void write_datagram(BamWriter *manager, Datagram &dg);
59 
60 protected:
61  static TypedWritable *make_from_bam(const FactoryParams &params);
62  void fillin(DatagramIterator &scan, BamReader *manager);
63 
64 public:
65  static TypeHandle get_class_type() {
66  return _type_handle;
67  }
68  static void init_type() {
69  BulletShape::init_type();
70  register_type(_type_handle, "BulletPlaneShape",
71  BulletShape::get_class_type());
72  }
73  virtual TypeHandle get_type() const {
74  return get_class_type();
75  }
76  virtual TypeHandle force_init_type() {
77  init_type();
78  return get_class_type();
79  }
80 
81 private:
82  static TypeHandle _type_handle;
83 };
84 
85 #include "bulletPlaneShape.I"
86 
87 #endif // __BULLET_PLANE_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.
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.
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.
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.
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.