Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/lerp/lerpchans.h

Go to the documentation of this file.
00001 // Filename: lerpchans.h
00002 // Created by:  frang (11Apr00)
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 #ifndef __LERPCHANS_H__
00020 #define __LERPCHANS_H__
00021 
00022 // There are three fundamental types of lerp channel: tabular/keyframe,
00023 // procedural, and composite.  Tabular channels may have an interpolator
00024 // associated with them, to determine values between samples.  Proceedural
00025 // channels compute each data point as needed.  Composite channels can be
00026 // either blending or concatenation objects.  Blending objects take some
00027 // number of channels as input, apply a blending function to them in order
00028 // to yield what appears to be a single channel.  Concatenation objects
00029 // take some number of channels as input and string them end-to-end to yield
00030 // what appears to be a single channel.
00031 
00032 class LerpChannelRange {
00033 private:
00034   float _low, _high;
00035 public:
00036   INLINE LerpChannelRange(float low, float high) : _low(low), _high(high) {
00037     if (low > high) {
00038       _low = high;
00039       _high = low;
00040     }
00041   }
00042   INLINE LerpChannelRange(const LerpChannelRange& c) : _low(c._low),
00043                                                        _high(c._high) {}
00044   INLINE ~LerpChannelRange(void) {}
00045   INLINE float GetLow(void) { return _low; }
00046   INLINE float GetHigh(void) { return _high; }
00047   INLINE void SetLow(float l) {
00048     if (l > _high) {
00049       _low = _high;
00050       _high = l;
00051     } else
00052       _low = l;
00053   }
00054   INLINE void SetHigh(float h) {
00055     if (h < _low) {
00056       _high = _low;
00057       _low = h;
00058     } else
00059       _high = h;
00060   }
00061   INLINE void SetRange(float l, float h) {
00062     if (l > h) {
00063       _low = h;
00064       _high = l;
00065     } else {
00066       _low = l;
00067       _high = h;
00068     }
00069   }
00070   INLINE LerpChannelRange& operator=(const LerpChannelRange& c) {
00071     _low = c._low;
00072     _high = c._high;
00073     return *this;
00074   }
00075 };
00076 
00077 template <class value>
00078 class LerpChannel {
00079 public:
00080   virtual GetValue(float p);
00081 };
00082 
00083 template <class value>
00084 class TabularChannel : public LerpChannel {
00085 };
00086 
00087 template <class value>
00088 class ProceduralChannel : public LerpChannel {
00089 };
00090 
00091 template <class value>
00092 class CompositeChannel : public LerpChannel {
00093 };
00094 
00095 template <class value>
00096 class BlendChannel : public CompositeChannel {
00097 };
00098 
00099 template <class value>
00100 class ConcatenationChannel : public CompositeChannel {
00101 };
00102 
00103 #endif /* __LERPCHANS_H__ */

Generated on Fri May 2 00:39:56 2003 for Panda by doxygen1.3