Mercurial > hg > dmlib
comparison src/dmcurves.h @ 980:43594ac98f91
Move dmClamp*() functions back to dmlib.h
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 27 Feb 2015 16:25:02 +0200 |
parents | 1b439304ff3c |
children | 7df95aefb9c6 |
comparison
equal
deleted
inserted
replaced
979:76e8dcfeb808 | 980:43594ac98f91 |
---|---|
25 } DMLerpContext; | 25 } DMLerpContext; |
26 | 26 |
27 | 27 |
28 void dmLerpInit(DMLerpContext *ctx, DMFloat start, DMFloat end, DMFloat nsteps); | 28 void dmLerpInit(DMLerpContext *ctx, DMFloat start, DMFloat end, DMFloat nsteps); |
29 DMFloat dmCatmullRom(const DMFloat t, const DMFloat p0, const DMFloat p1, const DMFloat p2, const DMFloat p3); | 29 DMFloat dmCatmullRom(const DMFloat t, const DMFloat p0, const DMFloat p1, const DMFloat p2, const DMFloat p3); |
30 | |
31 | |
32 static inline DMFloat dmClamp10(const DMFloat a) | |
33 { | |
34 return (a < 0.0f ? 0.0f : (a > 1.0f ? 1.0f : a)); | |
35 } | |
36 | |
37 | |
38 static inline int dmClamp(const int v, const int min, const int max) | |
39 { | |
40 return (v < min ? min : (v > max ? max : v)); | |
41 } | |
42 | 30 |
43 | 31 |
44 static inline DMFloat dmLerpSCurve(DMLerpContext *ctx, const DMFloat step) | 32 static inline DMFloat dmLerpSCurve(DMLerpContext *ctx, const DMFloat step) |
45 { | 33 { |
46 const DMFloat n = step / ctx->nsteps; | 34 const DMFloat n = step / ctx->nsteps; |