Panda3D
|
00001 // Filename: bulletAllHitsRayResult.h 00002 // Created by: enn0x (21Feb10) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef __BULLET_ALL_HITS_RAY_RESULT_H__ 00016 #define __BULLET_ALL_HITS_RAY_RESULT_H__ 00017 00018 #include "pandabase.h" 00019 00020 #include "bullet_includes.h" 00021 #include "bullet_utils.h" 00022 00023 #include "luse.h" 00024 #include "pandaNode.h" 00025 #include "collideMask.h" 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Class : BulletRayHit 00029 // Description : 00030 //////////////////////////////////////////////////////////////////// 00031 struct BulletRayHit { 00032 00033 PUBLISHED: 00034 INLINE static BulletRayHit empty(); 00035 00036 PandaNode *get_node() const; 00037 LPoint3 get_hit_pos() const; 00038 LVector3 get_hit_normal() const; 00039 PN_stdfloat get_hit_fraction() const; 00040 00041 private: 00042 btCollisionObject *_object; 00043 btVector3 _normal; 00044 btVector3 _pos; 00045 btScalar _fraction; 00046 00047 friend struct BulletAllHitsRayResult; 00048 }; 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Class : BulletAllHitsRayResult 00052 // Description : 00053 //////////////////////////////////////////////////////////////////// 00054 struct EXPCL_PANDABULLET BulletAllHitsRayResult : public btCollisionWorld::AllHitsRayResultCallback { 00055 00056 PUBLISHED: 00057 INLINE static BulletAllHitsRayResult empty(); 00058 00059 LPoint3 get_from_pos() const; 00060 LPoint3 get_to_pos() const; 00061 00062 bool has_hits() const; 00063 PN_stdfloat get_closest_hit_fraction() const; 00064 00065 int get_num_hits() const; 00066 const BulletRayHit get_hit(int idx) const; 00067 MAKE_SEQ(get_hits, get_num_hits, get_hit); 00068 00069 public: 00070 virtual bool needsCollision(btBroadphaseProxy* proxy0) const; 00071 00072 private: 00073 BulletAllHitsRayResult(const btVector3 &from_pos, const btVector3 &to_pos, const CollideMask &mask); 00074 00075 CollideMask _mask; 00076 00077 friend class BulletWorld; 00078 }; 00079 00080 #include "bulletAllHitsRayResult.I" 00081 00082 #endif // __BULLET_ALL_HITS_RAY_RESULT_H__