summaryrefslogtreecommitdiffstats
path: root/rwsdk/include/d3d8/rpspline.h
blob: 53fd8484c423795d566a5071fa834366e7bf8818 (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
138
139
140
141
/*
 * Structure for splines
 * 
 * 
 * Copyright (c) Criterion Software Limited
 */

/******************************************/
/*                                        */
/*    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.
 */

/***************************************************************************
 *                                                                         *
 * Module  :    rpspline.h                                                 *
 *                                                                         *
 * Purpose :    Spline operations                                          *
 *                                                                         *
 **************************************************************************/

#ifndef RPSPLINE_H
#define RPSPLINE_H

/**
 * \defgroup rpspline RpSpline
 * \ingroup rpplugin
 *
 * Spline Plugin for RenderWare Graphics.
 */

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

/*--- Include files ---*/
#include "rwcore.h"
#include "rpworld.h"

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

/****************************************************************************
 Global Types
 */

#define rpSPLINENAMELENGTH (32)

typedef struct RpSpline RpSpline;
/**
 * \ingroup rpspline
 * \struct  RpSpline
 * Spline object. This should be considered an opaque type. 
 * Use the RpSpline API functions to access.
 */
struct RpSpline
{
    RwObject        tType;                      /**< Internal Use */
    RwInt32         numCtrlPoints;              /**< Internal Use */
    RwInt32         nSplineType;                /**< Internal Use */
    void            *pUser;                     /**< Internal Use */
    RwV3d           *ctrlPoints;                /**< Internal Use */
    RwChar          caName[rpSPLINENAMELENGTH]; /**< Internal Use */
    /* Keep this at tail */
    RwV3d           vPts[1];                    /**< Internal Use */
};

/* Spline types */
#define rpSPLINETYPEOPENLOOPBSPLINE     (1)     /* Bezier spline, open loop */
#define rpSPLINETYPECLOSEDLOOPBSPLINE   (2)     /* Bezier spline, closed loop */

/* Spline path types */
#define rpSPLINEPATHSMOOTH              (10)    /* Normal */
#define rpSPLINEPATHNICEENDS            (11)    /* Slows down the path at the ends */

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

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

/* Opening the spline plugin */
extern RwBool RpSplinePluginAttach(void);

/* Creating and destroying splines */
extern RpSpline *RpSplineCreate(RwInt32 numCtrlPoints, RwInt32 type, RwV3d *ctrlPoints);
extern RwBool RpSplineDestroy(RpSpline *spline);

/* Finding a point and its tangent vector on the spline */
extern RwV3d *RpSplineFindPosition(RpSpline *spline, RwInt32 path, RwReal where, RwV3d *pos, RwV3d *tangent);

/* Finding a frame on the spline */
extern RwReal RpSplineFindMatrix(RpSpline *spline, RwInt32 path, RwReal where, RwV3d *up, RwMatrix *matrix);
/* LEGACY-SUPPORT MACRO */
#define RpSplineFindFrame RpSplineFindMatrix

/* Getting and setting the control points */
extern RwInt32 RpSplineGetNumControlPoints(const RpSpline *spline);
extern RwV3d *RpSplineGetControlPoint(RpSpline *spline, RwInt32 control, RwV3d *point);
extern RpSpline *RpSplineSetControlPoint(RpSpline *spline, RwInt32 control, RwV3d * point);

/* Copy a spline */
extern RpSpline *RpSplineClone(RpSpline *spline);

/* Spline reading and writing helper functions */
extern RpSpline *RpSplineRead(RwChar *name);
extern RwBool RpSplineWrite(RpSpline *spline, RwChar *name);

/* Binary format */
extern RwUInt32 RpSplineStreamGetSize(const RpSpline *spline);
extern RpSpline *RpSplineStreamRead(RwStream *stream);
extern const RpSpline *RpSplineStreamWrite(const RpSpline *spline, RwStream *stream);

#ifdef    __cplusplus
}
#endif /* __cplusplus */

#endif /* RPSPLINE_H */