GlPortal Class Reference  0.1.1
Source code documentation of the free and open 3D action puzzle game.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Portal.hpp
Go to the documentation of this file.
1 #ifndef PORTAL_HPP
2 #define PORTAL_HPP
3 
4 #include <memory>
5 #include <bullet/BulletCollision/btBulletCollisionCommon.h>
6 
12 
13 namespace glPortal {
14 
15 class Portal : public radix::Component {
16 public:
17  static const int PORTAL_RANGE;
20  static const double NOISE_FADE_DELAY;
21  static const double OPEN_ANIM_DURATION;
22  static const float SURFACE_OFFSET;
23 
24  Portal(radix::Entity &ent);
25  ~Portal();
27 
28  void placeOnWall(const radix::Vector3f &launchPos, const radix::Vector3f &point, const radix::Vector3f &normal);
29 
31 
33  double openSince;
36  bool open;
37  bool isUncolliderActive = false;
38  std::unique_ptr<btDefaultMotionState> uncolliderMotionState;
39  std::unique_ptr<btCollisionShape> uncolliderShape;
40  std::unique_ptr<btCollisionObject> uncollider;
41  struct Wrapper {
42  std::unique_ptr<btCollisionShape> vertShape, horzShape;
43  struct Side {
44  std::unique_ptr<btRigidBody> body;
45  std::unique_ptr<btDefaultMotionState> motionState;
46  } top, right, bottom, left;
47  } wrapper;
48 
49 private:
50  // TODO: move this to PortalSystem v
51  void placeWrapperPiece(const radix::Vector3f &p, const radix::Quaternion &o, const radix::Vector3f &s,
52  const std::unique_ptr<btCollisionShape> &shape, Wrapper::Side &side, const radix::Vector3f &offset);
53 };
54 
55 } /* namespace glPortal */
56 
57 #endif /* PORTAL_HPP */
std::unique_ptr< btDefaultMotionState > motionState
Definition: Portal.hpp:45
struct glPortal::Portal::Wrapper::Side right
struct glPortal::Portal::Wrapper wrapper
std::unique_ptr< btCollisionObject > uncollider
Definition: Portal.hpp:40
std::unique_ptr< btCollisionShape > vertShape
Definition: Portal.hpp:42
static const radix::Vector3f BLUE_COLOR
Definition: Portal.hpp:18
radix::Vector3f getDirection() const
radix::Vector3f getScaleMult() const
radix::Vector3f color
Definition: Portal.hpp:35
Definition: Portal.hpp:41
void placeOnWall(const radix::Vector3f &launchPos, const radix::Vector3f &point, const radix::Vector3f &normal)
ECS entity, Component container It is created like this:
Definition: Entity.hpp:23
Definition: Screen.hpp:10
Definition: Vector4f.hpp:117
void placeWrapperPiece(const radix::Vector3f &p, const radix::Quaternion &o, const radix::Vector3f &s, const std::unique_ptr< btCollisionShape > &shape, Wrapper::Side &side, const radix::Vector3f &offset)
Definition: Portal.hpp:15
static const double OPEN_ANIM_DURATION
Definition: Portal.hpp:21
radix::Material maskTex
Definition: Portal.hpp:32
Base class to create entity components.
Definition: Component.hpp:25
static const radix::Vector3f ORANGE_COLOR
Definition: Portal.hpp:19
struct glPortal::Portal::Wrapper::Side bottom
radix::Mesh stencilMesh
Definition: Portal.hpp:34
double openSince
Definition: Portal.hpp:33
radix::Vector3f direction
Definition: Portal.hpp:35
struct glPortal::Portal::Wrapper::Side left
static const float SURFACE_OFFSET
Definition: Portal.hpp:22
std::unique_ptr< btDefaultMotionState > uncolliderMotionState
Definition: Portal.hpp:38
static const double NOISE_FADE_DELAY
Definition: Portal.hpp:20
std::unique_ptr< btCollisionShape > uncolliderShape
Definition: Portal.hpp:39
std::unique_ptr< btCollisionShape > horzShape
Definition: Portal.hpp:42
radix::Material overlayTex
Definition: Portal.hpp:32
Definition: Mesh.hpp:10
struct glPortal::Portal::Wrapper::Side top
static const int PORTAL_RANGE
Definition: Portal.hpp:17
bool open
Definition: Portal.hpp:36
bool isUncolliderActive
Definition: Portal.hpp:37
3-dimensional float-based vector/point storage and manipulation struct
Definition: Vector3f.hpp:27
radix::Mesh overlayMesh
Definition: Portal.hpp:34
Portal(radix::Entity &ent)
std::unique_ptr< btRigidBody > body
Definition: Portal.hpp:44
Definition: Portal.hpp:43
Definition: Material.hpp:11