Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
4.7 KiB

  1. //====== Copyright � 1996-2004, Valve Corporation, All rights reserved. =====//
  2. //
  3. // Dme $collisionjoints
  4. //
  5. //===========================================================================//
  6. #include "datamodel/dmelementfactoryhelper.h"
  7. #include "mdlobjects/dmecollisionjoints.h"
  8. // memdbgon must be the last include file in a .cpp file!!!
  9. #include "tier0/memdbgon.h"
  10. //===========================================================================
  11. // Expose DmeJointConstrain class to the scene database
  12. //===========================================================================
  13. IMPLEMENT_ELEMENT_FACTORY( DmeJointConstrain, CDmeJointConstrain );
  14. //-----------------------------------------------------------------------------
  15. //
  16. //-----------------------------------------------------------------------------
  17. void CDmeJointConstrain::OnConstruction()
  18. {
  19. m_nType.InitAndSet( this, "type", 1 ); // 0: Free, 1: Fixed, 2: Limit
  20. m_aLimitMin.Init( this, "minAngle" );
  21. m_aLimitMax.Init( this, "maxAngle" );
  22. m_flFriction.Init( this, "friction" );
  23. }
  24. //-----------------------------------------------------------------------------
  25. //
  26. //-----------------------------------------------------------------------------
  27. void CDmeJointConstrain::OnDestruction()
  28. {
  29. }
  30. //-----------------------------------------------------------------------------
  31. //
  32. //-----------------------------------------------------------------------------
  33. void CDmeJointConstrain::OnAttributeChanged( CDmAttribute *pAttribute )
  34. {
  35. // Limit "type" to [0:2]
  36. // TODO: Check for recursive behavior
  37. if ( pAttribute == m_nType.GetAttribute() )
  38. {
  39. m_nType.Set( clamp( m_nType.Get(), 0, 2 ) );
  40. }
  41. }
  42. //===========================================================================
  43. // Expose DmeJointAnimatedFriction class to the scene database
  44. //===========================================================================
  45. IMPLEMENT_ELEMENT_FACTORY( DmeJointAnimatedFriction, CDmeJointAnimatedFriction );
  46. //-----------------------------------------------------------------------------
  47. //
  48. //-----------------------------------------------------------------------------
  49. void CDmeJointAnimatedFriction::OnConstruction()
  50. {
  51. m_nMinFriction.InitAndSet( this, "minFriction", 1.0f );
  52. m_nMaxFriction.InitAndSet( this, "maxFriction", 1.0f );
  53. m_tTimeIn.Init( this, "timeIn" );
  54. m_tTimeHold.Init( this, "timeHold" );
  55. m_tTimeOut.Init( this, "timeOut" );
  56. }
  57. //-----------------------------------------------------------------------------
  58. //
  59. //-----------------------------------------------------------------------------
  60. void CDmeJointAnimatedFriction::OnDestruction()
  61. {
  62. }
  63. //===========================================================================
  64. // Expose DmeCollisionJoint class to the scene database
  65. //===========================================================================
  66. IMPLEMENT_ELEMENT_FACTORY( DmeCollisionJoint, CDmeCollisionJoint );
  67. //-----------------------------------------------------------------------------
  68. //
  69. //-----------------------------------------------------------------------------
  70. void CDmeCollisionJoint::OnConstruction()
  71. {
  72. m_flMassBias.InitAndSet( this, "massBias", 1.0f );
  73. m_flDamping.InitAndSet( this, "damping", 0.0f );
  74. m_flRotDamping.InitAndSet( this, "rotationalDamping", 0.0f );
  75. m_flInertia.InitAndSet( this, "inertia", 1.0f );
  76. m_ConstrainX.Init( this, "constrainX" );
  77. m_ConstrainY.Init( this, "constrainY" );
  78. m_ConstrainZ.Init( this, "constrainZ" );
  79. m_JointMergeList.Init( this, "jointMergeList" );
  80. m_JointCollideList.Init( this, "jointCollideList" );
  81. }
  82. //-----------------------------------------------------------------------------
  83. //
  84. //-----------------------------------------------------------------------------
  85. void CDmeCollisionJoint::OnDestruction()
  86. {
  87. }
  88. //===========================================================================
  89. // Expose DmeKeyValueString class to the scene database
  90. //===========================================================================
  91. IMPLEMENT_ELEMENT_FACTORY( DmeCollisionJoints, CDmeCollisionJoints );
  92. //-----------------------------------------------------------------------------
  93. //
  94. //-----------------------------------------------------------------------------
  95. void CDmeCollisionJoints::OnConstruction()
  96. {
  97. m_bConcavePerJoint.InitAndSet( this, "concavePerJoint", false );
  98. m_bSelfCollisions.InitAndSet( this, "selfCollisions", true );
  99. m_bBoneFollower.InitAndSet( this, "boneFollower", false );
  100. m_RootBone.Init( this, "rootBone" );
  101. m_AnimatedFriction.Init( this, "animatedFriction" );
  102. m_JointSkipList.Init( this, "jointSkipList" );
  103. m_JointList.Init( this, "jointList" );
  104. }
  105. //-----------------------------------------------------------------------------
  106. //
  107. //-----------------------------------------------------------------------------
  108. void CDmeCollisionJoints::OnDestruction()
  109. {
  110. }