# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

track.cpp

Go to the documentation of this file.
00001 
00007 /* Copyright, 2001 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #include "std3d.h"
00027 
00028 #include "3d/track.h"
00029 
00030 #include "nel/misc/rgba.h"
00031 #include "nel/misc/hierarchical_timer.h"
00032 
00033 using namespace NLMISC;
00034 
00035 namespace NL3D 
00036 {
00037 
00038 H_AUTO_DECL( NL3D_UTrack_interpolate )
00039 
00040 #define NL3D_HAUTO_UTRACK_INTERPOLATE                   H_AUTO_USE( NL3D_UTrack_interpolate )
00041 
00042 
00043 // ***************************************************************************
00044 
00045 /*
00046 // Some compilation check: force Visual to compile to template
00047 CTrackDefaultFloat ttoto10;
00048 CTrackDefaultVector ttoto11;
00049 CTrackDefaultQuat ttoto12;
00050 CTrackDefaultInt ttoto13;
00051 CTrackDefaultRGBA ttoto16;
00052 CTrackDefaultString ttoto14;
00053 CTrackDefaultBool ttoto15;
00054 */
00055 
00056 // ***************************************************************************
00057 
00058 bool ITrack::interpolate (TAnimationTime time, float& res)
00059 {
00060         NL3D_HAUTO_UTRACK_INTERPOLATE;
00061 
00062         // Evaluate it 
00063         eval (time);
00064 
00065         // Get a pointer on the value
00066         const CAnimatedValueFloat *value=dynamic_cast<const CAnimatedValueFloat*>(&getValue ());
00067 
00068         // Type is good ?
00069         if (value)
00070         {
00071                 // Ok, return the value
00072                 res=value->Value;
00073                 return true;
00074         }
00075         else
00076                 // No, return false
00077                 return false;
00078 }
00079 
00080 // ***************************************************************************
00081 
00082 bool ITrack::interpolate (TAnimationTime time, sint32& res)
00083 {
00084         NL3D_HAUTO_UTRACK_INTERPOLATE;
00085 
00086         // Evaluate it 
00087         eval (time);
00088 
00089         // Get a pointer on the value
00090         const CAnimatedValueInt *value=dynamic_cast<const CAnimatedValueInt*>(&getValue ());
00091 
00092         // Type is good ?
00093         if (value)
00094         {
00095                 // Ok, return the value
00096                 res=value->Value;
00097                 return true;
00098         }
00099         else
00100                 // No, return false
00101                 return false;
00102 }
00103 
00104 // ***************************************************************************
00105 
00106 bool ITrack::interpolate (TAnimationTime time, CRGBA& res)
00107 {
00108         NL3D_HAUTO_UTRACK_INTERPOLATE;
00109 
00110         // Evaluate it 
00111         eval (time);
00112 
00113         // Get a pointer on the value
00114         const CAnimatedValueRGBA *value=dynamic_cast<const CAnimatedValueRGBA*>(&getValue ());
00115 
00116         // Type is good ?
00117         if (value)
00118         {
00119                 // Ok, return the value
00120                 res=value->Value;
00121                 return true;
00122         }
00123         else
00124                 // No, return false
00125                 return false;
00126 }
00127 
00128 // ***************************************************************************
00129 
00130 bool ITrack::interpolate (TAnimationTime time, CVector& res)
00131 {
00132         NL3D_HAUTO_UTRACK_INTERPOLATE;
00133 
00134         // Evaluate it 
00135         eval (time);
00136 
00137         // Get a pointer on the value
00138         const CAnimatedValueVector *value=dynamic_cast<const CAnimatedValueVector*>(&getValue ());
00139 
00140         // Type is good ?
00141         if (value)
00142         {
00143                 // Ok, return the value
00144                 res=value->Value;
00145                 return true;
00146         }
00147         else
00148                 // No, return false
00149                 return false;
00150 }
00151 
00152 // ***************************************************************************
00153 
00154 bool ITrack::interpolate (TAnimationTime time, CQuat& res)
00155 {
00156         NL3D_HAUTO_UTRACK_INTERPOLATE;
00157 
00158         // Evaluate it 
00159         eval (time);
00160 
00161         // Get a pointer on the value
00162         const CAnimatedValueQuat *value=dynamic_cast<const CAnimatedValueQuat*>(&getValue ());
00163 
00164         // Type is good ?
00165         if (value)
00166         {
00167                 // Ok, return the value
00168                 res=value->Value;
00169                 return true;
00170         }
00171         else
00172                 // No, return false
00173                 return false;
00174 }
00175 
00176 // ***************************************************************************
00177 
00178 bool ITrack::interpolate (TAnimationTime time, std::string& res)
00179 {
00180         NL3D_HAUTO_UTRACK_INTERPOLATE;
00181 
00182         // Evaluate it 
00183         eval (time);
00184 
00185         // Get a pointer on the value
00186         const CAnimatedValueString *value=dynamic_cast<const CAnimatedValueString*>(&getValue ());
00187 
00188         // Type is good ?
00189         if (value)
00190         {
00191                 // Ok, return the value
00192                 res=value->Value;
00193                 return true;
00194         }
00195         else
00196                 // No, return false
00197                 return false;
00198 }
00199 
00200 // ***************************************************************************
00201 
00202 bool ITrack::interpolate (TAnimationTime time, bool& res)
00203 {
00204         NL3D_HAUTO_UTRACK_INTERPOLATE;
00205 
00206         // Evaluate it 
00207         eval (time);
00208 
00209         // Get a pointer on the value
00210         const CAnimatedValueBool *value=dynamic_cast<const CAnimatedValueBool*>(&getValue ());
00211 
00212         // Type is good ?
00213         if (value)
00214         {
00215                 // Ok, return the value
00216                 res=value->Value;
00217                 return true;
00218         }
00219         else
00220                 // No, return false
00221                 return false;
00222 }
00223 
00224 // ***************************************************************************
00225 
00226 } // NL3D