summaryrefslogtreecommitdiffstats
path: root/rwsdk/include/d3d8/rpmorph.h
blob: 52ea70df069bad28a9f317228d5106b6aad7052f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137

/******************************************/
/*                                        */
/*    RenderWare(TM) Graphics Library     */
/*                                        */
/******************************************/

/*
 * This file is a product of Criterion Software Ltd.
 *
 * This file is provided as is with no warranties of any kind and is
 * provided without any obligation on Criterion Software Ltd.
 * or Canon Inc. to assist in its use or modification.
 *
 * Criterion Software Ltd. and Canon Inc. will not, under any
 * circumstances, be liable for any lost revenue or other damages
 * arising from the use of this file.
 *
 * Copyright (c) 1998. Criterion Software Ltd.
 * All Rights Reserved.
 */


/****************************************************************************
 *                                                                         
 * Morph animation controller
 * Copyright (C) 1998 Criterion Technologies
 *
 * Module  : rpmorph.h
 *                                                                         
 * Purpose : Functions for controlling morph target animation
 *                                                                         
 ****************************************************************************/

#ifndef RPMORPH_H
#define RPMORPH_H


/**
 * \defgroup rpmorph RpMorph
 * \ingroup morphing
 *
 * Morphing Plugin for RenderWare Graphics.
 */

/****************************************************************************
 Includes
 */

#include "rwcore.h"
#include "rpworld.h"

#include "rpmorph.rpe"    /* automatically generated header file */

/****************************************************************************
 Global Types
 */
typedef struct RpMorphInterpolator RpMorphInterpolator;

/**
 * \ingroup rpmorph
 * \struct RpMorphInterpolator
 * structure describing morph interpolator
 */
struct RpMorphInterpolator
{
    RwInt32  flags; /**< flags */
    RwInt16  startMorphTarget; /**< startMorphTarget */
    RwInt16  endMorphTarget; /**< endMorphTarget */
    RwReal   time; /**< time */
    RwReal   recipTime; /**< recipTime */
    RpMorphInterpolator *next; /**< next */
};

/* Morph Animation */

/**
 * \ingroup rpmorph
 * This is the callback function supplied to \ref RpMorphGeometrySetCallBack 
 * and returned from \ref RpMorphGeometryGetCallBack.
 * The supplied function will be passed a pointer to the geometry's parent atomic,
 * and the position of the current interpolator.
 * The function will only be called when the position of the geometry's current
 * interpolator moves out of the current range.
 *
 * \param  atomic     Pointer to the geometry's parent atomic.
 * \param  position   Value of the current interpolator.
 * 
 * \return
 * 
 * \see RpMorphGeometrySetCallBack
 * \see RpMorphGeometryGetCallBack
 */
typedef RwReal (*RpMorphGeometryCallBack)(RpAtomic *atomic, RwReal position);

/****************************************************************************
 Function prototypes
 */

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

extern RwBool                    RpMorphPluginAttach(void);

/* Morph Animation */
extern RpGeometry               *RpMorphGeometryCreateInterpolators(RpGeometry *geometry, RwInt32 numInterps);
extern RpGeometry               *RpMorphGeometrySetInterpolator(RpGeometry *geometry,
                                                                RwInt32 interpNum,
                                                                RwInt32 startKey, RwInt32 endKey, RwReal time);
extern RpGeometry               *RpMorphGeometrySetNextInterpolator(RpGeometry *geometry,
                                                                RwInt32 interpNum, RwInt32 interpNumNext);
extern RpGeometry               *RpMorphGeometrySetCallBack(RpGeometry *geometry, RpMorphGeometryCallBack animCB);
extern RpMorphGeometryCallBack   RpMorphGeometryGetCallBack(const RpGeometry *geometry);

extern RpAtomic                 *RpMorphAtomicSetCurrentInterpolator(RpAtomic *atomic, RwInt32 interpNum);
extern RwInt32                   RpMorphAtomicGetCurrentInterpolator(RpAtomic *atomic);

extern RpMorphInterpolator      *RpMorphGeometryGetInterpolator(RpGeometry *geometry, RwInt32 interpNum);

extern RpAtomic                 *RpMorphAtomicSetTime(RpAtomic *atomic, RwReal time);
extern RpAtomic                 *RpMorphAtomicAddTime(RpAtomic *atomic, RwReal time);


/* LEGACY-SUPPORT version: */
extern RpMorphInterpolator      *_rpMorphAtomicGetInterpolator(RpAtomic *atomic, RwInt32 interpNum);

#ifdef    __cplusplus
}
#endif /* __cplusplus */

#define RpMorphAtomicGetInterpolator(_atomic, _interpNum) \
        _rpMorphAtomicGetInterpolator(_atomic, _interpNum)

#endif /* RPMORPH_H */