root/OpenSceneGraph/trunk/src/osgPlugins/lib3ds/ease.cpp @ 1563

Revision 1563, 1.7 kB (checked in by robert, 11 years ago)

Added an #ifdef to osgGLUT/Window.cpp to handle the case of compiling against
older versions of GLUT.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[8]1/*
2 * The 3D Studio File Format Library
3 * Copyright (C) 1996-2001 by J.E. Hoffmann <je-h@gmx.net>
4 * All rights reserved.
5 *
6 * This program is  free  software;  you can redistribute it and/or modify it
[151]7 * under the terms of the  GNU Lesser General Public License  as published by
8 * the  Free Software Foundation;  either version 2.1 of the License,  or (at
[8]9 * your option) any later version.
10 *
11 * This  program  is  distributed in  the  hope that it will  be useful,  but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
[151]13 * or  FITNESS FOR A  PARTICULAR PURPOSE.  See the  GNU Lesser General Public 
[8]14 * License for more details.
15 *
16 * You should  have received  a copy of the GNU Lesser General Public License
17 * along with  this program;  if not, write to the  Free Software Foundation,
18 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * $Id$
21 */
22#define LIB3DS_EXPORT
[1563]23#include "ease.h"
[8]24
[151]25
[8]26/*!
27 * \defgroup ease Ease
28 *
29 * \author J.E. Hoffmann <je-h@gmx.net>
30 */
31
[151]32
[8]33/*!
34 * \ingroup ease
35 */
36Lib3dsFloat
37lib3ds_ease(Lib3dsFloat fp, Lib3dsFloat fc, Lib3dsFloat fn,
[151]38  Lib3dsFloat ease_from, Lib3dsFloat ease_to)
[8]39{
[151]40  Lib3dsDouble s,step;
41  Lib3dsDouble tofrom;
42  Lib3dsDouble a;
[8]43
[151]44  s=step=(Lib3dsFloat)(fc-fp)/(fn-fp);
45  tofrom=ease_to+ease_from;
46  if (tofrom!=0.0) {
47    if (tofrom>1.0) {
48      ease_to=(Lib3dsFloat)(ease_to/tofrom);
49      ease_from=(Lib3dsFloat)(ease_from/tofrom);
50    }
51    a=1.0/(2.0-(ease_to+ease_from));
[8]52
[151]53    if (step<ease_from) s=a/ease_from*step*step;
54    else {
55      if ((1.0-ease_to)<=step) {
56        step=1.0-step;
57        s=1.0-a/ease_to*step*step;
58      }
59      else {
60        s=((2.0*step)-ease_from)*a;
61      }
[8]62    }
[151]63  }
64  return((Lib3dsFloat)s);
[8]65}
Note: See TracBrowser for help on using the browser.