Panda3D
Loading...
Searching...
No Matches
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
16TypeHandle LerpBlendType::_type_handle;
17TypeHandle EaseInBlendType::_type_handle;
18TypeHandle EaseOutBlendType::_type_handle;
19TypeHandle EaseInOutBlendType::_type_handle;
20TypeHandle NoBlendType::_type_handle;
21
22LerpBlendType::LerpBlendType(const LerpBlendType&) {}
23
24LerpBlendType::~LerpBlendType() {}
25
26LerpBlendType& LerpBlendType::operator=(const LerpBlendType&) {
27 return *this;
28}
29
30PN_stdfloat LerpBlendType::operator()(PN_stdfloat t) {
31 return t;
32}
33
34EaseInBlendType::EaseInBlendType(const EaseInBlendType& c) : LerpBlendType(c)
35{
36}
37
38EaseInBlendType::~EaseInBlendType() {}
39
40EaseInBlendType& EaseInBlendType::operator=(const EaseInBlendType& c) {
41 LerpBlendType::operator=(c);
42 return *this;
43}
44
45PN_stdfloat EaseInBlendType::operator()(PN_stdfloat t) {
46 PN_stdfloat x = t*t;
47 return ((3.0f * x) - (t * x)) * 0.5f;
48}
49
50EaseOutBlendType::EaseOutBlendType(const EaseOutBlendType& c)
51 : LerpBlendType(c) {}
52
53EaseOutBlendType::~EaseOutBlendType() {}
54
55EaseOutBlendType& EaseOutBlendType::operator=(const EaseOutBlendType& c) {
56 LerpBlendType::operator=(c);
57 return *this;
58}
59
60PN_stdfloat EaseOutBlendType::operator()(PN_stdfloat t) {
61 return ((3.0f * t) - (t * t * t)) * 0.5f;
62}
63
64EaseInOutBlendType::EaseInOutBlendType(const EaseInOutBlendType& c)
65 : LerpBlendType(c) {}
66
67EaseInOutBlendType::~EaseInOutBlendType() {}
68
69EaseInOutBlendType& EaseInOutBlendType::operator=(const EaseInOutBlendType& c)
70{
71 LerpBlendType::operator=(c);
72 return *this;
73}
74
75PN_stdfloat EaseInOutBlendType::operator()(PN_stdfloat t) {
76 PN_stdfloat x = t*t;
77 return (3.0f * x) - (2.0f * t * x);
78}
79
80NoBlendType::NoBlendType(const NoBlendType& c) : LerpBlendType(c) {}
81
82NoBlendType::~NoBlendType() {}
83
84NoBlendType& NoBlendType::operator=(const NoBlendType& c) {
85 LerpBlendType::operator=(c);
86 return *this;
87}
88
89PN_stdfloat NoBlendType::operator()(PN_stdfloat t) {
90 return t;
91}
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.