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