00001 // Filename: lerpblend.cxx 00002 // Created by: frang (30May00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "lerpblend.h" 00020 00021 TypeHandle LerpBlendType::_type_handle; 00022 TypeHandle EaseInBlendType::_type_handle; 00023 TypeHandle EaseOutBlendType::_type_handle; 00024 TypeHandle EaseInOutBlendType::_type_handle; 00025 TypeHandle NoBlendType::_type_handle; 00026 00027 LerpBlendType::LerpBlendType(const LerpBlendType&) {} 00028 00029 LerpBlendType::~LerpBlendType(void) {} 00030 00031 LerpBlendType& LerpBlendType::operator=(const LerpBlendType&) { 00032 return *this; 00033 } 00034 00035 float LerpBlendType::operator()(float t) { 00036 return t; 00037 } 00038 00039 EaseInBlendType::EaseInBlendType(const EaseInBlendType& c) : LerpBlendType(c) 00040 { 00041 } 00042 00043 EaseInBlendType::~EaseInBlendType(void) {} 00044 00045 EaseInBlendType& EaseInBlendType::operator=(const EaseInBlendType& c) { 00046 LerpBlendType::operator=(c); 00047 return *this; 00048 } 00049 00050 float EaseInBlendType::operator()(float t) { 00051 float x = t*t; 00052 return ((3.0f * x) - (t * x)) * 0.5f; 00053 } 00054 00055 EaseOutBlendType::EaseOutBlendType(const EaseOutBlendType& c) 00056 : LerpBlendType(c) {} 00057 00058 EaseOutBlendType::~EaseOutBlendType(void) {} 00059 00060 EaseOutBlendType& EaseOutBlendType::operator=(const EaseOutBlendType& c) { 00061 LerpBlendType::operator=(c); 00062 return *this; 00063 } 00064 00065 float EaseOutBlendType::operator()(float t) { 00066 return ((3.0f * t) - (t * t * t)) * 0.5f; 00067 } 00068 00069 EaseInOutBlendType::EaseInOutBlendType(const EaseInOutBlendType& c) 00070 : LerpBlendType(c) {} 00071 00072 EaseInOutBlendType::~EaseInOutBlendType(void) {} 00073 00074 EaseInOutBlendType& EaseInOutBlendType::operator=(const EaseInOutBlendType& c) 00075 { 00076 LerpBlendType::operator=(c); 00077 return *this; 00078 } 00079 00080 float EaseInOutBlendType::operator()(float t) { 00081 float x = t*t; 00082 return (3.0f * x) - (2.0f * t * x); 00083 } 00084 00085 NoBlendType::NoBlendType(const NoBlendType& c) : LerpBlendType(c) {} 00086 00087 NoBlendType::~NoBlendType(void) {} 00088 00089 NoBlendType& NoBlendType::operator=(const NoBlendType& c) { 00090 LerpBlendType::operator=(c); 00091 return *this; 00092 } 00093 00094 float NoBlendType::operator()(float t) { 00095 return t; 00096 } 00097