hkpProcessCollisionData.h
上传用户:yisoukefu
上传日期:2020-08-09
资源大小:39506k
文件大小:4k
源码类别:

其他游戏

开发平台:

Visual C++

  1. /* 
  2.  * 
  3.  * Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
  4.  * prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
  5.  * Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
  6.  * 
  7.  */
  8. #ifndef HK_COLLIDE2_PROCESS_COLLISION_DATA_H
  9. #define HK_COLLIDE2_PROCESS_COLLISION_DATA_H
  10. #include <Physics/Collide/Agent/hkpProcessCdPoint.h>
  11. #include <Common/Base/Types/Physics/ContactPoint/hkContactPointMaterial.h>
  12. #include <Physics/Internal/Collide/Gjk/hkpGskCache.h>
  13. #include <Physics/ConstraintSolver/Constraint/Contact/hkpContactPointProperties.h>
  14. /// An array of collision contact points. This class is used internally by hkdynamics to pass collision detection
  15. /// information from the collision detector to the constraint solver.
  16. enum {HK_MAX_CONTACT_POINT = 256 };
  17. struct hkpAgentEntry;
  18. #ifndef hkCollisionConstraintOwner
  19. class hkpConstraintOwner;
  20. # define hkCollisionConstraintOwner hkpConstraintOwner
  21. #endif
  22. /// This is the output data of the collision detector (plus the contact point added/removed events).
  23. /// This class holds all contact points as well as continuous information (TOI = Time Of Impact)
  24. /// As the hkContactPointInfo or hkpContactPointProperties are part of hkDynamics they can't be part of this structure.
  25. struct hkpProcessCollisionData
  26. {
  27. public:
  28. HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR(HK_MEMORY_CLASS_AGENT, hkpProcessCollisionData);
  29. /// Get the number of contact points
  30. inline int getNumContactPoints() const;
  31. /// Get the contact point at index i
  32. inline hkpProcessCdPoint& getContactPoint( int i );
  33. /// Get a pointer to the first contact point of the contact point array
  34. inline hkpProcessCdPoint* getFirstContactPoint();
  35. /// Get a pointer to the end of the used contact point array
  36. inline hkpProcessCdPoint* getEnd();
  37. /// returns true if there are no contact points
  38. inline hkBool isEmpty() const;
  39. /// returns true if a toi was created between this pair of objects
  40. inline hkBool hasToi() const;
  41. /// get access to the toi contact point
  42. inline hkContactPoint& getToiContactPoint();
  43. /// returns the toi
  44. inline hkTime getToi() const;
  45. /// returns access to the toi contact point properties
  46. inline hkpContactPointProperties& getToiProperties();
  47. public:
  48. /// A pointer to the first point in the m_contactPoints which is not used yet
  49. hkPadSpu<hkpProcessCdPoint*> m_firstFreeContactPoint;
  50. hkPadSpu<hkCollisionConstraintOwner*> m_constraintOwner;
  51. /// A buffer for all contact points, used up to m_firstFreeContactPoint
  52. hkpProcessCdPoint   m_contactPoints[HK_MAX_CONTACT_POINT];
  53. //
  54. // toi info
  55. //
  56. struct ToiInfo
  57. {
  58. public:
  59. HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_COLLIDE, hkpProcessCollisionData::ToiInfo );
  60. inline ToiInfo();
  61. // exchanges A-B
  62. inline void flip();
  63. public:
  64. /// An optional toi contact point, valid if m_toi < HK_REAL_MAX
  65. hkContactPoint     m_contactPoint;
  66. /// The toi
  67. hkPadSpu<hkReal>   m_time;
  68. /// The separating velocity of the objects at the toi
  69. hkPadSpu<hkReal>      m_seperatingVelocity;
  70. hkGskCache16 m_gskCache;
  71. /// The material which is going to be used by the toi handler
  72. hkContactPointPropertiesWithExtendedUserData16 m_properties;
  73. };
  74. struct ToiInfo m_toi;
  75. inline hkpProcessCollisionData( hkCollisionConstraintOwner* owner );
  76. };
  77. #include <Physics/Collide/Agent/hkpProcessCollisionData.inl>
  78. #endif // HK_COLLIDE2_PROCESS_COLLISION_DATA_H
  79. /*
  80. * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20090216)
  81. * Confidential Information of Havok.  (C) Copyright 1999-2009
  82. * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
  83. * Logo, and the Havok buzzsaw logo are trademarks of Havok.  Title, ownership
  84. * rights, and intellectual property rights in the Havok software remain in
  85. * Havok and/or its suppliers.
  86. * Use of this software for evaluation purposes is subject to and indicates
  87. * acceptance of the End User licence Agreement for this product. A copy of
  88. * the license is included with this software and is also available at www.havok.com/tryhavok.
  89. */