mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-20 04:30:12 +02:00
Initial Prey Game integration support.
This commit is contained in:
@@ -0,0 +1,165 @@
|
||||
// Copyright (C) 2004 Id Software, Inc.
|
||||
//
|
||||
|
||||
#ifndef __GAME_IK_H__
|
||||
#define __GAME_IK_H__
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
IK base class with a simple fast two bone solver.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
#define IK_ANIM "ik_pose"
|
||||
|
||||
class idIK {
|
||||
public:
|
||||
idIK( void );
|
||||
virtual ~idIK( void );
|
||||
|
||||
void Save( idSaveGame *savefile ) const;
|
||||
void Restore( idRestoreGame *savefile );
|
||||
|
||||
bool IsInitialized( void ) const;
|
||||
|
||||
virtual bool Init( idEntity *self, const char *anim, const idVec3 &modelOffset );
|
||||
virtual void Evaluate( void );
|
||||
virtual void ClearJointMods( void );
|
||||
|
||||
bool SolveTwoBones( const idVec3 &startPos, const idVec3 &endPos, const idVec3 &dir, float len0, float len1, idVec3 &jointPos );
|
||||
float GetBoneAxis( const idVec3 &startPos, const idVec3 &endPos, const idVec3 &dir, idMat3 &axis );
|
||||
|
||||
protected:
|
||||
bool initialized;
|
||||
bool ik_activate;
|
||||
idEntity * self; // entity using the animated model
|
||||
idAnimator * animator; // animator on entity
|
||||
int modifiedAnim; // animation modified by the IK
|
||||
idVec3 modelOffset;
|
||||
// HUMANHEAD nla - Fixes IK big with changing normals
|
||||
idVec3 normalPrev;
|
||||
// HUMANHEAD END
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
IK controller for a walking character with an arbitrary number of legs.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
class idIK_Walk : public idIK {
|
||||
public:
|
||||
|
||||
idIK_Walk( void );
|
||||
virtual ~idIK_Walk( void );
|
||||
|
||||
void Save( idSaveGame *savefile ) const;
|
||||
void Restore( idRestoreGame *savefile );
|
||||
|
||||
virtual bool Init( idEntity *self, const char *anim, const idVec3 &modelOffset );
|
||||
virtual void Evaluate( void );
|
||||
virtual void ClearJointMods( void );
|
||||
|
||||
void EnableAll( void );
|
||||
void DisableAll( void );
|
||||
void EnableLeg( int num );
|
||||
void DisableLeg( int num );
|
||||
|
||||
void InvalidateHeights(void) { oldHeightsValid = false; } //HUMANHEAD rww
|
||||
|
||||
virtual bool IsActivated() { return ( enabledLegs != 0 ) ? true : false; } //HUMANHEAD jsh
|
||||
private:
|
||||
static const int MAX_LEGS = 8;
|
||||
|
||||
idClipModel * footModel;
|
||||
|
||||
int numLegs;
|
||||
int enabledLegs;
|
||||
jointHandle_t footJoints[MAX_LEGS];
|
||||
jointHandle_t ankleJoints[MAX_LEGS];
|
||||
jointHandle_t kneeJoints[MAX_LEGS];
|
||||
jointHandle_t hipJoints[MAX_LEGS];
|
||||
jointHandle_t dirJoints[MAX_LEGS];
|
||||
jointHandle_t waistJoint;
|
||||
|
||||
idVec3 hipForward[MAX_LEGS];
|
||||
idVec3 kneeForward[MAX_LEGS];
|
||||
|
||||
float upperLegLength[MAX_LEGS];
|
||||
float lowerLegLength[MAX_LEGS];
|
||||
|
||||
idMat3 upperLegToHipJoint[MAX_LEGS];
|
||||
idMat3 lowerLegToKneeJoint[MAX_LEGS];
|
||||
|
||||
float smoothing;
|
||||
float waistSmoothing;
|
||||
float footShift;
|
||||
float waistShift;
|
||||
float minWaistFloorDist;
|
||||
float minWaistAnkleDist;
|
||||
float footUpTrace;
|
||||
float footDownTrace;
|
||||
bool tiltWaist;
|
||||
bool usePivot;
|
||||
|
||||
// state
|
||||
int pivotFoot;
|
||||
float pivotYaw;
|
||||
idVec3 pivotPos;
|
||||
bool oldHeightsValid;
|
||||
float oldWaistHeight;
|
||||
float oldAnkleHeights[MAX_LEGS];
|
||||
idVec3 waistOffset;
|
||||
|
||||
int lastFrame; // HUMANHEAD mdl: Last frame Evaluate() was called
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
IK controller for reaching a position with an arm or leg.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
class idIK_Reach : public idIK {
|
||||
public:
|
||||
|
||||
idIK_Reach( void );
|
||||
virtual ~idIK_Reach( void );
|
||||
|
||||
void Save( idSaveGame *savefile ) const;
|
||||
void Restore( idRestoreGame *savefile );
|
||||
|
||||
virtual bool Init( idEntity *self, const char *anim, const idVec3 &modelOffset );
|
||||
virtual void Evaluate( void );
|
||||
virtual void ClearJointMods( void );
|
||||
|
||||
private:
|
||||
|
||||
static const int MAX_ARMS = 2;
|
||||
|
||||
int numArms;
|
||||
int enabledArms;
|
||||
jointHandle_t handJoints[MAX_ARMS];
|
||||
jointHandle_t elbowJoints[MAX_ARMS];
|
||||
jointHandle_t shoulderJoints[MAX_ARMS];
|
||||
jointHandle_t dirJoints[MAX_ARMS];
|
||||
|
||||
idVec3 shoulderForward[MAX_ARMS];
|
||||
idVec3 elbowForward[MAX_ARMS];
|
||||
|
||||
float upperArmLength[MAX_ARMS];
|
||||
float lowerArmLength[MAX_ARMS];
|
||||
|
||||
idMat3 upperArmToShoulderJoint[MAX_ARMS];
|
||||
idMat3 lowerArmToElbowJoint[MAX_ARMS];
|
||||
};
|
||||
|
||||
#endif /* !__GAME_IK_H__ */
|
||||
Reference in New Issue
Block a user