⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d3dx9anim.h

📁 vc6.0完整版
💻 H
📖 第 1 页 / 共 3 页
字号:
} D3DXKEY_QUATERNION, *LPD3DXKEY_QUATERNION;


#undef INTERFACE
#define INTERFACE ID3DXKeyFrameInterpolator

//----------------------------------------------------------------------------
// This interface implements an SRT (scale/rotate/translate) interpolator
// It takes a scattered set of keys and interpolates the transform for any
// given time
//----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////
// ID3DXKeyFrameInterpolator /////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
DECLARE_INTERFACE_(ID3DXKeyFrameInterpolator, ID3DXInterpolator)
{
    // IUnknown
    STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
    STDMETHOD_(ULONG, Release)(THIS) PURE;

    // ID3DXInterpolator
    STDMETHOD_(LPCSTR, GetName)(THIS) PURE;
    STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE;

    STDMETHOD(GetSRT)(THIS_ DOUBLE Time, D3DXVECTOR3 *pScale, D3DXQUATERNION *pRotate, D3DXVECTOR3 *pTranslate) PURE;
    STDMETHOD(GetLastSRT)(THIS_ D3DXVECTOR3 *pScale, D3DXQUATERNION *pRotate, D3DXVECTOR3 *pTranslate) PURE;

    // ID3DXKeyFrameInterpolator
    STDMETHOD_(UINT, GetNumScaleKeys)(THIS) PURE;
    STDMETHOD(GetScaleKeys)(THIS_ LPD3DXKEY_VECTOR3 pKeys) PURE;

    STDMETHOD_(UINT, GetNumRotationKeys)(THIS) PURE;
    STDMETHOD(GetRotationKeys)(THIS_ LPD3DXKEY_QUATERNION pKeys) PURE;

    STDMETHOD_(UINT, GetNumTranslationKeys)(THIS) PURE;
    STDMETHOD(GetTranslationKeys)(THIS_ LPD3DXKEY_VECTOR3 pKeys) PURE;

    // the value passed to D3DXCreateKeyFrameInterpolator to scale from the times in LPD3DXKEY_VECTOR3 to global/anim time.
    STDMETHOD_(DOUBLE, GetSourceTicksPerSecond)(THIS) PURE;
};



//----------------------------------------------------------------------------
// This interface implements an set of interpolators. The set consists of
// interpolators for many nodes for the same animation. 
//----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////
// ID3DXAnimationSet /////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
DECLARE_INTERFACE_(ID3DXAnimationSet, IUnknown)
{
    // IUnknown
    STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
    STDMETHOD_(ULONG, Release)(THIS) PURE;

    // ID3DXAnimationSet
    STDMETHOD_(LPCSTR, GetName)(THIS) PURE;
    STDMETHOD_(DOUBLE, GetPeriod)(THIS) PURE;

    STDMETHOD_(UINT, GetNumInterpolators)(THIS) PURE;
    STDMETHOD(GetInterpolatorByIndex)(THIS_ UINT Index, LPD3DXINTERPOLATOR *ppInterpolator) PURE;
    STDMETHOD(GetInterpolatorByName)(THIS_ LPCSTR pName, LPD3DXINTERPOLATOR *ppInterpolator) PURE;
};

//----------------------------------------------------------------------------
// This structure describes an animation track. A track is a combination
//  of an animation set (stored separately) and mixing information.
//  the mixing information consists of the current position, speed, and blending
//  weight for the track.  The Flags field also specifies whether the track
//  is low or high priority.  Tracks with the same priority are blended together
//  and then the two resulting values are blended using the priority blend factor.
//----------------------------------------------------------------------------
typedef struct _D3DXTRACK_DESC
{
    DWORD Flags;
    FLOAT Weight;
    FLOAT Speed;
    BOOL  Enable;
    DOUBLE AnimTime;
} D3DXTRACK_DESC, *LPD3DXTRACK_DESC;

//----------------------------------------------------------------------------
// This enum defines the type of transtion performed on a event that transitions from one value to another
//----------------------------------------------------------------------------
typedef enum _D3DXTRACKFLAG {
    D3DXTF_LOWPRIORITY            = 0x000,     // This track should be blended with all low priority tracks before mixed with the high priority result
    D3DXTF_HIGHPRIORITY           = 0x001,     // This track should be blended with all high priority tracks before mixed with the low priority result

    D3DXTF_FORCE_DWORD    = 0x7fffffff, /* force 32-bit size enum */
} D3DXTRACKFLAG;


//----------------------------------------------------------------------------
// This interface implements the main animation functionality. It connects
// animation sets with the transform frames that are being animated. Allows
// mixing multiple animations for blended animations or for transistions
// It adds also has methods to modify blending parameters over time to 
// enable smooth transistions and other effects.
//----------------------------------------------------------------------------


//----------------------------------------------------------------------------
// This enum defines the type of transtion performed on a event that transitions from one value to another
//----------------------------------------------------------------------------
typedef enum _D3DXTRANSITIONTYPE {
    D3DXTRANSITION_LINEAR            = 0x000,     // Linear transition from one value to the next
    D3DXTRANSITION_EASEINEASEOUT     = 0x001,     // Ease-In Ease-Out spline transtion from one value to the next

    D3DXTRANSITION_FORCE_DWORD    = 0x7fffffff, /* force 32-bit size enum */
} D3DXTRANSITIONTYPE;


//////////////////////////////////////////////////////////////////////////////
// ID3DXAnimationController //////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
DECLARE_INTERFACE_(ID3DXAnimationController, IUnknown)
{
  // IUnknown
    STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
    STDMETHOD_(ULONG, Release)(THIS) PURE;

  // mixing functionality
    // register outputs of SetTime
    STDMETHOD(RegisterMatrix)(THIS_ LPCSTR Name, D3DXMATRIX *pMatrix) PURE;


    // AnimationSets
    STDMETHOD_(UINT, GetNumAnimationSets)(THIS) PURE;
    STDMETHOD(GetAnimationSet)(THIS_ DWORD iAnimationSet, LPD3DXANIMATIONSET *ppAnimSet) PURE;

    STDMETHOD(RegisterAnimationSet)(THIS_ LPD3DXANIMATIONSET pAnimSet) PURE;
    STDMETHOD(UnregisterAnimationSet)(THIS_ LPD3DXANIMATIONSET pAnimSet) PURE;


    // Tracks
    STDMETHOD_(UINT, GetMaxNumTracks)(THIS) PURE;
    STDMETHOD(GetTrackDesc)(THIS_ DWORD Track, D3DXTRACK_DESC *pDesc) PURE;
    STDMETHOD(SetTrackDesc)(THIS_ DWORD Track, D3DXTRACK_DESC *pDesc) PURE;
    
    STDMETHOD(GetTrackAnimationSet)(THIS_ DWORD Track, LPD3DXANIMATIONSET *ppAnimSet) PURE;
    STDMETHOD(SetTrackAnimationSet)(THIS_ DWORD Track, LPD3DXANIMATIONSET pAnimSet) PURE;

    // Individual track field access
    STDMETHOD(SetTrackSpeed)(THIS_ DWORD Track, FLOAT Speed) PURE;
    STDMETHOD(SetTrackWeight)(THIS_ DWORD Track, FLOAT Weight) PURE;
    STDMETHOD(SetTrackAnimTime)(THIS_ DWORD Track, DOUBLE AnimTime) PURE;
    STDMETHOD(SetTrackEnable)(THIS_ DWORD Track, BOOL Enable) PURE;

    // Time
    STDMETHOD_(DOUBLE, GetTime)(THIS) PURE;
    STDMETHOD(SetTime)(THIS_ DOUBLE Time) PURE;

    STDMETHOD(CloneAnimationController)(THIS_ UINT MaxNumMatrices, UINT MaxNumAnimationSets, UINT MaxNumTracks, UINT MaxNumEvents, LPD3DXANIMATIONCONTROLLER *ppAnimController) PURE;

    STDMETHOD_(UINT, GetMaxNumMatrices)(THIS) PURE;
    STDMETHOD_(UINT, GetMaxNumEvents)(THIS) PURE;
    STDMETHOD_(UINT, GetMaxNumAnimationSets)(THIS) PURE;

  // Sequencing abilities
    STDMETHOD(KeyTrackSpeed)(THIS_ DWORD Track, FLOAT NewSpeed, DOUBLE StartTime, DOUBLE Duration, DWORD Method) PURE;
    STDMETHOD(KeyTrackWeight)(THIS_ DWORD Track, FLOAT NewWeight, DOUBLE StartTime, DOUBLE Duration, DWORD Method) PURE;
    STDMETHOD(KeyTrackAnimTime)(THIS_ DWORD Track, DOUBLE NewAnimTime, DOUBLE StartTime) PURE;
    STDMETHOD(KeyTrackEnable)(THIS_ DWORD Track, BOOL NewEnable, DOUBLE StartTime) PURE;

    // this functions sets the blend weight to be used to blend high and low priority tracks together.
    //  NOTE: this has no effect unless there are active animations on tracks for a given matrix that have both high and low results
    STDMETHOD_(FLOAT, GetPriorityBlend)(THIS) PURE;
    STDMETHOD(SetPriorityBlend)(THIS_ FLOAT BlendWeight) PURE;

    STDMETHOD(KeyPriorityBlend)(THIS_ FLOAT NewBlendWeight, DOUBLE StartTime, DOUBLE Duration, DWORD Method) PURE;
};

#ifdef __cplusplus
extern "C" {
#endif //__cplusplus

//----------------------------------------------------------------------------
// D3DXCreateKeyFrameInterpolator:
// -------------------------------
// Creates a SRT key frame interpolator object from the given set of keys
//
// Parameters:
//	ScaleKeys
//		Array of scale key vectors
//	NumScaleKeys
//		Num elements in ScaleKeys array
//	RotationKeys
//		Array of rotation key quternions
//	NumRotationKeys
//		Num elements in RotationKeys array
//	TranslateKeys
//		Array of translation key vectors
//	NumTranslateKeys
//		Num elements in TranslateKeys array
//	ScaleInputTimeBy
//		All key times are scaled by this factor
//	ppNewInterpolator
//		Returns the keyframe interpolator interface
//
//----------------------------------------------------------------------------
HRESULT WINAPI
D3DXCreateKeyFrameInterpolator(LPCSTR Name, 
                            LPD3DXKEY_VECTOR3    ScaleKeys,     UINT NumScaleKeys,
                            LPD3DXKEY_QUATERNION RotationKeys,  UINT NumRotationKeys,
                            LPD3DXKEY_VECTOR3    TranslateKeys, UINT NumTranslateKeys,
                            DOUBLE ScaleInputTimeBy, LPD3DXKEYFRAMEINTERPOLATOR *ppNewInterpolator);

//----------------------------------------------------------------------------
// D3DXCreateAnimationSet:
// -----------------------
// Creates an animtions set interface given a set of interpolators
//
// Parameters:
//	Name
//		Name of the animation set
//	pInterpolators
//		Array of interpolators
//	NumInterpolators
//		Num elements in the pInterpolators array
//	ppAnimSet
//		Returns the animation set interface
//
//-----------------------------------------------------------------------------		
HRESULT WINAPI
D3DXCreateAnimationSet(LPCSTR Name, 
                            LPD3DXINTERPOLATOR *ppInterpolators, UINT NumInterpolators,
                            LPD3DXANIMATIONSET *ppAnimSet);

//----------------------------------------------------------------------------
// D3DXCreateAnimationController:
// -------------------------
// Creates an animtion mixer object
//
// Parameters:
//	MaxNumMatrices
//		The upper limit for the number of matrices that can be animated by the
//		the object
//	MaxNumAnimationSets
//		The upper limit of the number of animation sets that can be played by
//		the object
//	MaxNumTracks
//		The upper limit of the number of animation sets that can be blended at
//		any time.
//	MaxNumEvents
//		The upper limit of the number of outstanding events that can be
//		scheduled at once.
//	ppAnimController
//		Returns the animation controller interface
//
//-----------------------------------------------------------------------------		
HRESULT WINAPI
D3DXCreateAnimationController(UINT MaxNumMatrices, UINT MaxNumAnimationSets, UINT MaxNumTracks, UINT MaxNumEvents,
                                 LPD3DXANIMATIONCONTROLLER *ppAnimController);

#ifdef __cplusplus
}
#endif //__cplusplus

#endif //__D3DX9ANIM_H__


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -