00001 /* -*- C++ -*- */ 00002 00003 /* COPYRIGHT 00004 * 00005 * This file is part of the Visual Effects Engine - VEE 00006 * 00007 * Read the "VEE-LICENSE" file for the license. 00008 * 00009 * Authors & Copyright: 00010 * 00011 * Tommi Ilmonen, Tuukka Heikura, Marko Myllymaa and 00012 * Janne Kontkanen 2001-2004 00013 * 00014 * Additional copyrights: Tekes 2003-2004 00015 * 00016 * firstname.lastname@hut.fi 00017 * 00018 */ 00019 00020 #ifndef VEE_OPERATOR_FORCE_GRADIENT_H 00021 #define VEE_OPERATOR_FORCE_GRADIENT_H 00022 00023 #include <vee_object.h> 00024 #include <vee_operator.h> 00025 #include <vee_interpolators.h> 00026 00027 #include <string> 00028 00032 class VEE_OperatorForceGradient : public VEE_Operator 00033 { 00034 public: 00035 VEE_OperatorForceGradient(); 00036 virtual ~VEE_OperatorForceGradient(); 00037 00038 virtual bool setValue(const char *, VEE_Value *); 00039 virtual void operate(VEE_Object *, float); 00040 virtual VEE_Operator * clone() const; 00041 00042 void resize(int curves) { m_curves.resize(curves); } 00043 00044 void setId(const char *name, int n) 00045 { expand(n); m_curves[n].m_param = name; } 00046 00047 void appendPoint(float v, float t, int n) 00048 { expand(n); m_curves[n].m_curve.appendPoint(v, t); } 00049 00050 void clearCurves() { m_curves.clear(); } 00051 00052 protected: 00053 00054 void expand(uint n) { if(n >= m_curves.size()) m_curves.resize(n+1); } 00055 00056 class Data { 00057 public: 00058 std::string m_param; 00059 VEE_LinearInterpolation<float> m_curve; 00060 }; 00061 00062 std::vector<Data> m_curves; 00063 00064 float m_range; 00065 float m_scale; 00066 VEE_ForceType m_forceType; 00067 }; 00068 00069 #endif