Panda3D
lerpblend.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file lerpblend.cxx
10  * @author frang
11  * @date 2000-05-30
12  */
13 
14 #include "lerpblend.h"
15 
16 TypeHandle LerpBlendType::_type_handle;
17 TypeHandle EaseInBlendType::_type_handle;
18 TypeHandle EaseOutBlendType::_type_handle;
19 TypeHandle EaseInOutBlendType::_type_handle;
20 TypeHandle NoBlendType::_type_handle;
21 
22 LerpBlendType::LerpBlendType(const LerpBlendType&) {}
23 
24 LerpBlendType::~LerpBlendType() {}
25 
26 LerpBlendType& LerpBlendType::operator=(const LerpBlendType&) {
27  return *this;
28 }
29 
30 PN_stdfloat LerpBlendType::operator()(PN_stdfloat t) {
31  return t;
32 }
33 
34 EaseInBlendType::EaseInBlendType(const EaseInBlendType& c) : LerpBlendType(c)
35 {
36 }
37 
38 EaseInBlendType::~EaseInBlendType() {}
39 
40 EaseInBlendType& EaseInBlendType::operator=(const EaseInBlendType& c) {
41  LerpBlendType::operator=(c);
42  return *this;
43 }
44 
45 PN_stdfloat EaseInBlendType::operator()(PN_stdfloat t) {
46  PN_stdfloat x = t*t;
47  return ((3.0f * x) - (t * x)) * 0.5f;
48 }
49 
50 EaseOutBlendType::EaseOutBlendType(const EaseOutBlendType& c)
51  : LerpBlendType(c) {}
52 
53 EaseOutBlendType::~EaseOutBlendType() {}
54 
55 EaseOutBlendType& EaseOutBlendType::operator=(const EaseOutBlendType& c) {
56  LerpBlendType::operator=(c);
57  return *this;
58 }
59 
60 PN_stdfloat EaseOutBlendType::operator()(PN_stdfloat t) {
61  return ((3.0f * t) - (t * t * t)) * 0.5f;
62 }
63 
64 EaseInOutBlendType::EaseInOutBlendType(const EaseInOutBlendType& c)
65  : LerpBlendType(c) {}
66 
67 EaseInOutBlendType::~EaseInOutBlendType() {}
68 
69 EaseInOutBlendType& EaseInOutBlendType::operator=(const EaseInOutBlendType& c)
70 {
71  LerpBlendType::operator=(c);
72  return *this;
73 }
74 
75 PN_stdfloat EaseInOutBlendType::operator()(PN_stdfloat t) {
76  PN_stdfloat x = t*t;
77  return (3.0f * x) - (2.0f * t * x);
78 }
79 
80 NoBlendType::NoBlendType(const NoBlendType& c) : LerpBlendType(c) {}
81 
82 NoBlendType::~NoBlendType() {}
83 
84 NoBlendType& NoBlendType::operator=(const NoBlendType& c) {
85  LerpBlendType::operator=(c);
86  return *this;
87 }
88 
89 PN_stdfloat NoBlendType::operator()(PN_stdfloat t) {
90  return t;
91 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81