Panda3D

lerpchans.h

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