Skip to content

Commit

Permalink
phys::Constraint work
Browse files Browse the repository at this point in the history
  • Loading branch information
hytopoulos committed Jun 1, 2023
1 parent 4ea2d88 commit e3ccab6
Show file tree
Hide file tree
Showing 10 changed files with 603 additions and 32 deletions.
40 changes: 20 additions & 20 deletions data/uking_functions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -82486,32 +82486,32 @@ Address,Quality,Size,Name
0x0000007100f69d2c,U,000004,nullsub_4196
0x0000007100f69d30,U,000004,nullsub_4197
0x0000007100f69d34,U,000004,nullsub_4198
0x0000007100f69d38,U,000180,Constraint::ctor
0x0000007100f69d38,M,000180,_ZN4ksys4phys10ConstraintC1EP21hkpConstraintInstancePNS0_9RigidBodyES5_P13hkQuaternionfPv
0x0000007100f69dec,U,000376,Constraint::dtor
0x0000007100f69f64,U,000036,Constraint::dtorDelete
0x0000007100f69f88,U,000036,getPhysicsMemSysField190Or
0x0000007100f69fac,U,000044,
0x0000007100f69fd8,U,000024,
0x0000007100f69ff0,U,000132,
0x0000007100f6a074,U,000136,
0x0000007100f6a0fc,U,000132,
0x0000007100f6a180,U,000088,Constraint::x
0x0000007100f6a1d8,U,000068,
0x0000007100f6a21c,U,000012,
0x0000007100f6a228,U,000184,
0x0000007100f6a2e0,U,000032,
0x0000007100f6a300,U,000372,
0x0000007100f6a474,U,000340,
0x0000007100f6a5c8,U,000212,
0x0000007100f6a69c,U,000092,
0x0000007100f6a6f8,U,000372,
0x0000007100f69ff0,O,000132,_ZN4ksys4phys10Constraint14sub_7100F69FF0Ev
0x0000007100f6a074,O,000136,_ZN4ksys4phys10Constraint14sub_7100F6A074Ev
0x0000007100f6a0fc,O,000132,_ZN4ksys4phys10Constraint20setConstraintWeightsEff
0x0000007100f6a180,O,000088,_ZN4ksys4phys10Constraint23allocConstraintListenerEPN4sead4HeapE
0x0000007100f6a1d8,O,000068,_ZN4ksys4phys10Constraint12unlinkIf2SetEv
0x0000007100f6a21c,O,000012,_ZN4ksys4phys10Constraint6unlinkEv
0x0000007100f6a228,m,000184,_ZN4ksys4phys10Constraint4wakeEv
0x0000007100f6a2e0,O,000032,_ZNK4ksys4phys10Constraint15checkIsSleepingEv
0x0000007100f6a300,O,000372,_ZN4ksys4phys10Constraint12setRigidBodyEPNS0_9RigidBodyES3_
0x0000007100f6a474,m,000340,_ZN4ksys4phys10Constraint10addToWorldEb
0x0000007100f6a5c8,m,000212,_ZN4ksys4phys10Constraint8calcMassEv
0x0000007100f6a69c,O,000092,_ZN4ksys4phys10Constraint14clearRigidBodyENS1_15ConstrainedTypeE
0x0000007100f6a6f8,m,000372,_ZN4ksys4phys10Constraint23unlinkConstrainedBodiesEbb
0x0000007100f6a86c,O,000020,_ZN4ksys4phys10Constraint7destroyEPS1_
0x0000007100f6a880,U,000012,
0x0000007100f6a88c,U,000160,
0x0000007100f6a92c,U,000168,
0x0000007100f6a9d4,U,000208,
0x0000007100f6aaa4,U,000308,
0x0000007100f6abd8,U,000044,Constraint::x_0
0x0000007100f6a880,O,000012,_ZNK4ksys4phys10Constraint10isFlag2SetEv
0x0000007100f6a88c,O,000160,_ZN4ksys4phys10Constraint10initParentEPNS0_9RigidBodyE
0x0000007100f6a92c,O,000168,_ZN4ksys4phys10Constraint9initChildEPNS0_9RigidBodyE
0x0000007100f6a9d4,O,000208,_ZN4ksys4phys10Constraint13initWithGroupEPNS0_28StaticCompoundRigidBodyGroupE
0x0000007100f6aaa4,m,000308,_ZN4ksys4phys10Constraint10initBodiesEPNS0_9RigidBodyES3_
0x0000007100f6abd8,W,000044,_ZNK4ksys4phys10Constraint12getRigidBodyEi
0x0000007100f6ac04,U,000092,
0x0000007100f6ac60,U,000008,
0x0000007100f6ac68,U,000064,
Expand Down
8 changes: 4 additions & 4 deletions lib/hkStubs/Havok/Physics/Constraint/Data/hkpConstraintInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ struct hkpConstraintInfo {
int m_maxSizeOfSchema;
int m_sizeOfSchemas;
int m_numSolverResults;
int m_numSolverElemTemps;
int m_numSolverElemActiveBodiess;
};

inline void hkpConstraintInfo::add(int schemaSize, int numSolverResults, int numSolverTempElems) {
m_sizeOfSchemas += schemaSize;
m_numSolverResults += numSolverResults;
m_numSolverElemTemps += numSolverTempElems;
m_numSolverElemActiveBodiess += numSolverTempElems;
}

inline void hkpConstraintInfo::add(const hkpConstraintInfo& delta) {
m_maxSizeOfSchema = hkMath::max2(m_maxSizeOfSchema, delta.m_maxSizeOfSchema);
m_maxSizeOfSchema = hkMath::max2(m_maxSizeOfSchema, delta.m_sizeOfSchemas);
m_sizeOfSchemas += delta.m_sizeOfSchemas;
m_numSolverResults += delta.m_numSolverResults;
m_numSolverElemTemps += delta.m_numSolverElemTemps;
m_numSolverElemActiveBodiess += delta.m_numSolverElemActiveBodiess;
}

inline void hkpConstraintInfo::sub(const hkpConstraintInfo& delta) {
m_sizeOfSchemas -= delta.m_sizeOfSchemas;
m_numSolverResults -= delta.m_numSolverResults;
m_numSolverElemTemps -= delta.m_numSolverElemTemps;
m_numSolverElemActiveBodiess -= delta.m_numSolverElemActiveBodiess;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#pragma once

#include <Havok/Common/Base/Types/hkBaseTypes.h>

class hkpConstraintInstance;
class hkpWorld;

struct hkpConstraintBrokenEvent {
enum EventSource {
EVENT_SOURCE_UNKNOWN,
EVENT_SOURCE_BREAKABLE_CONSTRAINT,
EVENT_SOURCE_FLEXIBLE_JOINT,
};

hkpConstraintBrokenEvent(hkpWorld* world, hkpConstraintInstance* i, EventSource es)
: m_world(world), m_constraintInstance(i), m_eventSource(es), m_eventSourceDetails(0),
m_constraintBroken(true), m_actualImpulse(0.0f), m_impulseLimit(0.0f) {}

hkpWorld* m_world;
hkpConstraintInstance* m_constraintInstance;

hkEnum<EventSource, hkUint8> m_eventSource;
hkUint8 m_eventSourceDetails;
hkBool m_constraintBroken;
hkReal m_actualImpulse;
hkReal m_impulseLimit;
};

class hkpConstraintListener {
public:
virtual ~hkpConstraintListener() {}

virtual void constraintAddedCallback(hkpConstraintInstance* constraint) {}

virtual void constraintRemovedCallback(hkpConstraintInstance* constraint) {}

virtual void constraintDeletedCallback(hkpConstraintInstance* constraint) {}

virtual void constraintBreakingCallback(const hkpConstraintBrokenEvent& event) {}
};
3 changes: 2 additions & 1 deletion src/KingSystem/Physics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ target_sources(uking PRIVATE

Constraint/physConstraint.cpp
Constraint/physConstraint.h
Constraint/physConstraintListener.h

Ragdoll/physRagdollConfig.cpp
Ragdoll/physRagdollConfig.h
Expand Down Expand Up @@ -194,4 +195,4 @@ target_sources(uking PRIVATE
physLayerMaskBuilder.h
physMaterialMask.cpp
physMaterialMask.h
)
)
Loading

0 comments on commit e3ccab6

Please sign in to comment.