Panda3D
|
00001 // Filename: lerpblend.cxx 00002 // Created by: frang (30May00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "lerpblend.h" 00016 00017 TypeHandle LerpBlendType::_type_handle; 00018 TypeHandle EaseInBlendType::_type_handle; 00019 TypeHandle EaseOutBlendType::_type_handle; 00020 TypeHandle EaseInOutBlendType::_type_handle; 00021 TypeHandle NoBlendType::_type_handle; 00022 00023 LerpBlendType::LerpBlendType(const LerpBlendType&) {} 00024 00025 LerpBlendType::~LerpBlendType() {} 00026 00027 LerpBlendType& LerpBlendType::operator=(const LerpBlendType&) { 00028 return *this; 00029 } 00030 00031 PN_stdfloat LerpBlendType::operator()(PN_stdfloat t) { 00032 return t; 00033 } 00034 00035 EaseInBlendType::EaseInBlendType(const EaseInBlendType& c) : LerpBlendType(c) 00036 { 00037 } 00038 00039 EaseInBlendType::~EaseInBlendType() {} 00040 00041 EaseInBlendType& EaseInBlendType::operator=(const EaseInBlendType& c) { 00042 LerpBlendType::operator=(c); 00043 return *this; 00044 } 00045 00046 PN_stdfloat EaseInBlendType::operator()(PN_stdfloat t) { 00047 PN_stdfloat x = t*t; 00048 return ((3.0f * x) - (t * x)) * 0.5f; 00049 } 00050 00051 EaseOutBlendType::EaseOutBlendType(const EaseOutBlendType& c) 00052 : LerpBlendType(c) {} 00053 00054 EaseOutBlendType::~EaseOutBlendType() {} 00055 00056 EaseOutBlendType& EaseOutBlendType::operator=(const EaseOutBlendType& c) { 00057 LerpBlendType::operator=(c); 00058 return *this; 00059 } 00060 00061 PN_stdfloat EaseOutBlendType::operator()(PN_stdfloat t) { 00062 return ((3.0f * t) - (t * t * t)) * 0.5f; 00063 } 00064 00065 EaseInOutBlendType::EaseInOutBlendType(const EaseInOutBlendType& c) 00066 : LerpBlendType(c) {} 00067 00068 EaseInOutBlendType::~EaseInOutBlendType() {} 00069 00070 EaseInOutBlendType& EaseInOutBlendType::operator=(const EaseInOutBlendType& c) 00071 { 00072 LerpBlendType::operator=(c); 00073 return *this; 00074 } 00075 00076 PN_stdfloat EaseInOutBlendType::operator()(PN_stdfloat t) { 00077 PN_stdfloat x = t*t; 00078 return (3.0f * x) - (2.0f * t * x); 00079 } 00080 00081 NoBlendType::NoBlendType(const NoBlendType& c) : LerpBlendType(c) {} 00082 00083 NoBlendType::~NoBlendType() {} 00084 00085 NoBlendType& NoBlendType::operator=(const NoBlendType& c) { 00086 LerpBlendType::operator=(c); 00087 return *this; 00088 } 00089 00090 PN_stdfloat NoBlendType::operator()(PN_stdfloat t) { 00091 return t; 00092 } 00093