HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
CL_Support.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: CL Library
7
*
8
* COMMENTS: Contains helpful utilities and animation functions
9
*
10
*/
11
12
#ifndef __CL_ANIMATION_FUNCTIONS_H__
13
#define __CL_ANIMATION_FUNCTIONS_H__
14
15
#include "
CL_API.h
"
16
#include <
SYS/SYS_Math.h
>
17
#include <
SYS/SYS_Types.h
>
18
#include <
UT/UT_Assert.h
>
19
20
#define CL_SUPPORT_ISZERO(x) ((x) > -0.00001 && (x) < 0.00001)
21
#define CL_SUPPORT_LERP(weight) (iv + (ov - iv)*weight)
22
23
CL_API
extern
void
24
CLstretchSlopeAccel
(
25
fpreal
xscale,
26
fpreal
yscale,
27
fpreal
&slope,
28
fpreal
&
accel
,
29
bool
accel_ratio);
30
31
static
inline
fpreal
32
CLease(
fpreal
t
,
fpreal
t0,
fpreal
t1)
33
{
34
fpreal
rt, dt;
// Relative time and total time
35
36
dt = t1 - t0;
37
if
(
CL_SUPPORT_ISZERO
(dt))
38
return
.5;
39
rt = (t - t0) / dt;
40
return
(
fpreal
).5 - (
fpreal
).5 * SYScos(
M_PI
* rt);
41
}
42
43
static
inline
fpreal
44
CLeasein(
fpreal
t,
fpreal
t0,
fpreal
t1)
45
{
46
fpreal
rt, dt;
47
48
dt = t1 - t0;
49
if
(
CL_SUPPORT_ISZERO
(dt))
50
return
.5;
51
rt = (t - t0) / dt;
52
return
(
fpreal
)1. - SYScos((
M_PI
* (
fpreal
).5) * rt);
53
}
54
55
static
inline
fpreal
56
CLeaseout(
fpreal
t,
fpreal
t0,
fpreal
t1)
57
{
58
fpreal
rt, dt;
59
60
dt = t1 - t0;
61
if
(
CL_SUPPORT_ISZERO
(dt))
62
return
.5;
63
rt = (t - t0) / dt;
64
return
SYSsin((
M_PI
* (
fpreal
).5) * rt);
65
}
66
67
static
inline
fpreal
68
CLevalBezier(
const
fpreal
x
[],
fpreal
u)
69
{
70
fpreal
u1
,
u2
, u12;
71
72
u1 = (
fpreal
)1. - u;
73
u2 = u * u;
74
u12 = u1 *
u1
;
75
76
return
x[0] * u12 * u1 + (
fpreal
)3. * x[1] * u * u12 + x[3] * u2 * u
77
+ (
fpreal
)3. * x[2] * u2 *
u1
;
78
}
79
#endif
CL_API.h
GA_Names::accel
GA_API const UT_StringHolder accel
M_PI
#define M_PI
Definition:
fmath.h:90
CLstretchSlopeAccel
CL_API void CLstretchSlopeAccel(fpreal xscale, fpreal yscale, fpreal &slope, fpreal &accel, bool accel_ratio)
u1
GLdouble u1
Definition:
glad.h:2676
UT_Assert.h
SYS_Math.h
CL_API
#define CL_API
Definition:
CL_API.h:10
SYS_Types.h
CL_SUPPORT_ISZERO
#define CL_SUPPORT_ISZERO(x)
Definition:
CL_Support.h:20
u2
GLdouble GLdouble u2
Definition:
glad.h:2676
x
GLint GLenum GLint x
Definition:
glcorearb.h:409
t
GLdouble t
Definition:
glad.h:2397
fpreal
fpreal64 fpreal
Definition:
SYS_Types.h:277
CL
CL_Support.h
Generated on Wed Nov 13 2024 02:43:49 for HDK by
1.8.6